import flash.display.MovieClip; import flash.display.Sprite; import flash.events.MouseEvent; import caurina.transitions.Tweener; import caurina.transitions.properties.CurveModifiers; CurveModifiers.init(); // var _mc:MovieClip = new MovieClip(); with (_mc.graphics) { beginFill(0xffff00, 1); drawCircle(20,20,18); endFill(); } addChild(_mc); // tween_1(); // function tween_1():void { Tweener.addTween(_mc, { x:480, y:100, _bezier:[{x:150, y:350}, {x:350, y:100}, {x:280, y:330}, {x:100, y:200}], delay:0.5, time:2, scaleX:2, scaleY:2, transition:"easeInOutQuint", onComplete:tween_2 } ); } // function tween_2():void { Tweener.addTween(_mc, { x:30, y:30, _bezier:[{x:150, y:350}, {x:350, y:100}, {x:280, y:330}], delay:0.5, time:3, scaleX:1, scaleY:1, transition:"easeInOutQuint", onComplete:tween_1 } ); } addChild(click_mc); click_mc.buttonMode = true; click_mc.flag = true; click_mc.addEventListener(MouseEvent.CLICK, removeBall); function removeBall(e:MouseEvent):void{ if(click_mc.flag){ removeChild(_mc); click_mc.flag = false; }else{ addChild(_mc); click_mc.flag = true; } }
//******將複數個曲線點存入myPath陣列,做為貝茲的路徑
1000105_Tweener_CurveModifiers_bezier_2.swf
import flash.display.MovieClip; import flash.display.Sprite; import flash.events.MouseEvent; import caurina.transitions.Tweener; import caurina.transitions.properties.CurveModifiers; CurveModifiers.init(); // var _mc:MovieClip = new MovieClip(); with (_mc.graphics) { beginFill(0xffff00, 1); drawCircle(20,20,18); endFill(); } addChild(_mc); //******將複數個曲線點存入myPath陣列,做為貝茲的路徑 var myPath:Array = new Array(); myPath.push({x:150, y:350}); myPath.push({x:100, y:200}); myPath.push({x:280, y:330}); myPath.push({x:300, y:20}); myPath.push({x:350, y:50}); // tween_1(); // function tween_1():void { Tweener.addTween(_mc, { x:480, y:100, //******將myPath陣列指定給_bezier _bezier:myPath, delay:0.5, time:3, scaleX:2, scaleY:2, transition:"easeInOutQuint", onComplete:tween_2 } ); } // function tween_2():void { Tweener.addTween(_mc, { x:30, y:30, _bezier:[{x:150, y:350}, {x:350, y:100}, {x:280, y:330}], delay:0.5, time:3, scaleX:1, scaleY:1, transition:"easeInOutQuint", onComplete:tween_1 } ); } addChild(click_mc); click_mc.buttonMode = true; click_mc.flag = true; click_mc.addEventListener(MouseEvent.CLICK, removeBall); function removeBall(e:MouseEvent):void{ if(click_mc.flag){ removeChild(_mc); click_mc.flag = false; }else{ addChild(_mc); click_mc.flag = true; } }
沒有留言:
張貼留言