Thursday, March 29, 2012

Animated graphs in Scratch

There are several ways to draw graphs in Scratch.  The method we used this week make use of a sprite that consists of a single dot we painted.  Using the formula y = mx+c we looped through all x values from -240 to 240 and calculated the corresponding y-values. After moving the sprite to each co-ordinate, the sprite stamped an image of itself making dots that forms the graph.  The result shows how the dots are made one by one to create the graph: 

The same method can be used for parabolas. In grade 10 they only do y = a*x*x+c

Note that two different types of loops can be used.

No comments:

Post a Comment