xxxxxxxxxx
45
var xPos = [];
var yPos = [];
var blues = [];
var speeds = [];
var l = 0.5;
var m = 7.5;
function setup() {
createCanvas(400, 400);
var count = 0;
while (count < 750){
append(xPos,random(400));
append(yPos,random(400));
append(speeds,random(l,m));
frameRate(10);
count++;
}
noStroke();
}
function draw() {
background(0,0,0);
fill(0,0,255);
var i = 0;
while(i < xPos.length){
fill(0,244,0);
//ellipse(xPos[i],yPos[i],5,5);
text(char(random(913,1024)),xPos[i],yPos[i]);
yPos[i] = yPos[i] + speeds[i];
if (key === 'w'){
yPos[i] = yPos[i] - speeds[i]*2;
}
if (key === 's'){
yPos[i] = yPos[i] + speeds[i]/2;
}
if(yPos[i] > 400){
yPos[i] = 0;
}
if(yPos[i] < 0){
yPos[i] = 400;
}
i++;
}
}