HI. I looked at the orthographic and sequential examples and combined elements from both to create an animation controlled by the mouse position, using some ink in water footage I had left over from another project.
The orthographic example uses a feature called map(), which takes an input variable (in this case the mouse's X position) and reformats it for a specified range (the % of the cube that is revealed).
I took the image array from sequential and connected it to a mapped mouse x position, so that my program would allow me to scrub back and forth through an animation by moving my mouse.
Here, the progress variable maps my mouse position, which could be any number of the pixels in the window of the program, to the much smaller number of frames in my animation (30). The number is then used to call which frame is being displayed given the mouse position in "image(images[progress],0,0)."
I used the same progress variable as the content of a text() function, so you can see the number of the frame being displayed on the mouse cursor.
No comments:
Post a Comment