Build a Moving Bike using Flash in InDesign, Part 1

With CS5, you can build a bicycle and take it for a ride. Part 1 of the Build a Bike series will get your wheels turning.

I’m just sitting here watching the wheels go round and round
I really love to watch them roll

-John Lennon

When I was a kid, I had a Schwinn Sting-Ray bike that looked something like the one pictured below. Though that beloved bike is long gone, I couldn’t resist bringing it back to life with the help of CS5’s animation features. Click the image to open a SWF animation, then click the “Let’s Ride” button to see it go.

The overall effect is built up from several separate animations that are triggered to play concurrently when you click that “Let’s Ride” button. Some are obvious, like spinning wheels and pedals that revolve around the chain ring. Others are not so obvious, like the trickery needed to get the chain to appear in between the pedals. There’s a lot to describe, so I’m going to break it up into a few posts. Let’s start by doing as Mr. Lennon advised us, and watch the wheels go round and round.

Each bike wheel is a group of two ellipses and 8 sets of parallel lines rotated around a center point.

Once you’ve drawn a wheel, getting it to spin is easy. In the Animation panel, choose Spin from the Preset menu. From there, you can adjust how fast the wheel spins by changing the values for Duration and Play.

To make the wheel spin smoothly, change the value of Speed to None. The Speed menu could be called the Acceleration menu, or the Change in Speed menu. So a value of None means no change in speed.

I have my bike moving slowly so you can see the moving parts clearly. The wheels rotate only once over 4 seconds.

Getting the wheels to move horizontally while they spin involves a great trick that I learned from Bob Levine. You can only have one animation applied to an object or group. But if you group that object (or group) with something else, say, a frame with no stroke and no fill…

…you can apply another animation to the new group. In this case, I chose Move Right.

With this method, you can compound the effects of as many animations as you like on the same objects.

For the wheel, match the duration of the two animations (4 seconds).

To get both animations to play at the same time, you have to select them in the Timing panel and click the Play together button.

Presto!

The wheel rolls!

Your Mileage May Vary: In theory, you can make the wheel spin and move right with just one animation. You can apply a Move Right animation and then in the Properties section of the panel, make the Rotate value 360.

In practice with this particular project, I never got it to move as smoothly as I can with two separate animations. But try a single animation for yourself and see if it works for you. In any case, now you know the group method as a fall back.

Caveat Ungroupor: One thing to be aware of when using the group method: ungrouping will remove the animation applied to the group. Not surprising, since there is no longer anything for the animation to apply itself to, but still a potential source of nastiness for the thoughtless ungrouper. If you need to get at elements of the group, use the Direct Selection tool, or the Control panel buttons for Select Content, Next, and Previous. Or in many cases, you can simply double-click to grab a grouped object.

I Want to Ride My Pi-cycle: The key to getting the movement of the whole bike to look right is to make sure it’s traveling the right distance for the speed at which the wheels are spinning. Assuming we’re not riding this bike on a sheet of ice, there will be a normal amount of friction present. If the wheels rotate once, then the bike should travel a distance equal to the circumference of the wheel. How do you find the circumference of the wheel? Well, think back to geometry class (or just cheat and Google “circumference formula”). Since the wheel is a circle, the circumference is Pi x the diameter of the wheel. In my case, the wheel is 85 pixels in diameter. So for one rotation, it should travel 85 x 3.1415yaddayaddayadda pixels (about 267). If you’re feeling super lazy, just multiply the diameter by 3, and offer an apology to the ghost of Archimedes.

To apply the correct value for the distance traveled, click on the motion path and enter the circumference value in the Line Length (L) field in the Control panel.

You can actually enter Pi into the Control panel field, and for a moment, I thought maybe I’d find an Easter Egg where InDesign would use Pi in the calculation.

But sadly, no.

Still, how cool would that have been? I think that might have made David’s year, given his affection for Pi.

Next time we’ll take a look at animating the pedals, and you’ll have to think back to physics class and remember the difference between revolve and rotate.

Bookmark
Please login to bookmark Close

This article was last modified on December 20, 2021

Comments (25)

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading comments...