Over the past week, I have had opportunity to play with some ideas for particle generation that have been floating around in my mind for a while. Why particles? Well, while single object animations are great, there is a certain level of realism to movement in everything from explosions and fireworks to dust and debris when your environment can act upon the individual particles that make up your animation. Enter the particle generator. Instead of simply embedding an explosion movie into the appropriate scene, we can instead render a particle generator. These generators will then produce the debris for our effect, and each element (or particle) of that debris will be able to interact with its environment – from gravity to boundaries. By calculating each particle to have a mass of its own, the effects can be quite pleasing.
Continue reading
Tag Archives: Movement algorithms
Pendulums, Gravity and Angular Acceleration
Continuing my personal studies on simulating true gravitational acceleration in Actionscript, a couple days ago I arrived at one of the more conceptually challenging tasks I have tackled to date: the pendulum. I say conceptually challenging, because I tried to create a realistic pendulum in Flash a year or so ago and gave up after giving it a go. Now I realize that not only was my understanding of Actionscript limited then, but my realization of what true pendulum physics entails was also somewhat amiss.
As with any new task I set out to complete (especially those requiring a significant level of new knowledge on my part), I start with an array of Google searches — search terms like pendulum math, pendulum physics and actionscript pendulum tutorial to name a few. What intrigued me is that, while the results for such searches were incredibly numerous, very few of them actually tackled the topic of realistic pendulum movement. Instead, the majority of them (like this informative tutorial) create a facade to display a fairly believable pendulum motion by setting some random oscillation variables to the rotation of the movie clip. While this may suffice for the average SWF presentation, I wanted to find a much more realistic look that actually allows the pendulum object to react to forces acting upon it.
Continue reading
Simulating Gravitational Forces in AS3
So, I may have bitten off a bit more than I could chew in this post, but it is something that has been an intriguing thought to me for some time: how can I simulate the effect, or pull, of gravitational forces between different objects on my stage? Obviously, if you read my previous post, you know that I have had some fascination with orbits and circular motions, but I am much more interested in paths that appear to be natural — almost evolving, if you will.
This got me to contemplating that, in our universe, every object acts upon every other in some way: keeping our planets in orbit around the sun while helping each other to retain their individual satellites and keep from hurtling into outer space. Embodying the interactions of the various bodies on one another and trying to come up with a simple enough algorithm that will simulate a fluid motion while not overloading the Flash player with unnecessary overhead was my goal. I have some work yet to do, but I thought I would at least share my concepts with you and see what improvements can be made whilst still keeping things lightweight.
Continue reading
Circular Rotation and Orbiting in AS3
Once again, the OOP support in AS3 makes for simplifying some previously complicated effects down to a simple implementation. In this post, I want to give an overview of something that nearly anyone who ever deals in manual animation will need to figure out: circular rotation and/or orbiting around another object. To assist in this, I have created an extremely simple orbiter class that will take a few arguments to define its behavior along with a target (or origin) around which to orbit. I have written this in such a way as to accept any Object as an origin, so this will allow us to assign an Orbiter object to rotate around anything in our SWF.
Now, as many people are not only apprehensive about math when dealing in Flash but also attempt to avoid it entirely. That is one of the reasons I tried to consolidate the orbiting pattern into a simple object: it allows for us to deal with one single algorithm that can be found all over the internet and implement it to nested objects to create some pretty complex orbital patterns. Of course, since we are dealing with circular patterns, this isn’t the appropriate method to approach the issue of true planetary or elliptical orbits, but for effects and basic visuals, it works quite well. The Orbiter object is not intended to be a solution in and of itself, but rather it is intended to be a base class upon which you can build specific rotational objects with their own visuals and effects.
Continue reading
Movement and Event Handling with AS3

A couple days ago, I decided I wanted to teach myself a few movement algorithms withing Flash using Actionscript 3. I started with simple Event.ENTER_FRAME event trapping to move an object across the screen, and then I decided to make it a bit more interesting. What I ended up with is this small target practice game. It isn’t very feature rich by any means, but the different things I was able to learn and apply in a relatively short amount of time — like my particle system, easing an object into a destination and MouseEvent trapping — are invaluable to learn if you are going to do anything remotely professional with AS3.
Although I don’t claim to be a professional yet (that will come with time), my intent is to share any interesting discoveries I have made in order to help someone along through the learning stages I have just completed. Just below this paragraph, you will see the target practice game displayed. Simply click the targets to destroy them, and when you need more (or if you want to overload the app), just click the green circle in the top right. You will notice that a main feature of this app is significant randomization: from the position and motion of the targets to the amount and direction of the debris that scatters when those targets are destroyed. So, to aid in your learning, I have provided the source code for this app for you to study as well. The download link will appear at the end of the post.
Continue reading