Jump to content
GreenSock

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

Buzzafett

Members
  • Posts

    32
  • Joined

  • Last visited

Profile Information

  • Gender
    Male

Buzzafett's Achievements

2

Reputation

  1. Hi Jack, I can't update to the new version at the moment as my subscription has run out. Could you add the rotation snap code to your throwProps_rotation_demo.fla anyway and I'll update at a later date. Thanks.
  2. I'm using Greensock 12 Beta, throwProps v12.0.9, what's the newest version of Greensock? The snapping code works with the example code, just not in your new throwProps_rotation_demo.fla.zip /** * VERSION: 12.0.9 * DATE: 2013-06-25 * AS3 * UPDATES AND DOCS AT: http://www.greensock.com **/
  3. Hi Jack, That's just what I was looking for, a big thanks. The dial shows 10 rotations as 3600º I've had a go at linking some rotation snap code I received from another post of mine. http://forums.greensock.com/topic/8204-throwprops-90-degrees-rotation-snap/ Is it possible to take a look as I can't seem figure it out. I'm getting 'ERROR: No velocity was defined in the throwProps tween of [object Object] property: end' It amends the following code to the bottom of the original AS3 throwProps example. It uses velocity:rVelocity and getEnd in throwPropsPlugin.to() after the line var rVelocity:Number = dif / time; //New line of code below ThrowPropsPlugin.to(dial, {throwProps:{rotation:{velocity:rVelocity, resistance:250, end:getEnd}}, ease:Strong.easeOut}, 10, 0.25, 2); } //New Function function getEnd(endValue) { var rotationSnap = 90; //Flash needs degrees. No need to convert to radians return Math.round(endValue / rotationSnap) * rotationSnap; }
  4. Hi Jack, I'm using Greensock 12 Beta with the throwProps code below. I knew there would be an easier way than my ott code. How would the numberofRotations code be applied to the throwProps code? import com.greensock.*; import com.greensock.plugins.*; import com.greensock.easing.*; import flash.events.MouseEvent; import flash.geom.Rectangle; import flash.utils.getTimer; import flash.display.*; TweenPlugin.activate([ThrowPropsPlugin]); var RAD2DEG:Number = 180 / Math.PI; var t1:uint, t2:uint, r1:Number, r2:Number, offset:Number; dial.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); function mouseDownHandler(event:MouseEvent):void { TweenLite.killTweensOf(dial); offset = Math.atan2(dial.y - this.mouseY, this.mouseX - dial.x); r1 = r2 = dial.rotation; t1 = t2 = getTimer(); dial.addEventListener(Event.ENTER_FRAME, enterFrameHandler); dial.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } function enterFrameHandler(event:Event):void { r2 = r1; t2 = t1; var newOffset:Number = Math.atan2(dial.y - this.mouseY, this.mouseX - dial.x); dial.rotation += (offset - newOffset) * RAD2DEG; offset = newOffset; r1 = dial.rotation; t1 = getTimer(); } function mouseUpHandler(event:MouseEvent):void { dial.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); dial.removeEventListener(Event.ENTER_FRAME, enterFrameHandler); var time:Number = (getTimer() - t2) / 1000; var dif:Number = dial.rotation - r2; if (dif != dif % 180) { dif += (dif < 0) ? 360 : -360; } var rVelocity:Number = dif / time; ThrowPropsPlugin.to(dial, {throwProps:{rotation:rVelocity, resistance:250}, ease:Strong.easeOut}, 10, 0.25, 2); }
  5. Hi, I'm using the throwProps dial code from the Greensock example. I need to calculate which turn of the dial the user is on eg. turn 2 of 10 How would I do this? At the moment I am trying to calculate whether the user is turning the dial clockwise or anti-clockwise. Then either adding 1 to the turn count if the turn is clockwise and the rotation value equals 359º or subtracting 1 from the turn count if the turn is anti-clockwise and the rotation value equals 0º Is this the correct way or is there another way by adjusting the original sample code? Here's my code in addition to the throwProps sample code. The calculateDialDirection is wrong, so I need a delay of some sort when grabbing the old and the new rotation values. Maybe with an array. // Calculate Direction of Dial (Clockwise or anti-clockwise) // --------------------------- var oldDialRotation:Number; var newDialRotation:Number; var calculateDialDirection:Number; var dialRotationDirection:uint; // Grab first rotation value oldDialRotation = degFromDeg(dial.rotation); // i.e. 5º // Grab second rotation value newDialRotation = degFromDeg(dial.rotation); // i.e. 10º calculateDialDirection = newDialRotation - oldDialRotation; if (calculateDialDirection > 0 ){ dialRotationDirection = 1; // Clockwise } else if (calculateDialDirection < 0 ){ dialRotationDirection = 0; // Anti-Clockwise } else { // No Change } // Count How Many Times Dial Has Turned var wheelTurnNumber:int = 0; if (dialRotAFTERdegFromDeg == 359 && dialRotationDirection == 1){ // Clockwise wheelTurnNumber ++; } else if (dialRotAFTERdegFromDeg == 0 && dialRotationDirection == 0){ // Anti-Clockwise wheelTurnNumber --; }
  6. Is there any way to output a Greensock animation to an Animated GIF, without going through an SWF to GIF Converter? Exporting the animation from Flash CS6 using File > Export > Export Movie... > Animated GIF results in a 1 frame animated gif as the code only resides on 1 frame.
  7. Hi Carl, thanks for taking time to answer my question. I think we'll go with the array method for now.
  8. Hi, Need help with adding blur to a background using GreenSock, in a similar way to the vertically swiping Control Center screen in iOS 7. At the moment we're having to add blur to every single movie clip behind the main layer. TweenMax.to(container.mc, 1, {blurFilter:{blurX:20, blurY:20}}); . What we need is for the foreground layer to blur 'anything' that appears behind it, not just the elements we specify. Is this even possible?
  9. Here's the code I used. var pp1:PerspectiveProjection = new PerspectiveProjection(); pp1.fieldOfView = 20;// 1 to 179. Default 55 pp1.projectionCenter = new Point(mc1.x,mc1.y); mc1.transform.perspectiveProjection = pp1;
  10. Thanks Carl, perspectiveProjection is just what I was looking for.
  11. I am developing a Metro UI style tile menu. How do I change Greensock's perspective, effectively flattening the camera zoom as you would in a 3D package? Also, how would I give each movie clip it's own perspective instead of using the entire stage? I have tried to illustrate what I mean in the screenshot. import com.greensock.*; import com.greensock.easing.*; var myTimeline:TimelineLite = new TimelineLite(); myTimeline.insert(new TweenLite(mc, 1, {rotationY:90, delay:0})); myTimeline.append(new TweenLite(mc, 1, {rotationY:0 , delay:0})); myTimeline.play();
  12. How would I use the code on several dials without duplicating the entire code? Using an array maybe?
  13. Thanks again Carl. All is working now. Must just have been one of those restart computer/Flash solutions.
  14. I'm using Greensock v12 Beta. The dial rotates smoothly, but no snap.
  15. Thanks Carl. I amended the new code into a clean version of the ThrowProps Rotation Demo code.fla The snap code doesn't seem to work. Something to do with the getEnd(endValue) maybe? import com.greensock.*; import com.greensock.plugins.*; import com.greensock.easing.*; import flash.events.MouseEvent; import flash.geom.Rectangle; import flash.utils.getTimer; import flash.display.*; TweenPlugin.activate([ThrowPropsPlugin]); var RAD2DEG:Number = 180 / Math.PI; var t1:uint, t2:uint, r1:Number, r2:Number, offset:Number; dial.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); function mouseDownHandler(event:MouseEvent):void { TweenLite.killTweensOf(dial); offset = Math.atan2(dial.y - this.mouseY, this.mouseX - dial.x); r1 = r2 = dial.rotation; t1 = t2 = getTimer(); dial.addEventListener(Event.ENTER_FRAME, enterFrameHandler); dial.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } function enterFrameHandler(event:Event):void { r2 = r1; t2 = t1; var newOffset:Number = Math.atan2(dial.y - this.mouseY, this.mouseX - dial.x); dial.rotation += (offset - newOffset) * RAD2DEG; offset = newOffset; r1 = dial.rotation; t1 = getTimer(); } function mouseUpHandler(event:MouseEvent):void { dial.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); dial.removeEventListener(Event.ENTER_FRAME, enterFrameHandler); var time:Number = (getTimer() - t2) / 1000; var dif:Number = dial.rotation - r2; if (dif != dif % 180) { dif += (dif < 0) ? 360:-360; } var rVelocity:Number = dif / time; //New line of code below ThrowPropsPlugin.to(dial, {throwProps:{rotation:{velocity:rVelocity, resistance:250, end:getEnd}}, ease:Strong.easeOut}, 10, 0.25, 2); } //New Function function getEnd(endValue) { var rotationSnap = 90; //Flash needs degrees. No need to convert to radians return Math.round(endValue / rotationSnap) * rotationSnap; }
×