Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

nisp

Members
  • Posts

    1
  • Joined

  • Last visited

nisp's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thank you very much guys. Being new to AS3, this saved me a lot of time ! This plugin and examples shown are awesome ! If anyone is wondering, I modified the code just a tiny bit to use the same functions for multiple (2 in my case) dials. dial_1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); dial_2.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); var objj; function mouseDownHandler(event:MouseEvent):void { objj = event.currentTarget; TweenLite.killTweensOf(objj); offset = Math.atan2(objj.y - this.mouseY, this.mouseX - objj.x); r1 = r2 = objj.rotation; t1 = t2 = getTimer(); objj.addEventListener(Event.ENTER_FRAME, enterFrameHandler); objj.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } function enterFrameHandler(event:Event):void { r2 = r1; t2 = t1; var newOffset:Number = Math.atan2(objj.y - this.mouseY, this.mouseX - objj.x); objj.rotation += (offset - newOffset) * RAD2DEG; offset = newOffset; r1 = objj.rotation; t1 = getTimer(); } function mouseUpHandler(event:MouseEvent):void { objj.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); objj.removeEventListener(Event.ENTER_FRAME, enterFrameHandler); var time:Number = (getTimer() - t2) / 1000; var dif:Number = objj.rotation - r2; if (dif != dif % 180) { dif += (dif < 0) ? 360:-360; } var rVelocity:Number = dif / time; //New line of code below ThrowPropsPlugin.to(objj, {throwProps:{rotation:{velocity:rVelocity, resistance:250}}, ease:Strong.easeOut}, 10, 0.25, 2); }
×