Class: Image

rat.graphics. Image

new Image()

Image Object
Source:

Methods

draw(ctxopt, frameNumopt, xopt, yopt, wopt, hopt, flagsopt, clipXopt, clipYopt, clipWidthopt, clipHeightopt)

Draw. This hides internals, like whether we're single-frame, sprite-sheet, multi-sheet, etc. IMPORTANT! This functionality is also extracted and rewritten in the particle system, for speed. Maybe not the best approach, since that has already broken at least once. As far as I can tell, it's to save one function call per draw. Anyway, if you change code here, you have to change it in the particle system, too. todo: Find some way to do macros instead of duplicating code?
Parameters:
Name Type Attributes Description
ctx Object <optional>
frameNum number <optional>
x number <optional>
y number <optional>
w number <optional>
h number <optional>
flags number <optional>
clipX number <optional>
clipY number <optional>
clipWidth number <optional>
clipHeight number <optional>
Source:

getImageFrame(frameNum, optionsopt)

get the image (raw html5 image) for this frame, if it exists and is ready to draw. otherwise return null Note: don't use this if you want spritesheets to work. This returns the raw image.
Parameters:
Name Type Attributes Description
frameNum number
options Object <optional>
Source: