Decal

Decal

new Decal(texture, dataopt)

Source:

Create an instance of Decal

Example
// creates a decal
const { Decal } = require('lucid-dream');
const decal = new Decal('foo', {
  x: 20,
  y: 100,
  scaleX: 1,
  scaleY: 1
});
Parameters:
Name Type Attributes Default Description
texture String

The texture name to be used for this decal.

data Object <optional>
{}

An object containing the attributes of the decal.

Properties
Name Type Attributes Default Description
x Number <optional>
0

The x position of the decal.

y Number <optional>
0

The y position of the decal.

scaleX Number <optional>
1

The x scale of the decal.

scaleY Number <optional>
1

The y scale of the decal.

Methods

toDict() → {Object}

Source:

Encode a decal into a dictionary

Example
// returns encoded decal dictionary
const { Decal } = require('lucid-dream');
const decal = new Decal('foo', {
  x: 20,
  y: 100,
  scaleX: 1,
  scaleY: 1
});
decal.toDict();
Returns:

An object containing the encoded decal dicitonary

Type
Object