xxxxxxxxxx
let Anger = 0.8; //怒り
let Fear = 0; //恐れ
let Joy = 0; //楽しい
let Sadness = 0; //悲しい
let Analytical = 0.6; //分析的
let Confident = 0; //自信
let Tentative = 0; //ためらい
function setup() {
createCanvas(600, 800);
colorMode(HSB);
// rectMode(CENTER);
angleMode(DEGREES);
noLoop();
// frameRate(1);
}
function draw() {
if (Joy > 0){
background(100);
stroke(random(300, 360), 100, 100);
} else if(Anger > 0.5) {
background(random(50,100));
stroke(random(1,50), 100, 100);
} else if(Fear > 0.5 || Sadness > 0.5) {
background(random(0,50));
stroke(random(200, 270), 100, 100);
} else if(Analytical > 0 || Confident > 0 || Tentative > 0) {
background(random(30));
stroke(0, 0, random(50, 100));
}
push();
for(i=0;i<10;i++){
rectMode(CENTER);
rotate(PI/4);
let sx = random(50, 300);
let sy = random(600);
let ex = sx + random(400);
let ey = sy + random(-200, 300);
strokeWeight(random(8));
line(sx, sy, ex, sy);
drawingContext.shadowBlur = 30;
drawingContext.shadowColor = color(255, 0, 255);
}
pop();
if(Anger > 0.5566){
for(let i=0; i<10; i++){
const drawPolygon = new Polygon(100 *i, random(700), random(100), random(1,50), 3);
drawPolygon.run();
}
} else if(Anger <= 0.5566 && Anger > 0.4455){
for(let i=0; i<10; i++){
const drawPolygon = new Polygon(100 *i, random(700), random(100), random(1,50), 5);
drawPolygon.run();
}
} else if(Anger <= 0.4455 && Anger > 0){
for(let i=0; i<10; i++){
const drawPolygon = new Polygon(100 *i, random(700), random(100), random(1,50), 6);
drawPolygon.run();
}
}
if(Fear = 0){}
if(Joy = 0){}
if(Sadness = 0){}
push();
if(Analytical>=0.5){
for(i=0; i<6; i++){
for(let j=0; j<10; j++){
rs = new Rect(100*i, 150*j);
rs.run();
drawingContext.clip();
}
}
} else if(Analytical<0.5) {
rs1 = new Rect(100, 150);
rs2 = new Rect(500, 670);
rs1.run();
rs2.run();
// drawingContext.clip();
}
pop();
if(Confident = 0){}
if(Tentative = 0){}
}
class Rect {
constructor(x, y){
this.x = x;
this.y = y;
this.SideX = 100;
this.SideY = random(100);
this.radius = random(50);
}
run() {
this.display();
}
display() {
noStroke();
// fill(200, 50, 100);
rect(this.x, this.y, this.SideX, this.SideY);
}
}
class Polygon {
constructor(x, y, line, h, corner) {
this.x = x;
this.y = y;
this.corner = corner;
this.line = line;
this.h = h;
}
run() {
this.display();
}
display() {
noStroke();
fill(this.h, 100, 100);
push();
translate(this.x, this.y);
rotate(35 * random(6));
beginShape();
for (let i = 0; i < this.corner; i++) {
vertex( this.line * sin(360 * i / this.corner), - this.line * cos(360 * i / this.corner));
}
endShape();
pop();
}
}