Skip to content

Commit

Permalink
Update Structure Catagory
Browse files Browse the repository at this point in the history
  • Loading branch information
sekcompsci committed Oct 25, 2017
1 parent 053da64 commit 2d215dd
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 19 deletions.
13 changes: 8 additions & 5 deletions PieSketch/p5js/draw.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,18 @@ draw()

<script type="text/p5" data-autoplay data-hide-sourcecode>
var yPos = 0;
function setup() { // setup() runs once
frameRate(30);
frameRate(30);
}
function draw() { // draw() loops forever, until stopped
background(204);
yPos = yPos - 1;
if (yPos < 0) {
yPos = height;
background(204);
yPos = yPos - 1;
if (yPos < 0) {
yPos = height;
}
line(0, yPos, width, yPos);
}
</script>
Expand Down
8 changes: 6 additions & 2 deletions PieSketch/p5js/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,17 @@ p5js
<tr>
<td class="table-left">
<ul>
<li><a href="preload.html">preload()</a></li>
<li><a href="setup.html">setup()</a></li>
<li><a href="draw.html">draw()</a></li>
<li><a href="remove.html">remove()</a></li>
<li><a href="noLoop.html">noLoop()</a></li>
<li><a href="loop.html">loop()</a></li>
<li><a href="push.html">push()</a></li>
</ul>
</td>
<td class="tabel-right">
<ul>
<li><a href="loop.html">loop()</a></li>
<li><a href="push.html">push()</a></li>
<li><a href="pop.html">pop()</a></li>
<li><a href="redraw.html">redraw()</a></li>
</ul>
Expand Down
13 changes: 7 additions & 6 deletions PieSketch/p5js/preload.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ preload()
<script type="text/p5" data-autoplay data-hide-sourcecode>
var img;
var c;
function preload() { // preload() runs once
img = loadImage('assets/laDefense.jpg');
img = loadImage('assets/laDefense.jpg');
}
function setup() { // setup() waits until preload() is done
img.loadPixels();
// get color of middle pixel
c = img.get(img.width/2, img.height/2);
img.loadPixels();
// get color of middle pixel
c = img.get(img.width/2, img.height/2);
}
function draw() {
background(c);
image(img, 25, 25, 50, 50);
background(c);
image(img, 25, 25, 50, 50);
}
</script>

Expand Down
4 changes: 2 additions & 2 deletions PieSketch/p5js/remove.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ remove()

<script type="text/p5" data-autoplay data-hide-sourcecode>
function draw() {
ellipse(50, 50, 10, 10);
ellipse(50, 50, 10, 10);
}
function mousePressed() {
remove(); // remove whole sketch on mouse press
remove(); // remove whole sketch on mouse press
}
</script>

Expand Down
8 changes: 4 additions & 4 deletions PieSketch/p5js/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ setup()
var a = 0;
function setup() {
background(0);
noStroke();
fill(102);
background(0);
noStroke();
fill(102);
}
function draw() {
rect(a++%width, 10, 2, 80);
rect(a++%width, 10, 2, 80);
}
</script>

Expand Down

0 comments on commit 2d215dd

Please sign in to comment.