View unanswered posts | View active topics



Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Eaze: a smarter tween engine 
Author Message
Member

Joined: Thu May 15, 2008 7:36 pm
Posts: 636
Location: Baltimore, MD
Is there an asdoc location for eaze?
(Somewhere I can suck it up into "Doc?" for reference.)

_________________
http://tronster.com


Fri Oct 14, 2011 9:08 pm
Profile WWW
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 11724
Location: Paris, France
No, sorry :)

But it should be easy to do - I'm already generating the doc in the SWC's ant build to inject the doc in it.


Fri Oct 14, 2011 9:57 pm
Profile WWW
Member

Joined: Tue Dec 29, 2009 2:58 pm
Posts: 6
Found a bug.
If you pause all tweens, then start a tween, and then resume all tweens, tweened property will change as if it was not paused and go beyond the target value.
Code:
package
{
   import aze.motion.*;
   import flash.display.Sprite;
   import flash.events.Event;
   import flash.events.KeyboardEvent;
   import flash.utils.getTimer;
   
   public class Main extends Sprite
   {
      public var a:Number = 0;
      public var n:int = 0;
      
      public function Main():void
      {
         if (stage) init();
         else addEventListener(Event.ADDED_TO_STAGE, init);
      }
      
      private function init(e:Event = null):void
      {
         removeEventListener(Event.ADDED_TO_STAGE, init);
         startEaze();
         
         stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
      }
      
      private function onKeyDown(e:KeyboardEvent):void
      {
         switch(n)
         {
         case 0:
            EazeTween.pauseAllTweens();
            trace(getTimer(), "pause");
            break;
         case 1:
            startEaze();
            trace(getTimer(), "start");
            break;
         case 2:
            trace(getTimer(), "resume");
            EazeTween.resumeAllTweens();
            break;
         }
         ++n;
      }
      
      private function startEaze():void
      {
         eaze(this).to(5, { a: (a > 0 ? -100 : 100) } ).onUpdate(onEazeUpdate).onComplete(startEaze);
      }
      
      private function onEazeUpdate():void
      {
         trace(a);
      }
   }
   
}

Sample output:
Code:
72.584304
73.291776
3037 pause
5956 start
9925 resume
332.0581608860159
328.3448369832039
324.64753910383615
321.18236902425605


Mon Jun 25, 2012 6:20 am
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 11724
Location: Paris, France
Ha good one :)

Added an issue:
http://code.google.com/p/eaze-tween/issues/detail?id=26


Mon Jun 25, 2012 8:34 am
Profile WWW
Member

Joined: Tue Dec 29, 2009 2:58 pm
Posts: 6
Is it possible to pause individual tweens? Or groups of tweens? For example in my game I have to pause the game during scroll and thus have to pause all tweens that affect gameplay, but do not have to pause UI tweens, or even want to use tweens for scrolling. Also it would be nice to have killAllTweens for a group of tweens. So that I don't have to track this myself and kill tweens individually.


Mon Jun 25, 2012 2:30 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 11724
Location: Paris, France
No, tweens aren't designed to be paused or grouped.
I understand the rationale but currently this would require a big refactoring.


Mon Jun 25, 2012 8:19 pm
Profile WWW
Member

Joined: Tue Dec 29, 2009 2:58 pm
Posts: 6
Looks like I've found a bug
Code:
eaze(this).delay(0.1).onComplete(trace, 100).delay(0.1).onComplete(trace, 200); // outputs 100, then 200
eaze(this).delay(0).onComplete(trace, 100); // outputs 100
eaze(this).delay(0).onComplete(trace, 100).delay(0.1).onComplete(trace, 200); // outputs only 200


And a question/feature request:
Is it possible to set non-number variables: Strings, BitmapData's, etc. Something like
Code:
.onComplete(function():void {bmp.bitmapData = fooBmd;});

Last time I needed it was: ease alpha of the label to 0, change label text, ease alpha to 1.


Mon Jul 09, 2012 5:24 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 22 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.