Share Posted February 10, 2015 Hi, Hope someone can help me with with this. I am trying to find a way to create a "wind effect / drift". A movie clip will be constantly be pushed back -x but clicking the stage will make it move forward +x the more you click the faster it moves. If the clicks stop it will slowly slowdown and start to drift backwards. Any support is much appreciated! Thx Link to post Share on other sites
Author Share Posted February 10, 2015 Got it working: import com.greensock.*; import com.greensock.easing.*; mc.meter.text = "0%" var push = 2 var strain = .7 // 1 normal .5 moderate .3 hard var speedCounter = 0 var tween = TweenLite.to(this, strain, {push: 1,ease: Back.easeInOut,onUpdate: showScore, paused:true}) var tl = TweenLite.to(mc, 20, {x: stage.stageWidth-mc.width/2,ease: Linear.easeNone,paused: true, onUpdate: showProgress, onComplete:done}) stage.addEventListener(MouseEvent.CLICK, changeScore); function showScore() { if (push == 1) { tl.reverse(); speedCounter = 0 tl.timeScale(.5); } else { tl.play(); if(speedCounter == 0){ tl.timeScale(1); } } } function changeScore(e: MouseEvent): void { push = 2 speedCounter+=.1 tl.timeScale(1+speedCounter); tween.restart(); } function done():void{ tl.kill(); tween.kill(); } function showProgress():void{ mc.meter.text = (int(tl.totalProgress()*100)).toString() + "%" } 1 Link to post Share on other sites