let drawing = [];
let city;
function preload() {
city = loadImage("city.jpg");
}
function setup() {
createCanvas(city.width, city.height);
}
function mouseDragged() {
drawing.push({
mouseX: mouseX,
mouseY: mouseY,
});
}
function draw() {
colorMode(HSB);
// clear previous frame
background(city);
if (mouseIsPressed) {
// set line color to a range from light yellow to dark red
// using HSB color mode with hue from 40 to 0 and saturation and brightness at 100
stroke(random(0, 40), 100, 100);
// godzilla heat beam
//draw line from top right corner to mouse y-5 and y+5
line(width - 1, 0, mouseX, mouseY - 5);
line(width - 1, 0, mouseX, mouseY + 5);
line(width - 1, 0, mouseX + random(-5, 5), mouseY + random(-5, 5));
// set fill color to random
fill(random(0, 40), 100, 100);
// generate a random position within a radius of 10 of the mouse position
let x = mouseX + random(-20, 20);
let y = mouseY + random(-20, 20);
// draw a circle of radius 1 at the random position
circle(x, y, 2);
}
}
I want to use the mouse to control Godzilla’s heat beam and burn down the city for painting. However, every time I try to make a paint mark, the effects of the beam line are left in the canvas.
How can I paint with airbrush effects without letting the beam line have a trace?
Yes, he allows me, and this isn’t even a homework, It’s a tag that I can only choose for a general question.
And I have no clue how your code works, and how it helps my problem.