Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SpriteStreamComponent

Class SpriteTextureComponent extends TextureComponent and override main method drawComponent. We need to keep tiles system working! Objective: Store and manipulate with image texture data. Render element - Tile, flip void ctx.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight); JavaScript syntax: context.drawImage(img,sx,sy,swidth,sheight,x,y,width,height); Parameter Values Parameter Description Play it img Specifies the image, canvas, or video element to use sx Optional. The x coordinate where to start clipping sy Optional. The y coordinate where to start clipping swidth Optional. The width of the clipped image sheight Optional. The height of the clipped image x The x coordinate where to place the image on the canvas y The y coordinate where to place the image on the canvas width Optional. The width of the image to use (stretch or reduce the image) height Optional. The height of the image to use (stretch or reduce the image)

Hierarchy

Implements

Index

Constructors

constructor

Properties

assets

assets: Resources = new Resources()

Protected horizontalFlip

horizontalFlip: boolean = false

Protected horizontalTiles

horizontalTiles: number = 1

keepAspectRatio

keepAspectRatio: boolean = true

Protected seqFrameX

seqFrameX: Counter

Protected seqFrameY

seqFrameY: Counter

Protected shema

shema: object

Type declaration

  • byX: number
  • byY: number

streamTexture

streamTexture: any = null

Protected verticalFlip

verticalFlip: boolean = false

Protected verticalTiles

verticalTiles: number = 1

Methods

drawComponent

  • drawComponent(c: CanvasRenderingContext2D, part: any): void

Protected flipImage

  • flipImage(image: any, ctx: any, sx: any, sy: any, sw: any, sh: any, flipH: any, flipV: any): void

Private flipStream

  • flipStream(image: any, ctx: any, sx: any, sy: any, sw: any, sh: any, dx: any, dy: any, dw: any, dh: any, flipH: any, flipV: any): void

setHorizontalFlip

  • setHorizontalFlip(newStatus: boolean): void

setHorizontalTiles

  • setHorizontalTiles(newHorinzontalTiles: number): this

setNewShema

  • setNewShema(shema: any): void

setNewShemaByX

  • setNewShemaByX(byX: number): void

setNewShemaByY

  • setNewShemaByY(byY: number): void

setStreamTexture

  • setStreamTexture(streamTexture: HTMLVideoElement): void

setVerticalFlip

  • setVerticalFlip(newStatus: boolean): void

setVerticalTiles

  • setVerticalTiles(newVerticalTiles: number): this

Generated using TypeDoc