Categories
General

A cacheAsBitmap vs superCacheAsBitmap demo

Here’s another demo of the work we’ve been doing on a custom cacheAsBitmap utility, we’re calling superCacheAsBitmap.

The circle in the middle of the demo is made up of 1000 transparent lines, so you shouldn’t be surprised that it’s very slow to render using traditional methods! Click Move Clip to get things started, and you’ll see what I mean.

Select the cacheAsBitmap option and it’s speeds up! Yay! But now hit the Rotate Clip button, and we’re back down to a grind. This is because the MovieClip’s appearance changes and the Flash Player has to re-render the clip every frame.

So now select the superCacheAsBitmap, and we’re back up to speed! We’re creating a bitmap and rotating that instead. You’ll see though that the quality isn’t very good, but often when we’re moving things at speed this isn’t a problem. But if it is, just select superCacheAsBitmap with smoothing and this time the player rotates the bitmap with interpolation. It’s slower but not as slow as without caching.

[swf file no longer available]

Code coming as soon as I package it up!

18 replies on “A cacheAsBitmap vs superCacheAsBitmap demo”

That is just sweet… did some particle stuff myself, but when it had been running for 30 seconds, the randomscript I did was just killed by system/flashplayer overload :/ – Looking forward to checking the super class out. Nice work!

Seb,

When will the code for this be available? Can you send me a “dirty” version offline? I’m in the middle of a project that would really benefit from this code but it’s due today! I NEED this class! If you can hook it up I will be your slave.

Thanks,
Brian

I am really curious about this ‘trick’. Do you have any idea when you’ll release it to the public?

Keep up the good work.

Hi Laurent,

I had to fix a bit of a bug with it, but it seems ok now. I just need to get over the Flash on the Beach craziness and I’ll upload it then. Watch this space and give me a gentle nudge if it slips my mind 🙂

cheers

Seb

Hey Seb, saw your session at fotb, elegant ideas and they just work, great session – loved the enthusiasm too :). I came to get the source files for the 3d and found this stuff, fantastic work, I can’t wait to beg/steal/borrow (delete as appropriate) this stuff – it looks awesome.

hey jboy,

So sorry for not doing this – it’s all been v v v crazy here at Plug-in! It may be that I just post up the core bits of code rather than make a new clever class out of it. But I haven’t forgotten! Email me if you want to discuss… seb at pluginmedia dot net.

cheers

Seb

Hi, any new on this “superCacheAsBitmap” thing? I’m trying to animate large swf’s and jpg’s… i’d love to find a way to speed this up a bit.

Is this a dead project or is it still under construction?

Got any tips on how to matrix-transform large bitmaps a little faster? cacheAsBitmap doesn’t really make that much of a difference (in my case anyway…)

I’m so sorry that this hasn’t quite made it out there yet. I tried setting up a project on OSFlash but it didn’t quite happen… I will revisit this at some point – it’s clearly an area that is important to people, but I’m snowed right now and don’t know when that’ll be.

I should also say that superCacheAsBitmap won’t really speed up things that are already bitmaps and will only speed up moving, scaling and rotating clips that don’t contain any animation. So I’m not sure it’d help in your case anyway.

cheers

Seb

thats a good idea , so you take a snapshot and replace the original vector but how do you go back to that original vector ?

well the as2 version handled swapping back automatically, but it was quite hacky. The AS3 version (coming soon :S) will return a bitmap object that you can manually switch with the MovieClip/Sprite.

This is very nice. I always google whatever generic library I’m about to code, so I happened upon your post when looking for custom versions of cacheAsBitmap. Can you not release rough code for one of us to polish? I’d be happy to do it and let you take all the credit – it’s just that if you don’t, I (and others probably) will have to code our own versions from scratch. Literally, I’ll be coding it tonight if you’re not yet willing to release yours; since you’re so busy with PaperVision, why not offload this?

Yeah sure, why not. I’ve got an AS3 version but I’m not 100% happy with it. Mail me at the address on the about page and we’ll talk about it.

cheers!

Seb

Do you think it is possible for me to have a copy of the AS3 version too? Very nice work!

Thanks,
Chad

Hi Seb – superb work! May I get a copy of the AS3 version, please? That is, if it’s done. Thanks and have a great day!

Comments are closed.