Create an interaction that stores the past 100 mouse positions and displays them as a polyline. Store the mouse data in three different ways: in two 1D arrays (one for X, one for Y); in one 2D array; and in an array of Point2D objects.
Create an interaction that stores the past 100 mouse positions and displays this path as a polyline. Move an animated ellipse along this path. When it reaches the end, return it to the start and repeat, or have it travel in the other direction.
Create a line using the past 100 mouse positions, as above. Bring your line to life by progressively adding some randomness to each point.
Create a sketch that stores the past 100 mouse positions. Draw a line between each point and the one previous to it. Make the thickness of this line inversely proportional to the distance between each pair of points, so that faster marks make thinner lines.
Load each frame of an animated walk cycle into an array of images, and loop through these to display the character in motion. When a button is pressed, reverse the playback of the animation. (Image from Eadweard Muybridge, Animals in Motion, 1902.)
A bumpy “landscape” or terrain, consisting of an array of height values, has been provided for you. Write code that searches through this array and draws “flags” on the peaks (i.e., local maxima).
Write a program that draws straight lines when the user clicks and drags. Color the longest line red.
Create a program that stores the coordinates for some rectangles in an array. Reading from this array, your program should paint the rectangles over each other as they are rendered. Write code to reverse the array. Sort the rectangles from right to left. Sort the rectangles by their area.