Pages

Apr 6, 2010

Let's Begin with BetweenAS3 !

What is BetweenAS3 ?

Fast, powerful and professional new tweening engine developed by Yoshihiro Shindo

You can download BetweenAS3 library as a svn, swf, zip source files here.

Let me show you an easy sample in this article.

Here is an example for the beginning.

-- BetweenAS3Exam1.as class --
package exam1{
 import flash.display.Sprite;
 import flash.events.Event;
 
 import mx.core.Application;
 
 import org.libspark.betweenas3.BetweenAS3;
 import org.libspark.betweenas3.easing.*;
 import org.libspark.betweenas3.events.TweenEvent;
 import org.libspark.betweenas3.tweens.ITween;

 public class BetweenAS3Exam1 extends Sprite
 {
  public var box:Sprite;
  private var t:ITween;
  public function BetweenAS3Exam1()
  {
   this.box = new Sprite();
   this.box.graphics.beginFill(0x000000);
   this.box.graphics.drawCircle(10, 10, 5);
   this.box.graphics.endFill();
   addChild(this.box);
   this.t = BetweenAS3.tween(this.box, {x:100, y:100}, {x:0, y:0}, 0.6, Bounce.easeOut);
   this.t.play();

  }
  
  public function goRight():void{
   if(this.t!=null && this.t.isPlaying)
    this.removeTween();
    
   this.t = BetweenAS3.tween(this.box, {$x:50}, {$x:0},.5); 
   this.t.play();
  }
  
  public function goLeft():void{
   if(this.t!=null && this.t.isPlaying)
    this.removeTween();
    
   this.t = BetweenAS3.tween(this.box, {$x:-50}, {$x:0},.5); 
   this.t.play();
  }
  
  public function goUp():void{
   if(this.t!=null && this.t.isPlaying)
    this.removeTween();
    
   this.t = BetweenAS3.tween(this.box, {$y:-50}, {$y:0},.5); 
   this.t.play();
  }
  
  public function goDown():void{
   if(this.t!=null && this.t.isPlaying)
    this.removeTween();
    
   this.t = BetweenAS3.tween(this.box, {$y:50}, {$y:0},.5); 
   this.t.play();
  }
  
  private function removeTween():void{
   this.t.stop();
   this.t = null;
  }
 }
}

-- result --


You can find more examples here.

Since this BetweenAS3 Project has been released,
Thousands of Flash&Flex developer is digging on it.
There are fabulous codes is being forked in wonderfl.net.

Like this!

Also one of the most papuler developer,called JidolStar,Korean, has forked for increasing fps flash file fantastically(korean).

No comments:

Post a Comment