Animations


 

The program ANIMATE below requires a matrix [I] containing coordinates of points in your drawing (if there are n points, [I] will have 2 rows and n columns, as in the DRAW program).  It also requires matrix [J], containing pairs of points that are to be connected.  [J] has 2 rows, and as many columns as there are to be segments.  And it requires the DRAW program.

What ANIMATE does:

It animates a rotation of the figure drawn by DRAW counterclockwise around angle A about the origin, with a “growth” or “shrink” factor C.  (If C>1. the drawing increases in size.  If C < 1, the drawing shrinks. If C = 1, the drawing size does not change.)  So you see picture after picture in an animated sequence.  There is a delay D between each two pictures.  You set D between 0 (fast) and 10 (slow).

 

Drawing Program

Explanation

PrgmANIMATE

 

:While 1

:For (L,1,D)

 

:π2→Z                              

Computing π2→Z takes a while, and causes a delay. 

:End

:ClrDraw

Erases screen

:C[[cos(A),-sin (A)][sin(A),cos(A)]]*[I] [I]

Rotates picture by angle A, and changes its size by factor C

:PrgmDRAW

Draws a new picture

:End

 

 

To run the program, you need [I] and [J]. Also, from the home screen, choose values for A, C, and D. For example,

20A   (rotate by 20 degree angle)

.95C   (this will decrease the size of the picture)

5D   (this will cause an intermediate delay between pictures)

Now choose PrgmANIMATE, and press ENTER.

 

Some tasks.

 

1.  Experiment with different values for A, C, and D for a drawing.

 

2.  Can you design a beginning drawing (with two points and one segment) that will result in a square being drawn, segment by segment?

 

3.  Can you design a beginning drawing that will result in an n-sided regular polygon being drawn? 

 

4.  In order to compute p, Archimedes used a 96-gon.  Can you design 2 points and one edge of a polygon, so that you will get a 96-gon?

 

Solutions for tasks 3 and 4. (To draw a regular n-gon.)

 

Modify program ANIMATE by blocking ClrDraw by putting it in quotes:

 

Drawing Program

Explanation

PrgmANIMATE

 

:While 1

:For (L,1,D)

 

:π2→Z                              

Computing π2→Z takes a while, and causes a delay. 

:End

:"ClrDraw"

Now it does nothing.

:C[[cos(A),-sin (A)][sin(A),cos(A)]]*[I] [I]

Rotates picture by angle A, and changes its size by factor C

:PrgmDRAW

Draws a new picture

:End

 

 

Set the variables as follows:

 

[I] = 10*[[1, cos(360/n)][0, sin(360/n)]]

[J] = [[1][2]]

A = 360/n

C = 1

D = any including 0.

 

After you interrupt it by [ON][ENTER], just press [GRAPH].

 

You can clear it by ClrDraw, or put another picture on top of it.

 

In order to draw stars, change only [I], choosing k < n (and preferably relatively prime to n):

 

[I] = 10*[[1, cos(k*A)][0, sin(k*A)]]


Webpage by Owen Ramsey
Lesson Index