Alpha animation start with delay

Hey there,

Here´s a alpha animation I work on as a beginner, starting immediately to fade out the shape containing a character array. That is okay.

var f = 255;  //alpha variable
var speed = 0.1; // decreasing alpha multiplier

let shape1 = [

function setup() {


function draw() {
  let w = width /5;
  let h = height / 6;

  for (let j = 0; j < 6; j++) {
  for (let i = 0; i < 5; i++){
    let x = w * i ;
      let y = h * j ;
      let spot = shape1[j][i];
    // Before fade animation starts: How to keep the shape visible for 10 secs?
    f -= speed;
    fill(255,0,0, f);
    text(spot, x + w,y);

How to let it be visible for 10 seconds before the animation starts?

A cool future update may also be: How to make it visible again after 10 seconds of invisibility, too?


1 Like

Have you played around with deltaTime yet? It’s intended for creating time sensitive animations.

A possible solution for your desired 10 second swap could be by tracking how much seconds have passed since the sketch has started. Whenever ten seconds have passed, you could initiate an event which causes the transparency to switch.


Great, will go for it, is it a function?

also found this page in between:

Another idea is to sync the alpha animation with multiple adjacent shown character-array shapes to a music piece of 120 bpm.

It seems to gravitate to a direction having to build a bar/beat counter…;-))
With that thing then changing animation values on particular bars/beats. Anybody did that yet?


Good, glad to hear you have some directions to explore.

You mean stuff like Sound Visualization?


its a chance, sure. Dan is great of course! He presents some sound measuring concepts in his tuts…

It´s more about letting the animation wait for some secs here at the moment.
counting frames might be the way, but not sure. Help is welcome.


I track the time in seconds with:

seconds += 1/frameRate;

then, if seconds == 10 you can start your animation, or pause it, or what you want :stuck_out_tongue:, you can also restart the count to start a new one seconds = 0;


Oooh, this is great. Thank you very much!! (Cool picture)

the type of seconds is NaN. Looks like to be converted to a number somehow…
best regards