Jump to content
GreenSock

dmb85

Members
  • Posts

    11
  • Joined

  • Last visited

dmb85's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. dmb85

    Famo.us vs. Greensock

    I just spent an hour playing around with it, and it looks like TweenMax can animate famo.us stuff just fine. I have no idea about performance benchmarks but I got a Surface to animate around at 60FPS in chrome (after a few seconds of 10-20FPS performance which seems typical of HTML5 stuff). The main challenge is the famo.us API basically exposes no properties. You can't for instance tween the x,y position of a Surface directly, you have to call a function on its Modifier, and feed this function updated transform values. So you have to make an intermediary generic object with whatever values you want to tween, let tweenmax tween those, make a new Transform out of those values, and then feed that transform into the transformFrom() function of the Modifier. I did that by calling it via an onUpdate function in the TweenMax object. Overall I was left feeling like the famo.us API is pretty clunky, but that's just my uninformed opinion using it for barely an hour.
  2. That worked perfectly! Thank you so much. No wonder I was confused, I had no idea Flash actually reports rotation like that... guess I need to do more stuff involving rotation tweens.
  3. I'm trying to make a simple pressure gauge that has a needle that rotates about 220 degrees. I have 2 tweens, one that tweens rotation to 220, and another that tweens it back to 0. My problem is that when the 2nd tween occurs, its acting like shortRotation is enabled - its tweening the needle to 360, so that it appears that the needle is going around the bottom of the gauge. What am I doing wrong here? This is my entire code: import flash.events.MouseEvent; import com.greensock.TweenLite; onBtn.addEventListener(MouseEvent.CLICK, handler); offBtn.addEventListener(MouseEvent.CLICK, handler); function handler(evt:MouseEvent):void { switch(evt.target){ case onBtn: TweenLite.to(rotator, 1, {rotation: 220}); break; case offBtn: TweenLite.to(rotator, 1, {rotation: 0}); break; } } Thanks in advance for any help!
  4. Sorry about that; I've deleted that file from the site. If you cannot see the issue then it may be something specific to my machine. I've only tested it there. I will test it on a few other machines and see if I can replicate it there, and report back my findings. Thanks!
  5. Unfortunately I'm not applying movement anywhere aside from the MOUSE_MOVE handler. But thank you for pointing out the delta/rounding issues thing, I had not even considered that. I've made up a simple example showing the issue. I've included the version of the v11 codebase I'm using in case that matters. Hmm, the forums wouldn't let me upload any file... heres a remote location you can grab it from: [link removed because it contained members-only plugins and classes] Thanks so much for your help and time!
  6. Unfortunately it still has this issue no matter where the evt.updateAfterEvent is called. I also tried messing around with the event priorities, making the MOUSE_UP and MOUSE_DOWN events at priority 99, but that had no effect. I'm kind of stumped as it doesn't appear to matter when updateAfterEvent is being called, merely that it's being called.
  7. I have a draggable movieclip on my stage that is dragged simply by listening for MOUSE_MOVE, and updating its position by comparing the current mouse coordinates to old coordinates stored in a Point variable. Pretty standard stuff. The problem I'm having appears when the user releases the mouse. I have TweenMax (and ThrowPropsPlugin) giving the movieclip some inertia-type movement based on delta of the mouse position. Without updateAfterEvent(), the tween looks and performs normally no matter how fast you drag the mouse. But with updateAfterEvent(), if you release the mouse button while the mouse is moving, the movieclip instantly "teleports" about 100-200 pixels away from where it should be and the tween appears to complete in about half the time it should. This isn't an issue with ThrowPropsPlugin because ive seen this same behavior in another project that only uses TweenMax. Any ideas? If the answer is "dont use updateAfterEvent" thats fine; I'd just like to have the smoothest mouse movement if possible. My code is below if it helps. Thanks! var dragDelta:Point; //Not an actual point, but the difference between the old mouse x/y position and the new var dragPosOld:Point; //Storage point for old mouse values while dragging public function officeHandler(evt:MouseEvent = null):void { switch(evt.type){ case MouseEvent.MOUSE_DOWN: TweenMax.killTweensOf( office.bg ); TweenMax.killTweensOf( office.btn ); dragPosOld.x = this.mouseX; dragPosOld.y = this.mouseY; addEventListener(MouseEvent.MOUSE_MOVE, officeDragHandler); break; case MouseEvent.MOUSE_UP: removeEventListener(MouseEvent.MOUSE_MOVE, officeDragHandler); var velX:Number = dragDelta.x * 50; var velY:Number = dragDelta.y * 50; var boundX:Number = (office.bg.scaleX-1)*1024; var boundY:Number = (office.bg.scaleY-1)*768; TweenMax.allTo([office.bg, office.btn], 1, {throwProps:{x:{velocity:velX, min:boundX*-1, max:0}, y:{velocity:velY, min: boundY*-1, max: 0}, resistance:200}, ease:Strong.easeOut}); break; } } public function officeDragHandler(evt:MouseEvent):void { evt.updateAfterEvent(); dragDelta.x = this.mouseX - dragPosOld.x; dragDelta.y = this.mouseY - dragPosOld.y; dragPosOld.x = this.mouseX; dragPosOld.y = this.mouseY; office.btn.x += dragDelta.x; office.bg.x += dragDelta.x; office.btn.y += dragDelta.y; office.bg.y += dragDelta.y; } }
  8. Ah ok. Turns out I was doing it correctly, except the value I was putting into the vars object was undefined, so it only looked like it wasn't working. Thanks!
  9. So basically I have a SWFLoader loading a swf. When the swf is done, I want to receive a LoaderEvent to my onComplete function that contains a string that I've defined in its data. Is this possible? Or is it possible to store a string somewhere inside the SWFLoader itself? I tried making a custom property in the vars object when instancing the SWFLoader, but it seems that custom properties understandably get ignored and always show as undefined. I could extend the functionality myself, but I was just wondering if im overlooking something that already exists. Thanks!
  10. Perfect, works beautifully now! Thanks for the quick response!
  11. I'm having a problem with CirclePath2D; specifically in removing and adding PathFollowers. What I've found is that, if I try to remove a PathFollower, add it back, then remove it again, it seems to remove all PathFollowers rather than just the one I've passed to the removeFollower function. Really the only other way I'm interacting with these PathFollowers is by adjusting the scale of the CirclePath2D that they are parented to. Anyone know what might be the problem here? I've attached a simple demo showing whats going on. I expect that its just something obvious that I've overlooked, but maybe its not. Thanks!
×