SoTexty AS3 Text Effects Framework

Friday, February 27th, 2009

The core of my FITC presentation revolved around a new as3 text effects framework that I've been working on, which I'm currently calling "SoTexty".

The basic premise of the framework is that it sets up the various "stages" or "states" of a text effect:

  • Intro : how the effect appears
  • Loop : the "main" effect, this can loop between 1 and infinity times
  • Exit : how the effect goes away
  • MouseOver : from the loop effect, an optional behaviour reacting to user interactions
  • MouseOut : either a "reverse" of the mouseOver, or a different effect
  • MouseClick : either a link to the "exit", or an alternate effect

Some of these "states" or "stages" are optional. The framework expects a textfield, along with a list of parametrized effects which are assigned to the various "stages", and then produces the complete effect.

The Framework also comes with a "catalogue" of effect types, which for the moment are:

  • BlockEffect : an effect which animates the entire text as one
  • SplitEffect : animates the characters in the text individually
  • ParticleEffect : animates "particles" which are assigned to populate the "shape" of individual characters
  • VectorEffect : animates the vector shapes (points) which construct the individual characters

A basic example of a SoTexty effect can be produced with code that looks something like:

Actionscript:
  1. override protected function init(tf:TextField):void{
  2.    
  3.     this._intro_effect=new TextEffect(tf);
  4.     var f:Fade=new Fade(2,0,1);
  5.     this._intro_effect.addEffect(f);
  6.    
  7.     this._loop_effect=new TextEffect(tf);
  8.     var rf:RandomFade=new RandomFade(0,1,1,3);
  9.     this._loop_effect.addEffect(rf);
  10.  
  11.     this._exit_effect=new TextEffect(tf);
  12.     f=new Fade(3,1,0);
  13.     f.easing=Elastic.easeOut;
  14.     this._exit_effect.addEffect(f);
  15.  
  16. }

All SoTexty Effects extend one of the "catalogue effect" types, and populates instances of "effect states" with effects like Fade, Move, Scale etc.

The framework uses Grant Skinners GTween for animations. I intend to put it up on google code once I've sorted out some kinks. Hopefully in the coming few months.

The main idea is to take out the "donkey work" of generating common effects for loaders, between game levels, intros etc. Leaving the programmer to focus on the interesting bits of the application (game play etc.)

Click the images below for a few quick samples:


Block Effect


Split Effect


Particle Effect

**Apparently throws errors in macs**

Vector Effect

**Apparently this one also, throws errors in macs**

3D Text Effect

Stay tuned, plenty more to come :)