xxxxxxxxxx
56
let b;
function setup() {
createCanvas(800, 400);
b = new Brush();
}
function draw() {
background(220);
strokeWeight(1);
for (let i=0;i<width;i++) {
colorMode(HSB,100,100,100);
stroke(i*100/width,100,100);
line(i,height,i,height-20);
}
//b.move(mouseX, mouseY);
b.move(width/2, height/2);
b.display();
}
class Brush {
constructor() {
this.x = 0;
this.y = 0;
this.breadth = 25;
this.a = -PI / 4;
}
move(x, y) {
this.x = x;
this.y = y;
}
display() {
colorMode(RGB);
push();
translate(this.x, this.y);
rotate(this.a);
strokeWeight(1);
noFill();
for (let i = 0; i < 10; i++) {
stroke(192 * noise(i/2));
bezier(0, 0, -25, -this.breadth * i / 10, -25, 0, -50, 0);
stroke(192 * noise(i/2 + 0.9));
bezier(0, 0, -25, this.breadth * i / 10, -25, 0, -50, 0);
}
stroke(240);
strokeWeight(10);
line(0, 0, 30, 0);
stroke(64);
strokeWeight(15);
line(30, 0, 150, 0);
pop();
}
}