Jump to content
Search Community

Suggestion: Steps or Frame Rate simulation

Rabies test
Moderator Tag

Recommended Posts

I don't know if this already exists, I don't think it does... Sometimes when animating, you want a sort of stepped / low frame rate kind of look, without resorting to making the entire Flash movie low frame rate. So how about an option that can simulate this?

Link to comment
Share on other sites

There are a few ways you could do it, but here's one idea:

 

Tween properties of a generic object as though it's a proxy and then use an onUpdate that has conditional logic that only applies the values after a certain number of frames have elapsed. Kinda like:

 

var proxy:Object = {x:mc.x, y:mc.y};
TweenLite.to(proxy, 5, {x:400, y:300, onComplete:applyValues});
var timer:Timer = new Timer(300, 0);
timer.addEventListener(TimerEvent.TIMER, applyValues);
timer.start();
function applyValues(event:TimerEvent=null): void {
   mc.x = proxy.x;
   mc.y = proxy.y;
   //if no event was passed in, it means it's the onComplete calling and we should kill the timer. 
   if (event == null) {
       timer.stop();
       timer.removeEventListener(TimerEvent.TIMER, applyValues);
   }
}

 

Instead of using a Timer, you could use an elapsedFrames variable that gets incremented each time the function is called using an onUpdate and then use conditional logic to only apply the values after a certain threshhold is met for the elapsedFrames (and reset it back to zero).

Link to comment
Share on other sites

Thank you for the suggested code. I'll try that out.

 

I am however also suggesting that TweenLite 12 have this as a variable/flag. ;-)

 

TweenLite.to(mc,10,{_x:600, rate:0.5});

 

rate would mean "frame rate".

1 = 100%

0.5 = 50%

etc

 

I predict some problems supporting this in AS2 however, as the frame rate is not an available property, but is in AS3. (Could approximate current frame rate via polling, but I don't know how accurate that would be).

 

The other alternative would be defining the # of steps to be used in the tween. This method would achieve the same visual effect but obviously would not always look quite the same on different PCs running the Flash at different frame rates. Might be acceptable though.

Link to comment
Share on other sites

I'll keep this suggestion in mind, but I highly doubt I'll add it to v12 because:

 

1) It is an EXTREMELY unpopular feature. You're only the 2nd person who requested this...ever (and around 10,000 visitors per day hit the site). Folks usually want to improve the smoothness of their tweens, not the opposite :)

 

2) It would slow the entire engine down because of the conditional logic that would need to be injected. Everyone would end up paying a price for something that less than 0.1% of the user base may want.

 

3) It would bloat the engine - I try VERY hard to prevent the dreaded "feature bloat" that infects most engines.

 

Again, I'm not saying it's a bad idea or anything - I can see how for certain effects it could be cool. I'm just trying to explain why I probably won't add it. Keep the suggestions coming though.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...