Menu

Class Html5Canvas

Flipnote renderer for the HTML5 2D canvas API

Hierarchy

  • Html5Canvas

Implements

  • CanvasInterface

Index

Constructors

constructor

Properties

canvas

canvas: HTMLCanvasElement

Canvas HTML element being used as a rendering surface

ctx

ctx: CanvasRenderingContext2D

Rendering context

dstHeight

dstHeight: number

Backing canvas height (real pixels) Note that this factors in device pixel ratio, so it may not reflect the size of the canvas in CSS pixels

dstWidth

dstWidth: number

Backing canvas width (real pixels) Note that this factors in device pixel ratio, so it may not reflect the size of the canvas in CSS pixels

frameIndex

frameIndex: number

height

height: number

View height (CSS pixels)

note

srcHeight

srcHeight: number

srcWidth

srcWidth: number

stereoscopeMode

stereoscopeMode: CanvasStereoscopicMode = CanvasStereoscopicMode.None

stereoscopeStrength

stereoscopeStrength: number = 0

supportedStereoscopeModes

supportedStereoscopeModes: CanvasStereoscopicMode[] = [CanvasStereoscopicMode.None]

width

width: number

View width (CSS pixels)

Methods

clear

  • clear(color?: [number, number, number, number]): void
  • Clear the canvas

    Parameters

    • Optional color: [number, number, number, number]

      optional RGBA color to use as a background color

    Returns void

destroy

  • destroy(): void

drawFrame

  • drawFrame(frameIndex: number): void

forceUpdate

  • forceUpdate(): void

getBlob

  • getBlob(type?: string, quality?: any): Promise<Blob>

getDataUrl

  • getDataUrl(type?: string, quality?: any): string

requestStereoScopeMode

setCanvasSize

  • setCanvasSize(width: number, height: number): void
  • Resize the canvas surface

    Parameters

    • width: number

      New canvas width, in CSS pixels

    • height: number

      New canvas height, in CSS pixels

      The ratio between width and height should be 3:4 for best results

    Returns void

setNote

Static isSupported

  • isSupported(): boolean

Object literals

Static defaultOptions

defaultOptions: object

useDpi

useDpi: true = true

useSmoothing

useSmoothing: true = true