Jump to content
Search Community

Frame rate an smooth tweening.

olleka test
Moderator Tag

Recommended Posts

Hi

I'm doing a banner with a long text scrolling to the left. The spec for the banner is max 18 fps. But that gives very choppy movement, totally unusable.

 

So I did som tests starting at 24 and then 31, 62 and 96 fps.

http://www.olle.se.st/friendsofadam/test.php

 

So obviously the faster the smoother. But on my macine (mac G5) i'ts still a little jerky. But that may be the flashplayer only manage around 40 fps?

 

The question I have is:

Is it possible to have a smooth scrolling with the low frame rates like 18 fps? I mean really smooth.

Or should I convince the client to go for some other transition instead?

 

Regards

Olle

Link to comment
Share on other sites

The Flash Player can handle more than 40fps, yes, but it obviously depends on the power of the user's CPU. A G5 is...well...it can't handle it nearly as well as my 3.6Ghz i7 :) The other tricky thing is that text is essentially vectors which can tend to be CPU-intensive to render, and if you've got a very large TextField that's scrolling, Flash must render a very large area on every frame (even the portions of the screen that are outside the visible area). You might want to look into using the scrollRect property to limit the area that the Flash Player must render to the size of the stage or something, but that doesn't necessarily guarantee outstanding performance either. And if you set cacheAsBitmap to true, it'll reduce the load on the CPU but it will actually scroll worse because whenever cacheAsBitmap is true, Flash will round the coordinates to whole pixel values, meaning it'll look a little jerky.

 

One other thing you could try is creating a BitmapData of your TextField and make sure smoothing is set to true on it. That would probably reduce the CPU load because it's not having to render the vectors on every frame.

 

18fps ain't gonna look silky smooth no matter how you optimize it, though. 60fps should be great, but don't go above that because you're just killing the CPU and it doesn't visually help much anyway.

Link to comment
Share on other sites

Hi

Thank you for the reply!

 

What about UdateAfterEvent?

 

If I make a simple Setinterval function like

setInterval(moveText, 1);

function moveText() {
texten._x -= 2;
updateAfterEvent();
}

 

The animation runs a little smoother. It stutters sometimes but it's better.

http://www.olle.se.st/friendsofadam/test5.php

 

It seems very cpu intensive though ... so I wonder if the banner will be accepted with SetInterval

And how would I use that with TweenMax?

 

Regards

olle

Link to comment
Share on other sites

Yes, that's EXTREMELY CPU intensive and NOT a good idea. You're literally telling it to refresh the screen 1000 times per second (or as close to that as it can). That's insane.

 

The reason sites limit your swfs to 18fps is to avoid exactly this situation. They don't want swfs gobbling up resources and killing their site's performance. If they're paying attention, they'll definitely reject your swf.

 

If they have certain requirements (like 18fps), my advice would be to comply with them. If you need to adjust your design so that it doesn't look so bad at a low frame rate, do that. I know that's not what you were hoping to hear though. I feel your pain. But that's the world of banner ads. Sorry.

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...