Skip to content

Instantly share code, notes, and snippets.

@kotobuki
Last active October 7, 2018 03:38
Show Gist options
  • Save kotobuki/f0457ff34c029fb9481b281823a937d7 to your computer and use it in GitHub Desktop.
Save kotobuki/f0457ff34c029fb9481b281823a937d7 to your computer and use it in GitHub Desktop.
First p5.js Sketch
// Called once when the program starts
function setup() {
// Creates a canvas that is 640 pixels wide and 480 pixels high
createCanvas(640, 480);
}
// Continuously executes the lines of code contained inside its block
function draw() {
// Draw an ellipse, with the center of the current position of the mouse,
// with a width and height of 50 pixels
ellipse(mouseX, mouseY, 50, 50);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/addons/p5.dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/addons/p5.sound.min.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment