Skip to content

Instantly share code, notes, and snippets.

@gtoast
Created August 22, 2019 19:46
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 gtoast/cd50c8e3192cd594b129d4e5f72533f3 to your computer and use it in GitHub Desktop.
Save gtoast/cd50c8e3192cd594b129d4e5f72533f3 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