Was able to add the blinking functionality to my self-portrait that i was hinting to in my last blog !

Screen Recording 2025-09-17 at 6.32.05 PM.mov

The key piece of code I added is below:

  if (Wink <= 1 || Wink >= 20 )  {
    speed = speed * -1; // switches direction
  }
  
  Wink = Wink + speed;

Running the code was very cool because i learned about pmousex & easing so i could implement in my circle code from earlier

questions

Why does this leave a trail of black fill?

image.png

var x = 215;

function setup() {
  createCanvas(480, 120);
}

function draw() {
  if (keyIsPressed) {
    if (keyCode == LEFT_ARROW) {            // If it's the left arrow
      x--;
    } 
    else if (keyCode == RIGHT_ARROW) {      // If it's the right arrow
      x++;
    }
  }
  rect(x, 45, 50, 50);
}

This code did not do anything tho…

function setup() {
  createCanvas(120, 120);
  textSize(64);
  textAlign(CENTER);
}

function draw() {
  background(0);
  text(key, 60, 80);
}

this code had an error

function setup() {
  createCanvas(240, 120);
}

function draw() {
  background(204);
  line(20, 20, 220, 100);
  if (touchIsStarted) {
    line(220, 20, 20, 100);
  }
}

same here

function setup() {
  createCanvas(480, 120);
  fill(0, 102);
  smooth();
  noStroke();
}

function draw() {
  ellipse(touchX, touchY, 15, 15);
}