Skip to content

Instantly share code, notes, and snippets.

@aurelianonava
Created October 4, 2017 18:53
Show Gist options
  • Save aurelianonava/c4ed6e0feba198efee42ad2c6b544a25 to your computer and use it in GitHub Desktop.
Save aurelianonava/c4ed6e0feba198efee42ad2c6b544a25 to your computer and use it in GitHub Desktop.
[Wroking with your own functions #2.] // source http://jsbin.com/wadojuh
<!DOCTYPE html>
<head>
<meta name="description" content="[Wroking with your own functions #2.]">
<Title> Wroking with your own functions 2. </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 2.</h1> </br>
<script id="jsbin-javascript">
// code goes here:
var x = 0;
function setup () {
createCanvas(480, 400);
}
function draw() {
background(200);
// 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);
}
}
</script>
<script id="jsbin-source-javascript" type="text/javascript">// code goes here:
var x = 0;
function setup () {
createCanvas(480, 400);
}
function draw() {
background(200);
// 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);
}
}
</script></body>
</html>
// code goes here:
var x = 0;
function setup () {
createCanvas(480, 400);
}
function draw() {
background(200);
// 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