Note

Plankton

I started from the original tutorial of the Nature Of Code. Then I tried to make the walker seem like it disappeared and came back from time to time by setting the alpha to random.

Screen Recording 2024-02-05 at 10.42.44 PM.mov

Screen Recording 2024-02-05 at 10.39.58 PM.mov

I speeded up the basic random walker’s steps and played with its color.

I finally decided to make the tone to be bluish and greenish, varying with different alpha levels, like luminous plankton in the dark.

Screen Recording 2024-02-05 at 7.59.25 PM.mov

Screen Recording 2024-02-05 at 7.24.33 PM.mov

https://editor.p5js.org/jc11932/sketches/_jCVZQIEd

Code:

let x;
let y;

let r;
let g;
let b;
let a;

 function setup() {
  createCanvas(400, 400);
  x=width/2;
  y=height/2;
  background(20);
  
  r = random (255);
  g = random (255);
  b = random (255);
  a = random (255);
}

function draw() {
  
  for(let i=0; i<30; i++){
  x+=random(-1,1);
  y+=random(-1,1);
  constrain(x,0,width);
  constrain(y,0,height);
    
    r+=random(-3, 3);
    g+=random(-3, 3);
    b+=random(-3, 3);
    a+=random(-10, 20);
    
    constrain(r,0,255);
    constrain(g,0,255);
    constrain(b,200,255);
    constrain(a,50,255 );
  
  stroke(r,g,b,a);
  point (x,y);
  }
}

//reference: 
// Daniel Shiffman
// Kevin Workman <https://www.youtube.com/watch?v=yBVeCXnxQYs>