nannon-IterationExercise

var boolDoRefresh;
 
function setup() {
  createCanvas(400, 400);
	background(240,240,255);
  boolDoRefresh = true;
}
 
function rando(min, max) {
  min = Math.ceil(min);
  max = Math.floor(max);
  return Math.floor(Math.random() * (max - min)) + min; 
}
 
console.log(rando(0,100))
 
 
 
function draw() {
  if (boolDoRefresh) {
    //margins = 16px
		//box size= 32
		//spacer=16
		setup()
		var margin =16
		var spacer=16
		var boxsize=32
		for (i=0; i<8; i++) {
			for (j=0;j<8;j++) {
				var randomint=rando(0,100)
				var randopercent = rando(5,12)
				var x=margin+j*(spacer+boxsize)
				var y=margin+i*(spacer+boxsize)
				if (randomint<randopercent) {
					ellipse(x+16, y+16, 28,28)
				}
 
				else {
					rect(x, y, boxsize, boxsize)
				}
			}
		}
 
    boolDoRefresh = false;
  }
}
 
function mousePressed() {
  boolDoRefresh = true;
}

nannon-Intersections

 
var boolDoRefresh;
var linelist=[]
var numSlider
 
function setup() {
  createCanvas(720,480);
  boolDoRefresh = true;
}
 
function rando(min, max) {
  min = Math.ceil(min);
  max = Math.floor(max);
  return Math.floor(Math.random() * (max - min + 1)) + min; //The maximum is inclusive and the minimum is inclusive 
}
 
// function findintersection(line1, line2) {
//     return math.intersect(line1[0], line1[1], line2[0], line2[1])
// }
 
function intersect(x1, y1, x2, y2, x3, y3, x4, y4) {
  if ((x1 === x2 &amp;&amp; y1 === y2) || (x3 === x4 &amp;&amp; y3 === y4)) {
    return false
  }
  denominator = ((y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1))
  if (denominator === 0) {
    return false
  }
  let ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator
  let ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denominator
  if (ua &lt; 0 || ua &gt; 1 || ub &lt; 0 || ub &gt; 1) {
    return false
  }
  let x = x1 + ua * (x2 - x1)
  let y = y1 + ua * (y2 - y1)
 
  return [x, y]
}
 
function draw() {
  if (boolDoRefresh) {
    var numLines= 15
    background("#FFE6E6");
    linelist=[]
    for (i=0;i&lt;numLines;i++){ var startx= rando(0, width) var starty= rando(0, height) var endx = rando(0, width) var endy = rando(0, height) stroke("#FF0000"); strokeWeight(2); line(startx, starty, endx,endy) linelist.push([[startx,starty],[endx,endy]]) if (linelist.length &gt;1) { 
          for (j=0;j&lt;i; j++) {
            var inter = intersect(linelist[i][0][0], linelist[i][0][1], linelist[i][1][0], linelist[i][1][1], linelist[j][0][0], linelist[j][0][1], linelist[j][1][0], linelist[j][1][1],)
            if (inter) {
              strokeWeight(2)
              fill('rgba(255,0,0, 0.25)')
              ellipse(inter[0], inter[1], 20,20)
            }
          }
      }
    }
    boolDoRefresh = false;
  }
}
 
function mousePressed() {
  boolDoRefresh = true;
}
 
//random function from: 
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
 
//intersect function from:
//http://paulbourke.net/geometry/pointlineplane/javascript.txt

Anarchist Baby Steps into Procedural Art

var redraw
function setup() {
createCanvas(4096, 4096, WEBGL);
fullscreen()
redraw=true
}
 
function draw() {
     if(redraw==true) {
          background(0);
          setLights()
          drawLines(2500)
          save();
          save('myCanvas.jpg');
          redraw=false
     }
}
 
function setLights() {
     ambientLight(100);
     directionalLight(250, 0, 0, 50, 250, 1)
     directionalLight(0, 50, 0, 250, -250, 1)
}
 
function drawLines(lineCount) {
     for(i=0; i&lt;lineCount; i++) {
          var xPos = random(-100,100)
          var yPos = 0
          var zPos = random(-100,100)
          draw3dLine(xPos, yPos, zPos)
     }
}
 
function draw3dLine(xPos, yPos, zPos) {
     var xRot = Math.random(0, TWO_PI)
     var yRot = Math.random(0, TWO_PI)
     var zRot = Math.random(0, TWO_PI)
 
     rotateX(xRot)
     rotateY(yRot)
     rotateZ(zRot)
 
     translate(xPos, yPos, zPos)
     noStroke()
     ambientMaterial(255,100,100)
     cylinder(2, 1000000, 10, 10, false, false)
}

Placebo’s OpenProcessing Embed

Here is a "Banded Clock" by Golan Levin, hosted on OpenProcessing.org at  https://www.openprocessing.org/sketch/503941, and embedded here using an iFrame. (Note that the actual dimensions of this sketch are 600x200 pixels, but because I don't have an OpenProcessing "pro" account, I can't hide the OpenProcessing branding at the top, so I've added an additional 50 pixels of height to accommodate.)

Placebo’s First Post

Hello, I am Placebo, the 60-212 sock puppet. I have the same type of "Editor" account as the other students in our class. The professor uses me to test the WordPress experience for students.

Here's a clever animated GIF by Dave Whyte from BeesAndBombs. (Note that the GIF is embedded at its original resolution, because embedding it at a resized resolution wouldn't be animated!)

Here's a YouTube video of that time I visited Dan Shiffman's Coding Train. (Note that it was merely necessary for me to paste the URL of the YouTube video onto its own line in the WordPress site's Visual editor, and voilà! The video is embedded.)