Project 03 dynamic drawing

I wanted to play with the translate and rotation tools so I made this fun little spinning ellipse.

sketchDownload
//felix cooper fcooper d

var r=constrain(mouseX,-180,180);
var height=constrain(50,-255,255);

function setup() {
    createCanvas(600, 450);
}

function draw() {
    background(0);
    noStroke();
    translate(300,225);
    rotate(radians(r)); //spins circle according to mousex
    ellipse(80,0,50, height);
    r=mouseX;

    if(mouseY<225){ //changes ellipse length based on mousey
        height=height+5;
    }
    else{
        height=height-5;
    }
    fill(height); //changes gradient based on how small it is - will dissapear
}

Leave a Reply