User-Controlled GeoGebra Animation

Here is an animation I created in GeoGebra:


As far as I can tell, WordPress only shows you the animation once, when you open this post. You can find the actual .ggb file, and an interactive applet in your browser here. (Links to related transformations applets are on this page.)

The idea was to illustrate reflection in a line and help students get a feel for the transformation. Mathematically, this is ironic, since transformations of the plane in fact do not involve motion at all: they are functions relating two static figures. Technically, each point in the original figure is an input, and a single point in the image is the output. Nothing moves!

Still, the animation helps, and it does illustrate how we think about transformations intuitively. A translation “moves” an object. A rotation “turns” it. A reflection “flips” it. In fact, in the above animation there’s a bit of a 3D flipping illusion.

I am not a GeoGebra expert, far from it, but in this post I’ll explain my approach to creating .ggb animations. I’ll use the reflection as an example, but the same basic principle can be used for many simple animations. If you know a better way to do any of this, please let me know!

These instructions work in the current version of GeoGebra 5. I hope they would also work in other recent versions of the software. 

(Note: the approach outlined below is different from and better than the one I used to create the applet cited above. This is the file I created while writing this post.)

As you work through this tutorial, you might learn some non-obvious GeoGebra features.

1. Make a slider, with Min 0, and Max 1. This will control the animation.

2. Make a line, which will serve as the reflection line. Make a polygon, which will be the pre-image. (When exploring transformations, it’s best to use an asymmetric figure. I usually make it orange, a reminder it’s the original figure.)

3. Use the reflection tool to make the reflected polygon. (I usually make it indigo, a reminder it is the image.)

4. Make vectors connecting each of the vertices of the original polygon to its image.

Here is the figure as it stands now:

Ref 1

(Digression: Notice that the vertices of the original polygon are fatter than the ones in the reflection. That is a setting in Preferences → Defaults → Point → Style, where I set the Point Size to be smaller for Dependent points. This makes it obvious which points can be manipulated directly, and which can’t.)

And here is the key idea: we will translate each original vertex by its own vector, multiplied by the slider number. When the slider is at 0, the point’s image stays in place. When the slider is at 1, the point’s image will have reached the end of the vector, in other words the original point’s  reflection. When the slider is in between, the point is in between, traveling along its vector. Here’s how you do it:

5. Show the Input Bar (in the View menu.) Create a new point by typing:

G = Translate(C, a*w)

where G is the new point we are creating, C is a vertex of the original polygon, a is the slider, and w is the vector that starts at point C. (Obviously, you should use the appropriate letters in your figure.)

Now, if you slide the slider from 0 to 1, you’ll see your new point moving from the pre-image to the image.

Do this for all the vertices of the original polygon.

6. Make a new polygon by connecting the new points in the correct order. I made it grey:

Ref 2

Success! If you move the slider back and forth between 0 and 1, your new polygon moves from the original to the image, and back.

What remains to be done: making sure that the various parts of the figure are appropriately either visible or hidden.

7. The vectors and the grey and indigo polygons’ vertices need not be visible ever, so you should hide them.

8. The grey polygon itself should only be seen while on the way, not when the slider is at 0 or 1. This is accomplished by selecting the grey polygon, and going to Edit → Object Properties → Advanced. There you can enter a Condition to Show Object. Type:

a > 0 && a < 1

(My slider’s name is a. Use your slider’s name!) && is how you enter the operator “and”, which is then shown as . You need to repeat this for all the grey polygon’s sides, which you can do by copy-pasting the condition in their own properties.

9. Finally, the indigo image should only appear when the slider is at 1. So its condition is 

a = 1

which should be entered for the polygon and its sides.

You’re done! Check that it all works as expected.

I have used this basic scheme for many animations I’ve created in GeoGebra. The mathematical heart of the strategy is the scaling of the vectors using a common multiplier, which is controlled by the user. For this to work, you need to first create the final image, which is needed to make the vectors. Among other things, this approach will allow you to animate translations and dilations. (Rotation requires a somewhat different process, where it is the angle of rotation that is scaled by the slider multiplier.)

Pedagogical note: the reason I prefer to leave the control of the animation in the hands of the user is that it allows them to think about the figure at their own pace, and backtrack if needed, rather than passively watch a video. It also makes it easier for a teacher to lead a discussion of the figure, step by step, while projecting it on a screen. To see applications of this approach, check out all my GeoGebra applets. Many of them incorporate user-controlled animations. 

— Henri

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s