« March 2005 | Main | May 2005 »

April 25, 2005

links for 2005-04-25

April 18, 2005

links for 2005-04-18

April 15, 2005

links for 2005-04-15

April 10, 2005

Actionscript - Tweens

There are some very cool classes that come with Flash MX 2004. One of them is the Tween class, which allows you to use one line of code to tween a property of an object from one value to another. Even cooler is that you can use easing functions to make the movement seem more natural. The most obvious thing to tween is the postion of a movieclip, but it will tween any property of an object, so the possibilities are endless. The built in tween class is built on the tween class created by Robert Penner.

Syntax

The Tween class has the following syntax.
new Tween( object, property, easing_function, start, end, time, useSeconds )

The easing functions that come with flash mx 2004 are stored in mx.transitions.easing and are:
Back
Bounce
Elastic
None
Regular
Strong

each of these has an easeIn, an easeOut and an easeInOut function within them (eg Back.easeIn, Bounce.easeOut, Elastic.easeInOut)

Examples

In the following examples I am presuming you've used the following 2 lines of code, so we don't need to use mx.transitions everywhere.
import mx.transitions.Tween;
import mx.transitions.easing.*;

To move a movieclip called 'george' from 0 to 100 horizontally over 2 seconds with a regular ease in and out use:
var twn:Tween = new Tween( george, "_x", Regular.easeIn, 0, 100, 2, true);

To fade out a movieclip called 'clarity' over 15 frames with a strong ease in and out.
var twn:Tween = new Tween( clarity, "_alpha", Strong.easeInOut, 100, 0, 15, false);

To make a movieclip called 'logo' 50% bigger than it already is in 5 seconds use:
var twnx:Tween = new Tween( logo, "_xscale", Strong.easeOut, logo._xscale, logo._xscale+50, 5, true);
var twny:Tween = new Tween( logo, "_yscale", Strong.easeOut, logo._yscale, logo._yscale+50, 5, true);

April 09, 2005

Back to the blog

I had the good fortune to see gavin bell again last night. He's inspired me to start using this blog to post more than just flickr pictures and del.icio.us links. So I'm going to start trying to put some stuff up here and see what happens. :-)

links for 2005-04-09

April 01, 2005

Education goes street

Education goes street

Urban Texture

Urban Texture