Skip to content

Instantly share code, notes, and snippets.

@starakaj
Created April 16, 2021 11:38
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 starakaj/2549b703f87341023a15da78d617c0af to your computer and use it in GitHub Desktop.
Save starakaj/2549b703f87341023a15da78d617c0af to your computer and use it in GitHub Desktop.
const makePaintFunction = template(`
mgraphics.relative_coords = 1;
function calcAspect() {
var width = this.box.rect[2] - this.box.rect[0];
var height = this.box.rect[3] - this.box.rect[1];
return width/height;
}
function paint() {
const aspect = calcAspect();
%%statements%%
}
`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment