Skip to content

Instantly share code, notes, and snippets.

@nataliefreed
Created November 18, 2016 17:12
Show Gist options
  • Save nataliefreed/94c22ce6f8cd0f1f130b45816a2509d3 to your computer and use it in GitHub Desktop.
Save nataliefreed/94c22ce6f8cd0f1f130b45816a2509d3 to your computer and use it in GitHub Desktop.
Demo: movement with a mathematical function in P5
/* Demo: movement with a mathematical function in P5 */
var x = 0;
function setup() {
createCanvas(600, 600);
}
function draw() {
background(255);
fill(0);
ellipse(x, 50*sin(x/30)+height/2, 30, 30);
x += 2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment