Skip to content

Instantly share code, notes, and snippets.

@dribnet
Last active March 12, 2021 15:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dribnet/9f735f3bf1dda0dcd9ebf6b5319a8376 to your computer and use it in GitHub Desktop.
Save dribnet/9f735f3bf1dda0dcd9ebf6b5319a8376 to your computer and use it in GitHub Desktop.
p5.js hello world
license: mit

p5.js hello world

This is the simplest p5.js block. Meant to be a starting point for others.

<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