Created
January 10, 2020 08:11
-
-
Save rozek/d242ab7b13a0ab6cab96d0702d7f18ef to your computer and use it in GitHub Desktop.
Bangle.js: uses an image to draw a pattern
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
Bangle.setLCDMode(); | |
g.clear(); | |
const Width = g.getWidth(), CenterX = Width/2; | |
const Height = g.getHeight(), CenterY = Height/2; | |
let Pattern = { | |
width:16, height:16, bpp:16, transparent:0, | |
buffer:require("heatshrink").decompress(atob("s2EAIsVooVTDpIBDDrohHDrIBDDrohRJ4IhbR4ohXZ5IhTd5ohRDpapVDpYhXdtohPDp7LNDqYhJDq4hFCo4")) | |
}; | |
let PatternWidth = Pattern.width; | |
let PatternHeight = Pattern.height; | |
for (let x = 0; x < Width; x += PatternWidth) { | |
for (let y = 0; y < Height; y += PatternHeight) { | |
g.drawImage(Pattern, x,y); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment