FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Bugs
   Software Bugs
(Moderator: fry)
   fading made simple with copy()?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: fading made simple with copy()?  (Read 413 times)
sanguinarium

WWW
fading made simple with copy()?
« on: Aug 2nd, 2004, 1:02pm »

here's another strange one: if you run the code below, which is an extended version of 'continous line', you will notice the content of the applet fading away with the oldest parts first. it looks as if either copy() or then image() do not copy/paste the information to 100% but instead loose information on the run.
 
if you have a black background, it's a nice fading feature, but then again, if you haven't...   :|
 
this has been seen on 68pc/69pc/68mac/69mac
 
regards to megabucket.
 
-----------------------------------
BImage fd;
 
void setup(){
  size(300, 300);
  background(100,0,0);
}
 
void loop(){
 
  fd=copy();
  background(100,0,0);
  image(fd,0,0,width,height);
 
  if(mousePressed && pmouseX != 0 && pmouseY != 0) {
    stroke(255,0,0);
    line(mouseX, mouseY, pmouseX, pmouseY);
  }
}
 
mattgilbert

tangramkid WWW Email
Re: fading made simple with copy()?
« Reply #1 on: Nov 20th, 2004, 3:55am »

i've also noticed this with the following code, using BImage instead of BGraphics. it seems to be caused by image(). One detail is that it only does the fading on the parts of the image that are black, not those set to red.
 
here's the Code:

BImage overlay;
 
void setup(){
  size(200, 200);
  overlay = new BImage(200, 200);
  for(int i = 0; i < overlay.pixels.length / 2; i++){
    overlay.pixels[i] = color(255, 0, 0);
  }
}
 
void loop(){
  image(overlay, 0, 0);
}
 
void mouseDragged(){
  stroke(255);
  line(pmouseX, pmouseY, mouseX, mouseY);
}

 
matt
 
cello

marcello3d WWW
Re: fading made simple with copy()?
« Reply #2 on: Nov 20th, 2004, 4:05am »

You could also draw a rect with alpha, like I did in [url http://www.cs.unm.edu/~cello/processing/fade/]this[/url].
 
Marcello
 
Pages: 1 

« Previous topic | Next topic »