Created
January 31, 2020 23:22
-
-
Save gabrielflorit/b420f1da07132f5a6f91f98a1a11259e 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: logo 192 | |
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() | |
const j = 0 | |
range(8).forEach(i => { | |
const side = 128 - i * 4 | |
const xy = 64 - side / 2 | |
rectFill(xy, xy + i * j, side, side - i * j * 2, i) | |
}) | |
printAlphabet({ | |
x: 17, | |
y: 57, | |
numbers: 'script-8', | |
color: 0, | |
size: 3, | |
flip: true | |
}) | |
// rectStroke(0, 0, 128, 128, 0) | |
// line(0, 0, 128, 128, 2) | |
// line(128, 0, 0, 128, 2) | |
} | |
const printAlphabet = ({ x, y, numbers, color, flip, size = 3 }) => { | |
let digits = numbers.toString().split('') | |
if (!flip) { | |
digits.reverse() | |
} | |
digits.forEach((digit, digitI) => { | |
alphabet[digit].forEach((pixel, i) => { | |
const numberX = i % 3 | |
const numberY = Math.floor(i / 3) | |
if (pixel) { | |
rectFill( | |
(flip ? 1 : -1) * digitI * (size * 4) + x + numberX * size, | |
y + numberY * size, | |
size, | |
size, | |
color | |
)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1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0], | |
o: [1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0], | |
p: [1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0], | |
q: [1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0], | |
r: [1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0], | |
s: [1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0], | |
t: [1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], | |
u: [1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0], | |
v: [1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0], | |
w: [1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0], | |
x: [1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0], | |
y: [1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0], | |
z: [1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 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
{ | |
"iframeVersion": "0.1.280", | |
"lines": [ | |
53, | |
24, | |
53, | |
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