General
Load Image
The loadImage
function downloads an image from a provided URL and returns the src.
Info
The loadImage
function is already implemented into all classes from PizzaJS.
Parameters | Type | Description | Default Value |
---|---|---|---|
name | string |
A name attached to the url accesible via image[name] | - |
url | string |
The URL pointing to the image file to be downloaded and used. | - |
Example
Load Sound
The loadSound
function downloads a sound from a provided URL and returns the src.
Info
The loadSound
function is already implemented into the sound's classes from PizzaJS.
Parameters | Type | Description | Default Value |
---|---|---|---|
url | string |
The URL pointing to the sound file to be downloaded and used. | - |
Clear
The clear
function erases all things from the canvas.
Additionaly it broadcast an event after clearing pjsAfterClear
, meant for addons
Fill Rect
The fillRect
function draws a filled rect with the specified parameters.
Parameters | Type | Description | Default Value |
---|---|---|---|
x | number |
the x position for the rect | 0 |
y | number |
the y position for the rect | 0 |
width | number |
the width of the rect | 0 |
height | number |
the height of the rect | 0 |
Example
Shake Screen
The shakeScreen
function shakes the screen with a duration and time specified.
Parameters | Type | Description | Default Value |
---|---|---|---|
intensity | number |
The intensity of the shake. | - |
duration | number |
Duration in ms. | - |