I don´t get the idea of
startScroll() in this documentation.
Positive numbers will scroll the content to the left.
I don´t get it. If 0 is always on the left why scroll positive to the left? And if negative it will scroll to the right.
But why? It´s just so hard to wrap my head around it. What´s the logic behind it? Why make positive move to left?
In game and graphics programming 0 will always be either top-left or bot-left but it will always be on the left. So it will make sense to move to right with positive numbers and move to left with negative. But why is it different on startScroll?
I´m just asking cause I´m really curios as to why designed it like this.
To illustrate what is going on, see the drawing:
- The top drawings show the coordinate system:
(0,0)is on the top left, and positive directions are right (x coordinate) and down (y coordinate).
- The bottom illustrations show the effect of the scroll as it appears as the "view port" is moving.
- On the left is the position before the call to scroll
- On the right is the position after the call to scroll by x=+2, y=+3
- The the light blue rectangle is the screen "view port": the scroll method is actually moving this rectangle (the representation of the screen), and not the content. See it like a camera you look on the world through.
- The red dot is just an element positioned on the view, and it is not moving. Look at it as the world you look at.
You can see that moving the "view port" in positive x an y directions result on the red dot appear to be moving up and left. Just like you move a camera to the right will make the world in the video move left.