LoopingImage

LoopingImage

Controls the repeated drawing of an image onto an html canvas. Extends the CanvasObject class.


Constructor

new LoopingImage(canvas, width, height)

Parameters:
Name Type Description
canvas HTMLCanvasElement
width Number
height Number

Members

constructor

fRect

A Rectangle defining where to draw from.

tPoint

A MoverPoint defining where in the canvas to draw to.

Methods

loopHorizontal(imgToLoop, w, h, incer)

Loop the draw of an image horizontally. Useful for creating scrolling backgrounds. This method should be called during a requestAnimationFrame loop.

Parameters:
Name Type Description
imgToLoop Image

The image to draw and loop horizontally.

w Number

The width of the image

h Number

The height of the image

incer Number

Optional amount to increment by, default is 1.