AS3 bitmap blur/feedback effect
- Started
- Last post
- 11 Responses
- modern
Anyone seen anything like this:
http://labs.bigspaceship.com/sou…
For AS3?
Mostly interested in slowly blurring the background like the default effect shown on that link.Cheers!
- maximillion_0
all you need
- modern0
tweenfilterlite doesn't look the same.
This is the equivalent written in processingvoid setup() {
// ignore this bit
size(200, 200);
background(102);
stroke(255);
strokeWeight(3);
}void draw() {
// this bit!
filter(BLUR, 1);
// draw some shit
if(mousePressed) {
line(mouseX, mouseY, pmouseX, pmouseY);
}
}So instead of clearing the frame and redrawing, you blur the frame then place the next frame on top, so there is a blurred feedback left behind.
- maximillion_0
you wanted AS3 not processing?
- modern0
Yeah AS3, I'm just saying thats how its done in Processing.
Tweenfilterlite looks like a system for tweening the flash filters, the Visualizer and the Processing code are doing something different.
- kult0
Max, my guess is there's 2 layers going on here. The first layer is a large bitmap object, and the second layer is the most recent "frame" of the beachball.
Every frame, redraw the entire scene to the bitmap object and apply your blending/blur effects, then draw your beachball layer to a new position. I somewhat doubt they're completely retaining a long array of beachballs and applying a blur filter to each one consecutively each frame. But hey, ya never know.
- Yep thats whats going onmodern
- so they are basically taking a screen capture and placing the bitmap behing the beachball object? i would think that would cause it to slow wayyyy down if it was constantly applying bitmap images to the background.lvl_13
- .. to slow wayyyy down if it was constantly applying bitmap images to the background.lvl_13
- but i guess if it was only 1 bitmap constantly updating then that would not cause slowdown. meh, this is too advanced for me.lvl_13
- Yeah, just one bitmap dude, not a bitmap for each object :)kult
- gotcha' :)lvl_13
- maximillion_0
with tween filter lite you can use the blurFilter to achieve the same effect on a single object:
TweenFilterLite.to(yourObj, 1, {blurFilter:{blurX:5, blurY:5, quality:2}});
this blurs yourObj over 1 second from its current state to having 5px blur along x and y
- maximillion_0
you might be right kult, i wouldnt suggest using frames in As3 but you can. TweenFilterLite is very efficient and you can tween thousands of objects at any one time often without a great overhead.
Once you have set the blur to the object you dont need to go back to it as kult suggests - you can use an easing equation to achieve this over time.
- modern0
I'm sure TweenFilterLite could recreate the effect with the beachball, but I'm doing quite a lot of tweening inside the movieclip already so this is a much more processor efficient way to achieve the effect.
The AS2 version of Visualizer works fine, I just need to find something to do it in AS3 so the developers don't kick off about AS2 and refuse to touch it.
- mikotondria30
Mr Brimelow is your man:
http://www.gotoandlearn.com/play…
- kult0
You can use the easing equation to individually affect each object and "forget about it" so they take care of themselves, and then use onComplete to kill off the object once it's blurred out.. however.. there is always debate about this sort of performance vs. manipulating bitmap data. Both have their ups and downs.
- exactly - a comparison test would get the best answermaximillion_
- maximillion_0
I saw some nice computeSpectrum examples using the bitmap class as you described kult - very impressive