Last active
June 29, 2018 12:51
-
-
Save gabrielflorit/3ccb3ef6111d5f105d0a7437d2fbbf17 to your computer and use it in GitHub Desktop.
SCRIPT-8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// title: plumber spiral | |
initialState = { | |
circles: range(64) | |
.map(i => ({ | |
a: 0, | |
r: i, | |
c: 7 - Math.floor(i / 8), | |
d: i % 2 === 0 ? 1 : 1 | |
})) | |
} | |
update = state => { | |
state.circles.forEach(circle => { | |
circle.a += circle.d * circle.r / 32 | |
}) | |
} | |
draw = state => { | |
clear() | |
state.circles.forEach(circle => { | |
const { a, r, c } = circle | |
const x = 64 + Math.cos(a * Math.PI / 180) * r | |
const y = 64 + Math.sin(a * Math.PI / 180) * r | |
sprite(x, y, 0) | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"0": [ | |
" 2220 ", | |
" 22222", | |
" 303 0 ", | |
" 300330", | |
" 3000 ", | |
" 220331 ", | |
"0 333352", | |
" 3 4 " | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment