Skip to content

Instantly share code, notes, and snippets.

@urish
Created June 13, 2020 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save urish/f3015c2ace8a6bc91a6bdd419a154ff7 to your computer and use it in GitHub Desktop.
Save urish/f3015c2ace8a6bc91a6bdd419a154ff7 to your computer and use it in GitHub Desktop.
Walking person animation for Espruino
// LCD Animation: walk
// Code auto-generated by https://wokwi.com/animator, graphics by icons8.com
const frames = [
new Uint8Array([0,0,0,0,0,0,192,0,0,1,240,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,3,128,0,0,15,224,0,0,24,32,0,0,48,48,0,0,68,56,0,0,204,108,0,0,188,103,128,1,188,112,128,1,40,94,128,3,104,195,128,1,216,192,0,1,152,64,0,0,28,96,0,0,22,48,0,0,19,16,0,0,51,152,0,0,38,216,0,0,68,200,0,0,204,72,0,1,152,76,0,1,48,108,0,1,224,56,0,0,64,16,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,192,0,0,1,240,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,3,128,0,0,15,224,0,0,24,32,0,0,48,48,0,0,100,56,0,0,204,108,0,0,156,103,0,1,188,113,128,1,40,222,128,1,104,199,128,1,88,192,0,1,216,192,0,0,28,96,0,0,22,48,0,0,19,16,0,0,51,144,0,0,38,152,0,0,100,200,0,0,204,72,0,1,152,76,0,1,176,108,0,0,224,56,0,0,64,16,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,192,0,0,1,240,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,3,192,0,0,15,224,0,0,24,32,0,0,48,48,0,0,100,48,0,0,76,120,0,0,220,110,0,0,156,97,128,0,184,253,128,1,168,207,0,1,248,192,0,0,216,192,0,0,28,96,0,0,30,32,0,0,19,48,0,0,19,144,0,0,50,152,0,0,102,200,0,0,204,72,0,0,152,76,0,0,144,108,0,0,224,56,0,0,0,16,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,224,0,0,1,240,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,3,192,0,0,15,224,0,0,24,32,0,0,48,48,0,0,100,48,0,0,76,120,0,0,92,76,0,0,220,99,0,0,152,241,0,0,184,223,0,0,184,128,0,0,248,192,0,0,28,96,0,0,30,32,0,0,27,48,0,0,19,16,0,0,51,144,0,0,102,152,0,0,204,200,0,0,136,76,0,0,144,108,0,0,240,56,0,0,0,16,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,224,0,0,1,240,0,0,3,16,0,0,2,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,7,192,0,0,12,96,0,0,24,32,0,0,48,48,0,0,102,48,0,0,108,112,0,0,76,88,0,0,88,102,0,0,88,227,0,0,216,255,0,0,216,134,0,0,248,192,0,0,28,64,0,0,30,96,0,0,26,32,0,0,27,48,0,0,51,144,0,0,99,152,0,0,196,200,0,0,140,76,0,0,216,108,0,0,112,56,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,224,0,0,3,240,0,0,3,16,0,0,2,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,7,192,0,0,12,96,0,0,8,32,0,0,16,32,0,0,54,96,0,0,44,112,0,0,108,88,0,0,104,76,0,0,120,228,0,0,88,252,0,0,88,128,0,0,120,192,0,0,12,64,0,0,12,64,0,0,14,96,0,0,27,32,0,0,51,48,0,0,103,16,0,0,205,144,0,0,216,152,0,0,112,216,0,0,0,112,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,224,0,0,3,176,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,0,0,0,7,192,0,0,12,96,0,0,8,32,0,0,24,32,0,0,54,96,0,0,36,96,0,0,44,112,0,0,44,88,0,0,40,248,0,0,40,248,0,0,56,128,0,0,56,192,0,0,12,192,0,0,12,64,0,0,14,64,0,0,58,96,0,0,98,96,0,0,207,32,0,0,217,32,0,0,113,48,0,0,1,176,0,0,0,224,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,1,224,0,0,3,48,0,0,3,16,0,0,2,16,0,0,3,16,0,0,1,240,0,0,0,0,0,0,7,192,0,0,12,96,0,0,8,32,0,0,24,32,0,0,22,96,0,0,52,96,0,0,60,96,0,0,60,96,0,0,60,224,0,0,52,224,0,0,28,128,0,0,24,192,0,0,12,192,0,0,12,192,0,0,28,192,0,0,118,64,0,0,198,64,0,0,206,64,0,0,114,96,0,0,3,96,0,0,3,96,0,0,1,192,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,1,224,0,0,3,48,0,0,3,16,0,0,3,16,0,0,3,48,0,0,1,224,0,0,0,0,0,0,7,192,0,0,12,96,0,0,8,32,0,0,26,32,0,0,26,96,0,0,22,96,0,0,20,64,0,0,20,64,0,0,22,192,0,0,22,192,0,0,28,128,0,0,12,128,0,0,8,128,0,0,12,192,0,0,60,192,0,0,228,192,0,0,134,192,0,0,254,192,0,0,6,192,0,0,6,192,0,0,6,192,0,0,3,128,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,1,240,0,0,3,48,0,0,3,16,0,0,3,16,0,0,3,48,0,0,1,224,0,0,0,0,0,0,7,192,0,0,4,96,0,0,12,32,0,0,10,32,0,0,26,96,0,0,22,96,0,0,22,64,0,0,26,64,0,0,26,192,0,0,10,128,0,0,14,128,0,0,14,128,0,0,8,128,0,0,8,128,0,0,12,128,0,0,60,128,0,0,108,128,0,0,60,128,0,0,60,128,0,0,12,128,0,0,4,128,0,0,7,0,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,1,240,0,0,3,48,0,0,3,16,0,0,3,16,0,0,3,48,0,0,1,224,0,0,0,0,0,0,7,192,0,0,4,96,0,0,12,32,0,0,9,32,0,0,11,96,0,0,26,96,0,0,26,64,0,0,26,64,0,0,11,192,0,0,13,192,0,0,15,128,0,0,14,128,0,0,8,128,0,0,9,128,0,0,9,128,0,0,9,128,0,0,25,128,0,0,25,0,0,0,9,0,0,0,9,0,0,0,9,0,0,0,15,0,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,1,224,0,0,3,48,0,0,3,16,0,0,3,16,0,0,3,48,0,0,1,224,0,0,0,0,0,0,7,192,0,0,4,96,0,0,12,32,0,0,13,32,0,0,27,96,0,0,27,96,0,0,26,64,0,0,27,64,0,0,29,192,0,0,13,192,0,0,30,128,0,0,27,128,0,0,25,128,0,0,25,128,0,0,25,128,0,0,25,128,0,0,25,128,0,0,27,0,0,0,27,0,0,0,19,0,0,0,18,0,0,0,30,0,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,1,224,0,0,3,48,0,0,3,16,0,0,2,16,0,0,3,16,0,0,1,240,0,0,0,0,0,0,3,192,0,0,6,96,0,0,12,32,0,0,29,32,0,0,29,32,0,0,57,96,0,0,59,64,0,0,41,64,0,0,61,192,0,0,30,192,0,0,26,192,0,0,27,128,0,0,25,128,0,0,25,192,0,0,19,64,0,0,19,64,0,0,18,192,0,0,18,128,0,0,51,128,0,0,55,0,0,0,54,0,0,0,60,0,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,224,0,0,3,240,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,0,0,0,3,192,0,0,7,224,0,0,12,32,0,0,29,32,0,0,61,32,0,0,45,96,0,0,109,64,0,0,77,192,0,0,126,192,0,0,58,64,0,0,25,64,0,0,25,192,0,0,25,128,0,0,25,64,0,0,17,96,0,0,19,96,0,0,19,96,0,0,51,64,0,0,39,64,0,0,37,192,0,0,100,0,0,0,60,0,0,0,16,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,224,0,0,1,240,0,0,3,16,0,0,2,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,3,192,0,0,7,224,0,0,28,32,0,0,61,32,0,0,45,32,0,0,109,96,0,0,77,192,0,0,92,192,0,0,94,96,0,0,123,32,0,0,25,224,0,0,24,224,0,0,25,192,0,0,25,96,0,0,17,32,0,0,19,32,0,0,51,160,0,0,55,160,0,0,37,160,0,0,108,160,0,0,72,224,0,0,120,0,0,0,48,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,224,0,0,1,240,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,3,128,0,0,15,224,0,0,28,32,0,0,61,32,0,0,109,32,0,0,77,96,0,0,93,192,0,0,220,192,0,0,222,96,0,0,105,176,0,0,24,240,0,0,24,224,0,0,25,192,0,0,25,96,0,0,25,32,0,0,19,176,0,0,51,144,0,0,38,144,0,0,100,144,0,0,76,216,0,0,200,112,0,0,216,32,0,0,112,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,192,0,0,1,240,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,3,128,0,0,7,224,0,0,12,32,0,0,61,32,0,0,45,32,0,0,109,224,0,0,77,192,0,0,220,224,0,0,222,48,0,0,105,144,0,0,24,240,0,0,24,224,0,0,25,192,0,0,25,32,0,0,25,48,0,0,19,144,0,0,51,144,0,0,38,152,0,0,100,200,0,0,204,200,0,0,152,88,0,0,240,48,0,0,96,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,192,0,0,1,240,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,3,128,0,0,7,224,0,0,12,32,0,0,29,32,0,0,61,32,0,0,109,96,0,0,77,192,0,0,220,192,0,0,223,96,0,0,105,176,0,0,24,240,0,0,24,224,0,0,25,192,0,0,25,96,0,0,25,32,0,0,27,48,0,0,51,144,0,0,38,144,0,0,100,152,0,0,204,200,0,0,216,88,0,0,240,112,0,0,32,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,192,0,0,1,240,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,3,192,0,0,7,224,0,0,12,32,0,0,13,32,0,0,13,32,0,0,29,96,0,0,29,192,0,0,60,192,0,0,58,96,0,0,57,32,0,0,24,224,0,0,24,192,0,0,25,192,0,0,25,224,0,0,25,32,0,0,25,32,0,0,19,48,0,0,35,144,0,0,100,144,0,0,76,152,0,0,216,216,0,0,112,112,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,224,0,0,1,240,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,3,192,0,0,7,224,0,0,12,32,0,0,13,32,0,0,13,32,0,0,13,96,0,0,13,192,0,0,12,192,0,0,14,192,0,0,11,64,0,0,25,192,0,0,24,128,0,0,24,192,0,0,9,192,0,0,9,224,0,0,25,32,0,0,19,32,0,0,35,48,0,0,101,144,0,0,76,144,0,0,120,144,0,0,32,112,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,224,0,0,1,240,0,0,3,16,0,0,2,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,7,192,0,0,4,96,0,0,12,32,0,0,13,32,0,0,9,32,0,0,11,96,0,0,9,64,0,0,13,192,0,0,12,192,0,0,14,192,0,0,27,128,0,0,24,128,0,0,8,192,0,0,8,192,0,0,9,192,0,0,9,224,0,0,19,32,0,0,35,32,0,0,69,48,0,0,121,144,0,0,48,144,0,0,0,240,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,224,0,0,3,176,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,0,0,0,7,192,0,0,4,96,0,0,12,32,0,0,9,32,0,0,11,96,0,0,26,96,0,0,11,96,0,0,9,96,0,0,13,224,0,0,13,224,0,0,31,224,0,0,8,192,0,0,8,128,0,0,8,128,0,0,12,192,0,0,12,192,0,0,9,192,0,0,27,64,0,0,18,96,0,0,23,96,0,0,31,96,0,0,1,192,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,1,224,0,0,3,48,0,0,3,16,0,0,3,16,0,0,3,48,0,0,1,240,0,0,0,0,0,0,7,192,0,0,4,96,0,0,12,32,0,0,9,32,0,0,27,96,0,0,18,96,0,0,18,112,0,0,26,112,0,0,11,208,0,0,11,240,0,0,15,176,0,0,8,192,0,0,8,192,0,0,12,192,0,0,4,192,0,0,6,192,0,0,4,128,0,0,13,128,0,0,9,128,0,0,11,128,0,0,6,128,0,0,3,0,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,1,240,0,0,3,48,0,0,2,16,0,0,3,16,0,0,3,48,0,0,1,224,0,0,0,0,0,0,7,192,0,0,12,96,0,0,8,32,0,0,25,32,0,0,27,112,0,0,22,112,0,0,54,112,0,0,22,80,0,0,22,232,0,0,18,184,0,0,30,152,0,0,12,192,0,0,12,64,0,0,12,64,0,0,14,64,0,0,14,64,0,0,14,64,0,0,14,192,0,0,14,128,0,0,14,128,0,0,11,128,0,0,14,0,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,1,240,0,0,3,48,0,0,2,16,0,0,3,16,0,0,3,48,0,0,1,224,0,0,0,0,0,0,7,192,0,0,12,96,0,0,8,32,0,0,24,32,0,0,50,112,0,0,38,112,0,0,44,80,0,0,44,76,0,0,44,228,0,0,44,188,0,0,60,140,0,0,24,192,0,0,12,64,0,0,14,96,0,0,11,32,0,0,11,32,0,0,27,96,0,0,27,96,0,0,19,96,0,0,23,96,0,0,21,192,0,0,28,128,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,1,224,0,0,3,48,0,0,3,16,0,0,3,16,0,0,3,48,0,0,1,240,0,0,0,0,0,0,7,192,0,0,12,96,0,0,8,32,0,0,16,48,0,0,54,48,0,0,108,112,0,0,108,92,0,0,72,102,0,0,88,243,0,0,88,223,0,0,120,198,0,0,56,192,0,0,28,96,0,0,30,96,0,0,27,32,0,0,27,160,0,0,19,160,0,0,55,160,0,0,37,176,0,0,109,176,0,0,104,160,0,0,56,224,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,224,0,0,3,176,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,0,0,0,7,192,0,0,15,224,0,0,24,32,0,0,48,48,0,0,100,48,0,0,76,120,0,0,92,110,0,0,220,99,0,0,152,249,0,0,184,207,0,0,248,192,0,0,88,64,0,0,28,96,0,0,30,32,0,0,19,48,0,0,19,144,0,0,50,144,0,0,102,144,0,0,76,152,0,0,200,216,0,0,152,216,0,0,240,112,0,0,0,0,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,224,0,0,1,240,0,0,3,16,0,0,2,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,3,128,0,0,15,224,0,0,24,32,0,0,48,48,0,0,100,56,0,0,204,104,0,0,156,111,0,0,188,113,128,1,168,220,128,1,104,199,128,1,216,192,0,0,216,64,0,0,28,96,0,0,22,48,0,0,19,16,0,0,51,144,0,0,38,152,0,0,100,216,0,0,204,72,0,0,152,72,0,1,144,72,0,0,240,120,0,0,64,16,0,0,0,0,0])
];
const img = {
width: 32,
height: 32,
bpp: 1,
buffer: frames[0],
};
let walking = true;
setWatch(() => LED.toggle(), BTN1, {repeat: true});
setWatch(() => walking = !walking, BTN3, {repeat: true});
let x = 0;
let frame = 0;
setInterval(() => {
img.buffer = frames[frame];
g.clear();
g.drawImage(img, x % 128, 16);
g.flip();
if (walking || BTN2.read()) {
frame = (frame + 1) % frames.length;
}
if (walking) {
x++;
}
}, 42);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment