Skip to content

Instantly share code, notes, and snippets.

@benwiley4000
Created February 9, 2019 22:17
Show Gist options
  • Save benwiley4000/44ec67a8c4691e72a043527381a9ba4c to your computer and use it in GitHub Desktop.
Save benwiley4000/44ec67a8c4691e72a043527381a9ba4c to your computer and use it in GitHub Desktop.
SCRIPT-8
initialState = {
angle: 5 // the rotation angle
}
update = (state, input, elapsed) => {
state.angle += 2
}
draw = (state) => {
clear()
const { angle } = state
range(8).forEach(i => {
const halfSide = 8 * i / 2
const topLeft = [64 - halfSide, 64 - halfSide]
const topRight = [64 + halfSide, 64 - halfSide]
const bottomRight = [64 + halfSide, 64 + halfSide]
const bottomLeft = [64 - halfSide, 64 + halfSide]
const color = i % 7
polyStroke([topLeft, topRight, bottomRight, bottomLeft], angle, color)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment