Skip to content

Instantly share code, notes, and snippets.

@thykka
Created July 23, 2020 11:32
Show Gist options
  • Select an option

  • Save thykka/39fc9020aeb19c0a38436227e285e17f to your computer and use it in GitHub Desktop.

Select an option

Save thykka/39fc9020aeb19c0a38436227e285e17f to your computer and use it in GitHub Desktop.
SCRIPT-8
init = S => {
S.t = 0
}
update = (S, input, elapsed) => {
S.t += elapsed / 1000
}
draw = S => {
clear(0)
const spokes = 24
let slant = 0
for (let spoke = 0; spoke < spokes; spoke++) {
const pos = spoke / spokes
let lastX = 64;
let lastY = 64;
let c = 0
for(let dist = 8; dist <= 128; dist += 16) {
c++
slant += c % 2 === 0 ? 1 / 10 : -1 / 10
const x1 = 64 + Math.sin(S.t + (pos + slant) * Math.PI * 2) * dist
const y1 = 64 + Math.cos(S.t + (pos + slant) * Math.PI * 2) * dist
line(lastX, lastY, x1, y1, 7)
lastX = x1
lastY = y1
}
}
}
{
"iframeVersion": "0.1.280",
"lines": [
29,
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