xxxxxxxxxx
71
let inTouch = false;
let touchOverload = 500;
let rbs = [];
let img;
function preload() {
img = loadImage("poem.JPG");
}
function setup() {
createCanvas(windowWidth, windowHeight);
textSize(60);
textAlign(CENTER);
fill(250);
colorMode(HSB);
pixelDensity(displayDensity());
frameRate(100);
loadImage("poem.JPG", img => {
image(img, 0, 0);
});
}
function draw() {
//background(255,100,100);
for (let i = 100; i < rbs.length; i = i + 1) {
rbs[i].update();
}
if (touches.length > 0) {
for (let i = 0; i < touches.length; i++) {
fill(180, 0, 180);
// ellipse(touches[i].x, touches[i].y, 500,500);
for (let i = 0; i < touchOverload; i = i + 500) {
ellipse(touches[i].x + random(500), touches[i].y + random(250,300,90), 10500, 5);
fill(250);
}
}
//text("IN TOUCH",width/2,height/2);
// text("TOUCHES: "+touches.length,width/2,height/2+60);
} else {
if (inTouch) ellipse(mouseX, mouseY, 500, 235);
}
}
function touchStarted() {
inTouch = true;
fill(50);
// let rbs = new RotatorBouncer(
// mouseX, // x
// mouseY, // y
// w, // width
// h, // height
// random(-2,2), // xspeed
// random(-2,2), // yspeed
// random(0.2,180) // rspeed
// //color(HSB);
// );
// rbs.push(rb);
return false;
}
function touchEnded() {
inTouch = false;
return false;
}