Eval() not working

var x;

var y;
var z;

var alpha;

function setup() {
  createCanvas(600,600);
  
  x = "if(millis() % 1000 = 0){ eval(alpha);}";
  
  y = "hello world";
  z = "text(y, width/2, height/2);";
  
  alpha = "background(random(0,255),random(0,255),random(0,255));";
  
}


function draw() {
  eval(z);
  eval(x);
}

this is the code I have so far, the problem is that the background is not changing.

x = "if (millis() % 1000 == 0) eval(alpha);";

Alternative:
x = "millis() % 1000 || eval(alpha)";

1 Like