Skip to content

Instantly share code, notes, and snippets.

@Tylian
Created March 12, 2020 16:13
Show Gist options
  • Save Tylian/d986c4d87bd23cce70bcd42f0fae72ce to your computer and use it in GitHub Desktop.
Save Tylian/d986c4d87bd23cce70bcd42f0fae72ce 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 / 45
}
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 * i, color)
})
}
{
"iframeVersion": "0.1.280",
"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