Jump to content
Search Community

Search the Community

Showing results for tags 'transformaroundpointplugin'.

  • 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 4 results

  1. Are there any shortcuts in TransformAroundPointPlugin? Something like TOP_RIGHT or BOTTOM_CENTER as in LiquidStage.
  2. I'm very new to actionscript and currently working on a game in Flash for a class assignment. The teacher recommended tweening the objects in the game, like bullets, enemies, ect. So as an enemy behavior, I'm trying to tween it to approach the player as it travels in a circle, so that it would approach in a spiral, eventually colliding with the player if they failed to shoot it. After some searching, I've found the TransformAroundPoint addon, which is very helpful and almost what I'm looking for. TweenMax.to(enemy, 3, {x:player.x, y:player.y, ease:Linear.easeNone, transformAroundPoint:{point:new Point(player.x, player.y), rotation:360}}); So when this line executes, it does in fact rotate 360 around the player, but the point it rotates on is also tweened as the enemy moves towards the player. I've tried different combinations of code, and looked at the TransformAroundPoint plugin itself to see if I could modify it to work for my needs, but I'm just not experienced enough. If anyone knows how to define the transform point as an absolute position that does not tween, I would be very appreciative. Edit: I've attempted something else to get it to work, and despite what seems to be sound logic it fails. Here's a figure to understand what I'm trying to do better. As it stands, the player is the center black shooter (pointing to the right in this image). When the game runs it looks towards the mouse, and the two balls to the right and left of it rotate with it in a circle, always the same radius from the player (also note that the player cannot move, only look). The red circle is the Target, and that is what bullets fired from the player tween to, since you must tween to a location and not a distance (it helps avoid a lot of trig that was not working in earlier iterations). At the moment, enemies spawn from prevous target locations based on locations the player shot a bullet (a clever way to render them on the circle for testing purposes). Now, I theorized that since everything that resides within the transformAroundPoint plugin is self contained, and that it was being transformed across the screen to the player's location, why not have the inerior points move in an opposite and equal direction to the player. I implimented this with the blue dot, which also perfectly rotates around the player opposing the red dot, and updated the transformAroundPoint plugin to this: TweenMax.to(enemy, 3, {x:player.x, y:player.y, ease:Linear.easeNone, transformAroundPoint:{point:new Point(player.x, player.y), x:opposingTarget.x, y:opposingTarget.y, rotation:360}}); In this scenario, the enemy should move towards the player, while the interior tween the enemy rotates around the player while moving away. While the code complies, it stragely does the exact same thing it did before, despite the fact that if I replace the x and y destinations inside the plugin, it reloates the point to that location. Needless to say, this is rather bizzare, and if anyone has any advice I'd be happy to hear it.
  3. 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}}); }
  4. I´m trying to Tween a MC scale in a way it transformation point be always in the center of the screen. I though the TransformAroundPointPlugin already done the transformation by a absolute position point. But the code do not works as expected. It seams do use a coordinate relative to the MC that is transformed. Is TransformAroundPointPlugin work with absolute or relative values? If is relative, how can i find dynamically the right relative coordinate to the center of the screen? Here is the code: TweenMax.to(spriteArt.container, 0.5, {transformAroundPoint:{point:new Point(400, 200), scaleX:spriteArt.container.scaleX + ((1-scalleVar)*(1-parallaxVar)), scaleY:spriteArt.container.scaleY + ((1-scalleVar)*(1-parallaxVar))}});
×
×
  • Create New...