Smooth randomizer

man kan använda funktionen:


istället för:




i detta projekt får vi testa funktionen noise() visuelt


float xoff = 0.0;
float xincrement = 0.01; 

void setup() {
  size(640, 360);

void draw() {
  // Create an alpha blended background
  fill(0, 10);
  //float n = random(0,width);  // Try this line instead of noise and you'll see the differense
  // Get a noise value based on xoff and scale it according to the window's width
  float n = noise(xoff)*width;
  // With each cycle, increment xoff
  xoff += xincrement;
  // Draw the ellipse at the value produced by perlin noise
  ellipse(n,height/2, 64, 64);



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s