Project 9

let img;

function preload() {
    img = loadImage("");

function setup() {
    createCanvas(480, 480);
    background(110, 16, 0);
    img.resize(width, height);
    //image(img, 240, 240);

function draw() {
    let x = floor(random(img.width)); //x position of pixels
    let y = floor(random(img.height)) //y position of pixels
    let shapePixel = img.get(x, y); //get pixels from photo
    let textPixel = img.get(mouseX, mouseY); //get pixel from mouse location
    //randomly generated pixels that fill up the page
    let shapeR = random(15);
    circle(x, y, shapeR);

    //draw star shapes when mouse is pressed
    if (mouseIsPressed) { 
        textSize(random(5, 40));
        text('★', mouseX, mouseY); //star shape follows mouse

//erases when double click
function doubleClicked() {
    fill(110, 16, 0);
    circle(mouseX, mouseY, 70);

This project is dedicated to celebrating my grandfather, who had just gotten his medal for 70 year anniversary since serving in the war. As you press your mouse across the screen stars will follow, and if you double click you can erase part of the drawing.

Leave a Reply