Skip to content

Instantly share code, notes, and snippets.

@autf
Last active September 16, 2021 11:38
Show Gist options
  • Save autf/65ec7dbbaca6a478a7fd829df40dbf25 to your computer and use it in GitHub Desktop.
Save autf/65ec7dbbaca6a478a7fd829df40dbf25 to your computer and use it in GitHub Desktop.
Exercise 6.1 < 6.3 Translation < edX NYUx DMEDX6063 Creative Coding
function setup() {
createCanvas(500, 500)
background('lightgray')
}
function draw() {
let side = 300
let third = side / 3
noStroke()
translate(100, 100)
apply(0, 0, tag, third)
apply(0, 2 * third, tag, third)
apply(2 * third, third, tag, third)
}
const tag = (side) =>
triangle(0, 0, 0, side, side, side / 2)
function apply(x0, y0, fn, ...args) {
push()
translate(x0, y0)
fn.apply(null, args)
pop()
}
@autf
Copy link
Author

autf commented Sep 16, 2021

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