Skip to content

Instantly share code, notes, and snippets.

@aurelianonava
Last active October 4, 2017 16:38
Show Gist options
  • Select an option

  • Save aurelianonava/2aebf073bab8ed1cef91e3f8c29f48e2 to your computer and use it in GitHub Desktop.

Select an option

Save aurelianonava/2aebf073bab8ed1cef91e3f8c29f48e2 to your computer and use it in GitHub Desktop.
[Wroking with your own functions.]// source http://jsbin.com/wadojuh
<!DOCTYPE html>
<head>
<meta name="description" content="[Wroking with your own functions.]">
<Title> Wroking with your own functions. </Title>
<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>
</head>
<body>
<h1>Wroking with your own functions.</h1> </br>
</body>
</html>
// code goes here:
var x = 0;
function setup () {
createCanvas(480, 400);
}
function draw() {
background(200, 100, 50);
// for(var i = 0; i < 1000; i++) {
// ellipse(10, 10, 10, 10);
// strokeWeight(random(0,10));
// point(random(0, width), random(0, height));
// ellipse(i, 10, 10, 10);
// }
ellipse(x+=1, 10, 10, 10);
myFun();
}
function myFun() {
if( x > 300 ) {
ellipse(50, 200, 10, 10);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment