Last active
October 27, 2019 01:43
-
-
Save gabrielflorit/a0d83e7c39f206cbb576880613d742df 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: fade in/out | |
const fade = n => { | |
range(7).forEach(i => { | |
colorSwap(i, clamp(i + n, 0, 7)) | |
}) | |
} | |
const outlinePrint = (x, y, text, color, outline) => { | |
range(9).forEach(i => { | |
print(x + -1 + (i % 3), y + -1 + i / 3, text, outline) | |
}) | |
print(x, y, text, color) | |
} | |
init = state => { | |
state.fadeLevel = 0 | |
} | |
update = (state, input) => { | |
if (input.left || input.down) { | |
state.fadeLevel = Math.min(state.fadeLevel + 1, 7) | |
} | |
if (input.right || input.up) { | |
state.fadeLevel = Math.max(state.fadeLevel - 1, 0) | |
} | |
} | |
draw = state => { | |
fade(state.fadeLevel) | |
clear() | |
range(8).forEach(i => { | |
const side = 128 - i * 16 | |
const xy = 64 - side / 2 | |
rectFill(xy, xy, side, side, i) | |
}) | |
outlinePrint(33, 61, 'press arrow keys', 0, 7) | |
} |
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
{ | |
"iframeVersion": "0.1.255", | |
"lines": [ | |
42, | |
0, | |
0, | |
0, | |
0, | |
0, | |
0, | |
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
{} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment