Last active
October 5, 2017 18:54
-
-
Save Outrights/e1d760e886d4eefa4f9ef10bc130ef88 to your computer and use it in GitHub Desktop.
Create and Call a function
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script data-require="p5.js@*" data-semver="0.5.7" src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.7/p5.min.js"></script> | |
<link rel="stylesheet" href="style.css" /> | |
<script src="script.js"></script> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<h3>We will be experimenting with creating our own functions. It should be fun.</h3> | |
</body> | |
</html> |
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
function setup() { | |
canvas = createCanvas(480, 320); | |
} | |
function draw() { | |
background(200); | |
if(mouseX > width/2) { | |
myFun1(); | |
} | |
} | |
function myFun1() { | |
ellipse(width/2, height/2, 50, 50); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment