UNPKG

comic-bubbles

Version:

Animated comic bubbles - what else?

29 lines (23 loc) 749 B
import { Margin } from "./margin.mjs" import { Bounds } from "./bounds.mjs" export class AnimationContainer { constructor(parent) { this.canvas = document.createElement('canvas') this.margin = new Margin(this) this.bounds = new Bounds(this) this.parent = parent } ctx() { return this.canvas.getContext('2d') } getPrefStr() { return this.parent === undefined ? 'aniCon' : this.parent.getPrefStr() + '.aniCon' } calcBounds() { this.ctx().width = this.bounds.width this.ctx().height = this.bounds.height /* this.ctx().fillStyle = 'black' this.ctx().fillRect(0, 0, this.bounds.width, this.bounds.height) this.parent.ctx().drawImage(this.canvas, this.bounds.x, this.bounds.y) */ } }