Skip to content

Instantly share code, notes, and snippets.

@icarito
Last active March 22, 2019 02:52
Show Gist options
  • Save icarito/64d35a51f39ed5db1730c8f2e56f58d0 to your computer and use it in GitHub Desktop.
Save icarito/64d35a51f39ed5db1730c8f2e56f58d0 to your computer and use it in GitHub Desktop.
SCRIPT-8
// title: Water Effect #3
const v = 20
function waterLevel(x) {
// 16 springs
return 54 + Math.sin(x) * 2
}
draw = function(state) {
state.t = state.t + 1
clear()
for (let x of range(17)) {
sprite(x * 8 - state.t/8 % 8, waterLevel(x) - 8,
Math.round(state.t / v + (x/3 % 2)) % 3, 0, 1)
rectFill(x * 8 - state.t/8 % 8, waterLevel(x), 8, 127, 6)
}
}
{
"iframeVersion": "0.1.247",
"lines": [
19,
0,
0,
0,
0,
0,
0,
0
]
}
{
"0": {
"notes": [
"0a#37"
],
"tempo": 0
}
}
{
"0": [
" ",
" ",
" ",
" ",
" 665 ",
" 66561 ",
" 6666661",
"66666656"
],
"1": [
" ",
" ",
" ",
" ",
" ",
" 66 ",
" 6666 ",
" 666666 "
],
"2": [
" ",
" ",
" ",
" ",
" ",
" ",
" 66 ",
" 6666 "
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment