- Source:
Stores all preloaded textures.
Methods
add(name, url) → {Promise}
- Source:
Adds and preloads new Texture element to the resources.
Example
// Example of use where app is an instance of Pixel.Stage
app.resources.add('name', 'image/path').then(function (resources) {
let sprite = new Pixel.Sprite(resources.name); // Automatically preloaded as a Pixel.Texture, pass through this
// ...
});
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name this element will refer to. |
url |
string | URL That image is loaded from. |
Returns:
- Type
- Promise