-
Notifications
You must be signed in to change notification settings - Fork 242
/
Copy pathmain.js
36 lines (31 loc) · 949 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
* Copyright (c) 2016-2017 Moddable Tech, Inc.
*
* This file is part of the Moddable SDK.
*
* This work is licensed under the
* Creative Commons Attribution 4.0 International License.
* To view a copy of this license, visit
* <http://creativecommons.org/licenses/by/4.0>.
* or send a letter to Creative Commons, PO Box 1866,
* Mountain View, CA 94042, USA.
*
*/
import Timer from "timer";
import DotStar from "dotstar";
import Poco from "commodetto/Poco";
import parseBMP from "commodetto/parseBMP";
import Resource from "Resource";
let lights = parseBMP(new Resource("lights-color.bmp"));
const width = lights.width, height = 1;
let display = new DotStar({width, height});
let render = new Poco(display);
let y = 0;
Timer.repeat(() => {
y += 1;
if ((y + height) > lights.height)
y = 0;
render.begin(0, 0, width, height);
render.drawBitmap(lights, 0, 0, 0, y, width, height);
render.end();
}, 20);