Quantcast
Channel: FlexMonkey
Viewing all articles
Browse latest Browse all 257

Pendulum Waves in Flex / ActionScript

$
0
0

The other day, MathsWorld tweeted a link to this video showing pendulum waves. These are waves that emerge from viewing a number of uncoupled pendulums of increasing length. If the length of the pendulums are just right, they exhibit travelling waves, standing waves and chaotic motion.

So, I thought I'd simulate the same thing in Flex. The period of a pendulum is easily calculated as:


So I created a Pendulum class that uses a Flex Rotate effect with its duration based on the length. To ensure I get some nice looking waves, I create a set of instances of Pendulum based on incrementing frequencies. There's a very basic user interface to change the lengths of the individual pendulums, change the maximum angle and set a time step.

The application lives here and the source code is available here.




Viewing all articles
Browse latest Browse all 257

Trending Articles