Skip to content

Instantly share code, notes, and snippets.

@dannyalberto
Created September 29, 2017 19:31
Show Gist options
  • Save dannyalberto/c1bc33004c8d285ab27cdd8b053d84bd to your computer and use it in GitHub Desktop.
Save dannyalberto/c1bc33004c8d285ab27cdd8b053d84bd to your computer and use it in GitHub Desktop.
Project 2, Version 1 // source http://jsbin.com/dafopin
<!DOCTYPE html>
<html>
The reason for the movement of the circle is because of the greater sign(>) next to the x variable, in the ''if conditional statement''( if (x>240) ).The greater sign makes the x variable move into the direction the sign points to,
therefore replacing a greater sign instead of a number.With this, the Function draw runs 60 times a second, while this happening, the speed what picked up and then moved(the if conditional statement , the greater sing changed on the x axis of the funcion).
<head>
<title>Project 2, Version 1</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>Issue #16</h1>
<a href="https://github.com/aurelianonava/mhs/issues/16">Issue #16 on the mhs Github repsitory</a>
<script id="jsbin-javascript">
// Code goes here
// Project 2, Version 1.2
// Using system variable "with"
var x = 10;
function setup() {
createCanvas (480, 220);
}
function draw() {
background(20,200,150);
ellipse(x+=1, 25, 25, 25);
strokeWeight(3);
point(x+=.5, 25);
if ( x > 240 ) {
x = 0;
}
}
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
The reason for the movement of the circle is because of the greater sign(>) next to the x variable, in the ''if conditional statement''( if (x>240) ).The greater sign makes the x variable move into the direction the sign points to,
therefore replacing a greater sign instead of a number.With this, the Function draw runs 60 times a second, while this happening, the speed what picked up and then moved(the if conditional statement , the greater sing changed on the x axis of the funcion).
<head>
<title>Project 2, Version 1</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>Issue #16</h1>
<a href="https://github.com/aurelianonava/mhs/issues/16">Issue #16 on the mhs Github repsitory</a>
</body>
</html>
</script>
<script id="jsbin-source-javascript" type="text/javascript">// Code goes here
// Project 2, Version 1.2
// Using system variable "with"
var x = 10;
function setup() {
createCanvas (480, 220);
}
function draw() {
background(20,200,150);
ellipse(x+=1, 25, 25, 25);
strokeWeight(3);
point(x+=.5, 25);
if ( x > 240 ) {
x = 0;
}
}</script></body>
</html>
// Code goes here
// Project 2, Version 1.2
// Using system variable "with"
var x = 10;
function setup() {
createCanvas (480, 220);
}
function draw() {
background(20,200,150);
ellipse(x+=1, 25, 25, 25);
strokeWeight(3);
point(x+=.5, 25);
if ( x > 240 ) {
x = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment