Shake Plugin for TweenMax

When creating animations in AS3, I often use the tweening engine TweenMax (or TweenLight). Its lightweight, powerful and easy to use. But one thing I often stumble upon is the lack of letting something shake. Thanks to its plugin architecture it is pretty easy to extend. So I wrote a simple shake plugin.

The use is pretty straightforward, if you know TweenMax a little. Inside the property-object of the tweening instance you define another “shake” object, inside which you write down the properties and their shaking amount, like this:, 1, {shake:{x:15, y: 15, numShakes:3} });

There is only one (optional) special property, numShakes. It does, what it says. It defines the number of shakes done in the timeframe given.

The shake itself is defined by a decaying sinus curve.

Of course you can combine any number of shakes, even with the same target property – I deactivated the overwrite manager for this, as the property changes are stored separately, so a single property can be manipulated several time. I guess its possible to have this behaviour with the overwrite manager enabled, but I never really got into using the overwrite manager.

You can download the ShakePlugin in the Files section.

7 thoughts on “Shake Plugin for TweenMax

  1. Hi there, afraid I’m getting this error ‘Property shake not found on flash.display.Sprite and there is no default value.’ Looking into your code I see you are trying to set properties such as: this.overwriteProps and this.propName, but in the class you extend (TweenPlugin) these exist as _overwriteProps and _propName. Just wondering how old your version of TweenMax is. Cheers, Andy.

  2. Great plugin, thanks for that!
    Just remember to activate the plugin using:

  3. Why can’t you just use the yoyo property combined with repeat property? U can achieve exactly that without need to write another plugin :)

    • I did this before. But I found it to be way less comfortable than using a plugin. And as I used this kind of motion very often, I wrote this plugin for it :)

Leave a Reply to biscito Cancel reply

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


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>