xxxxxxxxxx
let size = 0
let hanabira = 5
let kakudo = 360 / hanabira
function setup() {
background(255, 100);
noStroke()
createCanvas(windowWidth, windowHeight)
size = width / 10
points = 20
colorScheme = [
"590d22",
"800f2f",
"a4133c",
"c9184a",
"ff4d6d",
"ff758f",
"ff8fa3",
"ffb3c1",
"ffccd5",
]
palette = colorScheme.map((a) => "#" + a)
}
function draw() {
//background(255, 100)
translate(mouseX, mouseY)
if (mouseIsPressed) {
for (let i = 0; i < points; i++) {
let lineAngle = random(0, 360)
let colorIndex = int(random(0, 8))
rotate(lineAngle)
noStroke()
fill(palette[colorIndex])
heart(0, frameCount)
}
}
if (!mouseIsPressed) {
frameCount = 50
let colorIndex = int(random(0, 8))
fill(palette[colorIndex])
rotate(0)
angleMode(DEGREES)
heart(0, 0)
heart(200, 0)
heart(400, 0)
}
}
function heart(x, y) {
beginShape()
vertex(x, y)
bezierVertex(x - size / 3, y - size / 3, x - size, y + size / 3, x, y + size)
bezierVertex(x + size, y + size / 3, x + size / 3, y - size / 3, x, y)
endShape(CLOSE)
}