( back )
Adding noise to a motion
Adding noise to a motion can be accomplished by nesting
the predefined NOISE step method
inside the motion. Below, an ellipse motion was made noisy using
this approach.
Animation path;
Animation noise;
BFont font;
void setup()
{
size(400,100);
font = loadFont("RotisSanSer.vlw.gz");
textFont(font, 20);
noise = new Animation(this, loadImage("image.gif"), 0,0, 20,20);
noise.setStep("NOISE");
path = new Animation(this, noise, 100,25, 200, 40);
path.setDuration(10000);
path.setStep("ELLIPSE");
}
void loop()
{
background(127);
path.draw();
fill(0);
text("Click to show animation-rectangles.", 25, 15);
noFill();
}
void mouseClicked()
{
if (path.rectangleVisible())
{
path.hideRectangle();
noise.hideRectangle();
}
else
{
path.showRectangle();
noise.showRectangle();
}
}
|