Skip to content

Instantly share code, notes, and snippets.

@jstcki
Last active November 11, 2015 08:50
Show Gist options
  • Save jstcki/94fad89ebfe0625298d8 to your computer and use it in GitHub Desktop.
Save jstcki/94fad89ebfe0625298d8 to your computer and use it in GitHub Desktop.
Playin with p5.js
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.4.18/p5.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
svg { width: 100%; height: 100%; }
</style>
</head>
<body>
<script>
function setup(){
createCanvas(960, 500);
}
function update() {
}
function draw() {
var y = Math.sin(frameCount/12) * 200;
var x = Math.cos(frameCount/12) * 200;
var size = Math.sin(frameCount / 6) * 100;
ellipse(480 + x, 250 + y, size, size);
}
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment