Skip to content

Instantly share code, notes, and snippets.

@dannyalberto
Last active September 26, 2017 19:23
Show Gist options
  • Save dannyalberto/8b94b7063f333b8f6e9018c9d6bdd2eb to your computer and use it in GitHub Desktop.
Save dannyalberto/8b94b7063f333b8f6e9018c9d6bdd2eb to your computer and use it in GitHub Desktop.
Project 2, Version 1// source http://jsbin.com/dafopin
<!DOCTYPE html>
<html>
<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>
<p>
The reason for the movement of the circle is because of the,'' > ''in the
if ( x > 240 ) changes the dirrecion of the x point on the canvas graph.
</p>
<script id="jsbin-javascript">
// Code goes here
// Project 2, Version 1.2
// Using system variable "with"
var x = 10;
function setup() {
createCanvas (480, 240);
}
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>
<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>
<p>
The reason for the movement of the circle is because of the,'' > ''in the
if ( x > 240 ) changes the dirrecion of the x point on the canvas graph.
</p>
</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, 240);
}
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, 240);
}
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