Jump to content
GreenSock

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

Search the Community

Showing results for tags 'ActionScript 3ThrowPropsPlugin'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GreenSock Forums
    • GSAP
    • Banner Animation
    • Jobs & Freelance
  • Flash / ActionScript Archive
    • GSAP (Flash)
    • Loading (Flash)
    • TransformManager (Flash)

Product Groups

  • Club GreenSock
  • TransformManager
  • Supercharge

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Personal Website


Twitter


CodePen


Company Website


Location


Interests

Found 1 result

  1. Greetings from Beautiful Boise! I have some playing card (rectangular) MovieClips on the Stage. I want to startDrag() them via MOUSE_DOWN, and stopDrag() them via MOUSE_UP, measuring the speed of the motion and decaying it via ThrowPropsPlugin. Easy enough, and that's complete/fully functional. But what I'd also like to do is have the rectangle respond to the direction of motion by rotating around the mouseX and mouseY point so that it is drug behind the cursor until MOUSE_UP. I have tried the RotateAroundPointPlugin and cannot seem to configure it properly. I can trace() the proper x and y (the local x & y of the Rectangle MC vice the global x & y on the Stage), and I can get appropriate atan2() traces as well...but the doggone rectangle won't rotate properly when being drug. I've got all of the physics for the drag & throw successfully coded, but cannot recognize a way to get the rectangle to properly follow the cursor. Any thoughts or suggestions...? Thanks! Leo //Variables var x1:int; var y1:int; var time1:Number; var time2:Number; var xVelocity:Number; var yVelocity:Number; var throwAngleDegs:Number; var grabPoint:Point = new Point(); var rotatePoint:Point = new Point(); //Card Event Listeners & Functions cardA.addEventListener(MouseEvent.MOUSE_DOWN, dragCard, false, 0, true); cardA.addEventListener(MouseEvent.MOUSE_UP, throwCard, false, 0, true); //Dragging Function function dragCard(e:MouseEvent):void { Mouse.cursor = MouseCursor.HAND; TweenLite.killTweensOf(cardA); this.addChild(cardA); x1 = cardA.x; y1 = cardA.y; time1 = getTimer() cardA.startDrag(false, dragBoundsRectangle); rotateCard(); } //Throwing Function function throwCard(e:MouseEvent):void { Mouse.cursor = MouseCursor.AUTO; cardA.stopDrag(); time2 = (getTimer() - time1)/1000; xVelocity = (cardA.x - x1) / time2; yVelocity = (cardA.y - y1) / time2; TweenLite.to(cardA, 3, {throwProps:{x: {velocity: xVelocity, max: 400, min: 150}, y: {velocity: yVelocity, max: 300, min: 100}}}); } function rotateCard():void { throwAngleDegs = (Math.atan2(y1 - mouseY, x1 - mouseX) * 180/Math.PI); //Find the cursor "grab point" in the card (rectangle) Object... grabPoint.x = mouseX; grabPoint.y = mouseY; //Establish a point of rotation based on the cursor's "grab point" in the card (rectangle)... rotatePoint = cardA.globalToLocal(grabPoint); //Tween the rotation so that the card (rectangle) "follows" the drag. This will then be adapted into an //ENTER_FRAME so that it constantly updates during dragging... TweenLite.to(cardA, .2, {transformAroundPoint: {point: cardA.globalToLocal(rotatePoint), rotation: throwAngleDegs}}); }
×