Skip to content

Instantly share code, notes, and snippets.

@nbogie
Last active June 4, 2020 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nbogie/8ad4948fe7e65518095c004364cdd754 to your computer and use it in GitHub Desktop.
Save nbogie/8ad4948fe7e65518095c004364cdd754 to your computer and use it in GitHub Desktop.
live coding plan - random polygons

this is a rough plan for a demonstration. it is NOT a guide for students.

demo plan - random polygons

start with nothing

see [beginShape() documentation](https://p5js.org/reference/#/p5/beginShape

beginShape();
vertex(100, 100);
vertex(200, 100);
vertex(200, 200);
vertex(100, 200);
endShape(CLOSE);

random triangles - 3 random vertices anywhere on screen (copy paste)

random 6-vertex polys anywhere on screen (copy paste) - done

	beginShape();
	vertex(random(width), random(height));
	vertex(random(width), random(height));
	vertex(random(width), random(height));
	vertex(random(width), random(height));
	vertex(random(width), random(height));
	vertex(random(width), random(height));
	endShape(CLOSE);


factor out a randomVertex() - vertex anywhere on screen

limit the range of the randomness: randomVertexAroundCentre(variance) - first impl:

let x = width / 2 + random(-variance, variance)
let y = height / 2 + random(-variance, variance)

change to randomVertexAroundPoint(mouseX, mouseY)

factor out drawShape(x, y, variance)

mouse dragged

keypresses change variance

silhouette palette

blendMode()

grid

symmetry

sketch stage snapshots

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment