-
-
Save aurelianonava/8bbc00789e9ede51cce44056543e5ba8 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>Experimenting with creating my own functions</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() { | |
fill(random(0, 255), random(0, 255), random(0, 255)); | |
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