GTween is the bomb for rapid prototyping

I’ve been using tweens a lot recently – for example while developing the small campaign site for the new Peugeot 206+ and Peugeot Blue Drive campaign (in Danish). I used GTween and GTweenTimeline to a great extent to really make it easy for me to implement and update.

One of the main things, that I conceptually did in a different way on this site is, that I created tweens before I needed them. Actually, I created tween objects without even knowing what I wanted to tween at the time.

E.g. the “sound on/off” button (which unfortunately was removed just before launch) was implemented in a very simple way. On the class I kept a reference to a tween-object, and I created an instance for this as soon as the sound started playing (in continuous loop):

var background_music:Sound = new BackgroundMusic();
var sc:SoundChannel = background_music.play(0,100000); // to infinity and beyond
soundtween = new GTween(sc.soundTransform, 0.3);

In this way, I can simply make the sound start fading by changing the volume-attribute on the proxy object of the soundtween-property:

soundtween.proxy.volume = 0; // fade out

Though, as some might remember, you cannot simply change the volume-attribute directly on the soundTransform-property of your SoundChannel. You need to copy the SoundTransform instance to a local variable, change the volume and re-assign the soundTransform-property. However, GTween takes care of this in a very simple way:

soundtween.setAssignment(sc, "soundTransform");

This is not only useful for sounds but also for all the other transform objects like DisplayObject.transform.colorTransform, DisplayObject.transform.matrix and other objects that require re-assignment before having an effect.

I will furthermore in additional posts describe how I have used GTweenTimeline for rapid prototype development with very nice transitions.

No related posts.

Category: AS3, Konstellation Comment »


Leave a Reply



Back to top

     

Get Adobe Flash playerPlugin by wpburn.com wordpress themes