Last active
August 14, 2018 04:07
-
-
Save KorySchneider/2aefa092c5e10d2c2ec13317388465b9 to your computer and use it in GitHub Desktop.
p5js sketch boilerplate, with a centered canvas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>title</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.1/p5.js"></script> | |
<style> | |
html, body { | |
height: 100%; | |
margin: 0; | |
} | |
canvas { | |
position: absolute; | |
top: 0; | |
left: 0; | |
z-index: 0; | |
width: 100%; | |
height: 100%; | |
display: block; | |
pointer-events: none; | |
} | |
</style> | |
</head> | |
<body></body> | |
<script> | |
function setup() { | |
createCanvas(window.innerWidth, window.innerHeight); | |
} | |
function draw() { | |
background(80, 80, 80); | |
} | |
function windowResized() { | |
resizeCanvas(windowWidth, windowHeight); | |
} | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment