UNPKG

comic-bubbles

Version:

Animated comic bubbles - what else?

22 lines (19 loc) 557 B
import { Font } from "./font.mjs" import { Margin } from "./margin.mjs" import { Bounds } from "./bounds.mjs" export class Char { constructor(parent) { this.canvas = document.createElement('canvas') this.name = undefined this.font = new Font(this) this.margin = new Margin(this) this.bounds = new Bounds(this) this.parent = parent } getPrefStr() { return this.parent === undefined ? 'char' : this.parent.getPrefStr() + '.char' } ctx() { return this.canvas.getContext('2d') } }