|
Author |
Topic: motion blur effect (Read 1531 times) |
|
James Smith Guest
|
motion blur effect
« on: Feb 4th, 2004, 4:23am » |
|
hi i'm trying to make a motion blur effect by instead of using background to clear the screen, I'm trying to use a transparent box, so the old stuff will kind of fade out heres how i think it should work, but something here is wrong, does anyone know what scale the transparency in the tint funtion is? (ie 0-1 or 0-255 or something) int y=1; void setup(){ size(200,200); framerate(10); } void loop(){ tint(255, 0.1); rect(-1,-1,201,201);//fade out the background line(y, 20, 85, 75); y=y+1; } like yeah, it just completely wipes the screen and you can only see the line move, no trail. I am coming to processing from flash if that is any help thanks, James
|
|
|
|
michael05
|
Re: motion blur effect
« Reply #1 on: Feb 4th, 2004, 11:41am » |
|
tint only works with images. to draw a transparent rect you have to use fill(r, g, b, alpha); the values are 0-255. this should work: int y=1; void setup(){ size(200,200); framerate(10); } void loop(){ background(255); for (int i=0; i<20; i++) // draw 20 lines { stroke(0, i*10); // returns an alpha 0-200 -> 255 max line(i+y, 20, 85, 75); } y++; }
|
°°°°°°°°°°°°°°°°°°°° http://www.m05.de
|
|
|
bryan Guest
|
Re: motion blur effect
« Reply #2 on: Feb 14th, 2004, 1:02am » |
|
this is more towards what you wanted to do which was modify the alpha of a rectangle. int y=1; void setup(){ size(200,200); framerate(10); } void loop(){ fill(255, 10); //view the fill function in reference rect(-1,-1,201,201);//fade out the background line(y, 20, 85, 75); y=y+1; }
|
|
|
|
lunetta
|
Re: motion blur effect
« Reply #3 on: Oct 26th, 2004, 8:16am » |
|
int y=1; void setup(){ size(200,200); framerate(10); } void loop(){ fill(255, 10); //view the fill function in reference rect(-1,-1,201,201);//fade out the background line(y, 20, 85, 75); y=y+1; } Is it just me or this code does not work (P5 v69)? I get a gray background and no fading. Is there any workaround for a motionblur effect that does not involve changing the pixels[] directly? Thanks!
|
|
|
|
lunetta
|
Re: motion blur effect
« Reply #4 on: Oct 26th, 2004, 8:49am » |
|
By the way, please Mr. moderator, move this topic to programs, the right section...(and delete this message afterward) thanks!
|
|
|
|
JohnG
|
Re: motion blur effect
« Reply #5 on: Oct 28th, 2004, 11:09am » |
|
I had a play with some different "fade" effects a while ago, but I was directly accessing the screen pixels to fade them out, since it seemd to run a fair bit quicker than trying to draw sami-transparent things to get the effect. One downside however is that I could only fade to black. Anyway, you can see the results and code here: http://www.hardcorepawn.com/particles/
|
|
|
|
amoeba
|
Re: motion blur effect
« Reply #7 on: Oct 28th, 2004, 2:40pm » |
|
on Oct 28th, 2004, 11:43am, TomC wrote:http://www.tom-carden.co.uk/p5/fade2anycolour/applet/index.html |
| That's a nice piece of code, runs pretty fast even at 1024x768. One can change the speed of fading by doing the following: Code: int shift=3; pixels[i] = (((red+((r-red)>>shift)) << 16) | ((green+((g-green)>>shift)) << 8) | (blue+((b-blue)>>shift))); |
| shift=2 gives fade in 4 steps, shift=3 gives fade in 8 steps, shift=4 gives fade in 16 steps etc. with shift=8 as the max value. (I know you know this, Tom, just mentioning it in case others didn't realize... )
|
marius watz // amoeba http://processing.unlekker.net/
|
|
|
TomC
|
Re: motion blur effect
« Reply #8 on: Oct 28th, 2004, 3:57pm » |
|
Thanks Marius. It's also good fun to make the shift be different for the different components. E.g. Try making it slower for the red channel to get nice red trails. Trippy!
|
|
|
|
lunetta
|
Re: motion blur effect
« Reply #9 on: Oct 30th, 2004, 5:58pm » |
|
hey, thanks for all feedback I mentioned "not using pixels[]" because I thought the performance would be slower - it seems that it's not. pixel shifting is a programming topic that my brain still refuses to clearly comprehend...
|
|
|
|
|