FEffects 1.1.1

25.02.2009 6528 0

All things works as before and you can still use FEffects' Tween in your flash8, flash9+ and JS projects.
Here come a flash9 example:

Click here to see the JS sample
These samples are both from one single testTween file:

import feffects.Tween;
import feffects.easing.Quint;
import feffects.easing.Sine;
import feffects.easing.Back;
import feffects.easing.Bounce;
import feffects.easing.Circ;
import feffects.easing.Cubic;
import feffects.easing.Elastic;
import feffects.easing.Expo;
import feffects.easing.Linear;
import feffects.easing.Quad;
import feffects.easing.Quart;
#if flash9
	import flash.display.MovieClip;
#elseif flash
	import flash.MovieClip;
#elseif js
	import js.Dom;
#end
class Main
{
	function new()
	{
		var effects = 
		[ 
			Quint.easeIn, Quint.easeOut, Quint.easeInOut,
			Sine.easeIn, Sine.easeOut, Sine.easeInOut,
			Back.easeIn, Back.easeOut, Back.easeInOut,
			Bounce.easeIn, Bounce.easeOut, Bounce.easeInOut,
			Circ.easeIn, Circ.easeOut, Circ.easeInOut,
			Cubic.easeIn, Cubic.easeOut, Cubic.easeInOut,
			Elastic.easeIn, Elastic.easeOut, Elastic.easeInOut,
			Expo.easeIn, Expo.easeOut, Expo.easeInOut,
			Linear.easeIn, Linear.easeOut, Linear.easeInOut, Linear.easeNone,
			Quad.easeIn, Quad.easeOut, Quad.easeInOut,
			Quart.easeIn, Quart.easeOut, Quad.easeInOut
		];
		
		var i = 0;
		while ( i < effects.length )
		{
			#if flash9
				var sprite = new MovieClip();
				sprite.x = i * 10 + 30;
				var gfx = sprite.graphics;
				gfx.beginFill( 0x000000, 1 );
				flash.Lib.current.addChild( sprite );
			#elseif flash
				var sprite = flash.Lib.current.createEmptyMovieClip( "sprite" + i, i );
				sprite._x = i * 10 + 30;
				var gfx = sprite;
				gfx.beginFill( 0x000000, 100 );
			#end
			#if flash
				gfx.lineTo( 10, 0 );
				gfx.lineTo( 10, 10 );
				gfx.lineTo( 0, 10 );
				gfx.lineTo( 0, 0 );
				gfx.endFill();
			#elseif js
				var sprite = js.Lib.document.createElement( "div" );
				js.Lib.document.body.appendChild( sprite );
				sprite.style.position = "absolute";
				sprite.style.backgroundColor = "#000000";
				sprite.style.padding = 5;
				sprite.style.left = i * 10 + 30 + "px";
			#end
			
			var scope = this;
			#if flash9
			var t = new Tween( 50, 150, 8000, sprite, "y", effects[ i ] );
			#elseif flash
			var t = new Tween( 50, 150, 8000, sprite, "_y", effects[ i ] );
			#elseif js
			var t = new Tween( 50, 150, 8000, effects[ i ] );
			t.setTweenHandlers( function ( e ) scope.update( sprite, e ) );
			#end
			t.start();
			t.seek( 1400 );
			
			haxe.Timer.delay( t.pause, 1000 );
			haxe.Timer.delay( t.resume, 2000 );
			haxe.Timer.delay( t.reverse, 3000 );
			haxe.Timer.delay( t.reverse, 4000 );
			haxe.Timer.delay( t.reverse, 5000 );
			haxe.Timer.delay( t.reverse, 6000 );
			haxe.Timer.delay( t.pause, 7000 );
			haxe.Timer.delay( t.resume, 8000 );
			i++;
		}
	}
	#if js
	function update( t : HtmlDom, e : Float )
	{
		t.style.top = e + "px";
	}
	#end
	
	static function main()
	{
		new Main();
	}
}

Commentaires

Laisser un commentaire

http://
×