Skip to content

Instantly share code, notes, and snippets.

@maio
Created February 2, 2019 14:32
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 maio/229e5e61e6ad9a00bf0c168b8f355728 to your computer and use it in GitHub Desktop.
Save maio/229e5e61e6ad9a00bf0c168b8f355728 to your computer and use it in GitHub Desktop.
SCRIPT-8
initialState = {
angle: 5 // the rotation angle
}
update = (state, input, elapsed) => {
state.angle = state.angle + elapsed / 10
}
draw = (state) => {
clear()
const { angle } = state
range(42).forEach(i => {
const halfSide = 3 * i / 1
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 * 5, color)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment