Skip to content

Instantly share code, notes, and snippets.

@PJaros
Created September 9, 2019 03:56
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 PJaros/93e04372efc0e061657cc5a8ca3310de to your computer and use it in GitHub Desktop.
Save PJaros/93e04372efc0e061657cc5a8ca3310de to your computer and use it in GitHub Desktop.
SCRIPT-8
init = state => {
state.angle = 5 // the rotation angle
}
update = (state, input, elapsed) => {
state.angle = state.angle + elapsed / 10
}
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)
})
}
{
"iframeVersion": "0.1.255",
"lines": [
21,
0,
0,
0,
0,
0,
0,
0
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment