Skip to content

Instantly share code, notes, and snippets.

@dribnet
Last active July 12, 2016 01:21
Show Gist options
  • Save dribnet/ccd26455c5e6c1f8385655c175d4c3f0 to your computer and use it in GitHub Desktop.
Save dribnet/ccd26455c5e6c1f8385655c175d4c3f0 to your computer and use it in GitHub Desktop.
example p5.js sketch
license: mit

p5.js hello world

This is the canonical p5.js "Make Circles" sketch formatted as a p5.js block.

<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.1/p5.js"></script>
<script language="javascript" type="text/javascript" src="sketch.js"></script>
<style> body {padding: 0; margin: 0;} </style>
</head>
<body style="background-color:white">
</body>
function setup () {
createCanvas(960, 500);
}
function draw () {
if (mouseIsPressed) {
fill(0);
}
else {
fill(255);
}
ellipse(mouseX, mouseY, 80, 80);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment