Skip to content

Instantly share code, notes, and snippets.

@rozek
Created January 10, 2020 08:11
Show Gist options
  • Save rozek/d242ab7b13a0ab6cab96d0702d7f18ef to your computer and use it in GitHub Desktop.
Save rozek/d242ab7b13a0ab6cab96d0702d7f18ef to your computer and use it in GitHub Desktop.
Bangle.js: uses an image to draw a pattern
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