how to move a drawing in open processing

I have created the image of a dinosaur in openprocessing.org using multiple lines of code. I want to move the dinosaur around the environment as a whole, but moveMouse fn only lets me use one shape at a time. Any advice?

1 answer

  • answered 2022-05-04 10:34 Dean Van Greunen

    use the translate function in conjunction with the mouseX/Y vars

    function setup() {
        createCanvas(windowWidth, windowHeight);
        background(100);
    }
    
    function draw() {
        background(100); // Set background
        translate(mouseX, mouseY); // translate
        circle(0, 0, 20); // draw here
    }
    

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum