マッハ・スパイダー
var pointX = [];
var pointY = [];
var speedX = [];
var speedY = [];
function setup() {
createCanvas(windowWidth,
windowHeight);
for (var i = 0; i < 3; i = i + 1) {
pointX[i] = random(0, windowWidth);
pointY[i] = random(0, windowHeight);
speedX[i] = random(-5, 100);
speedY[i] = random(-5, 100);
}
}
function draw() {
background(234, 234, 234, 20);
for (var i = 0; i < 3; i = i + 1) {
pointX[i] = pointX[i] + speedX[i];
pointY[i] = pointY[i] + speedY[i];
if (pointX[i] > windowWidth || pointX[i] < 0) {
speedX[i] = -speedX[i];
}
if (pointY[i] > windowHeight || pointY[i] < 0) {
speedY[i] = -speedY[i];
}
}
drawTriangle();
}
function drawTriangle() {
stroke(110, 250, 240);
textSize(150);
text("🕷",pointX[2],pointY[1]);
}