Aki Sakata
akisoqls.com

Aki Sakata|akisoqls.com
>> 2018
>>>> 180626

180626

2018

p5.js

var csw1, csh1;
csw1 = window.innerWidth / 1.15;
csh1 = window.innerHeight / 1.5;

console.log(csw1, csh1);
var csw = csw1;
var csh = csh1;

var pixw = 20;
var pixh = 5;
// default
// pixw = 20 pixh = 5

var speed = 100;
// default
// 100

var xm = 0;
var ym = 0;

var pixx = csw / pixw;
var pixy = csh / pixh;
console.log(pixx, pixy);

var newVal = 0;
var val = 0;
var push = 0;


function setup() {
createCanvas(csw, csh);

}



function draw() {
var mousex1 = mouseX - pixh * pixw / 4;
var mousey1 = mouseY - pixh * pixw / 4;
fill(0, 0, 255);
val = mouseIsPressed;


if ((newVal == true) && (val == false)) {
push = 1 - push;
}
 val = newVal;
if (push == 1) {
rect(0, 0, pixh * pixw / 2, pixw * pixh / 2);
} else {
rect(0, mousey1, csw,20);
}


for (var i = 0; i < speed; i = i + 1) {
var grdt = random(10, 0);
var grdt2 = random(255, 0);
var strt = random(grdt, grdt + 120);
var strt2 = random(grdt2, grdt2 + 120);
var hue = random(110, 200);
var hue2 = random(0, 255);
var x = Math.floor(Math.random() * pixx*2);
var y = Math.floor(Math.random() * pixy);
noStroke();
colorMode(HSB, 255);
fill(hue, strt, 255);
rect(pixw * x, pixh * y, pixw, pixh);

fill(hue2, strt2, 255)
rect(pixw / 2 * x, pixh * y, pixw / 2, pixh / 2);
rect(pixw / 2 * x , pixh * y, pixw / 2, pixh / 2);

}
}

再生

(C) 2017 Aki Sakata