0.0.17 • Published 5 years ago

tiny-canvas v0.0.17

Weekly downloads
3
License
MIT
Repository
-
Last release
5 years ago

tiny-canavs

tiny-canvas is a simple HTML canvas library for TypeScript/JavaScript.

Installation

yarn add tiny-canvas
# or
npm install tiny-canvas

Usage

Simple usage(Draw circle at cursor position).

import {
  TinyGame,
  CanvasRenderer,
  AnimationFrameRequestTicker,
  CanvasInputManager
} from 'tiny-canvas'

// Game class that extends TinyGame class
export class Game extends TinyGame {
  constructor(canvas: HTMLCanvasElement) {
    // TinyGame constructor (Renderer, InputManager, Ticker)
    super(
      new CanvasRenderer(canvas),
      new CanvasInputManager(canvas),
      new AnimationFrameRequestTicker()
    )
  }

  /**
   * Call on frame.
   */
  onFrame() {
    // Fill background.
    this.fillRect(this.leftTop, this.rightBottom, 'black')

    // Draw circle at cursor position.
    this.fillCircle(this.cursor, 32, 'white')
  }
}

Build

Build yarn build Watch build yarn dev

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.10

5 years ago

0.0.11

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.1

5 years ago

0.0.2

5 years ago

0.0.0

5 years ago