Home Reference Source
public class | source

BodySprite

Extends:

Initializer → BodySprite

Sets the body property to be a THREE.Sprite on initialized particles.

NOTE The texture map MUST be set on the SpriteMaterial in the TextureLoader.load callback. Not doing so will cause WebGL buffer errors.

Static Method Summary

Static Public Methods
public static

fromJSON(json: object, THREE: object): BodySprite

Creates a BodySprite initializer from JSON.

Constructor Summary

Public Constructor
public

constructor(THREE: object, texture: string, materialProperties: object): *

Constructs a BodySprite initializer.

Member Summary

Public Members
public

material: SpriteMaterial

THREE.SpriteMaterial instance.

public

The material properties for this object's SpriteMaterial NOTE This is required for testing purposes

public

sprite: Sprite

THREE.Sprite instance.

public

The texture for the THREE.SpriteMaterial map.

Method Summary

Public Methods
public

initialize(particle: Particle): *

Sets the particle body to the sprite.

Inherited Summary

From class Initializer
public static abstract

Returns a new instance of the initializer from the JSON object passed.

public static

Determines if the initializer requires a Web GL API to be provided to its constructor.

public
public

type: *

public

init(emitter: Emitter, particle: Particle): *

Initializes the property on the emitter or particle.

public abstract

initialize(target: object)

Place custom property initialization code in this method in the subclass.

public abstract

reset()

Static Public Methods

public static fromJSON(json: object, THREE: object): BodySprite source

Creates a BodySprite initializer from JSON.

Override:

Initializer#fromJSON

Params:

NameTypeAttributeDescription
json object

The JSON to construct the instance from

THREE object

The Web GL API we are using eg., THREE

json.texture string

The sprite texture

json.materialProperties object

The sprite material properties

Return:

BodySprite

Public Constructors

public constructor(THREE: object, texture: string, materialProperties: object): * source

Constructs a BodySprite initializer.

Override:

Initializer#constructor

Params:

NameTypeAttributeDescription
THREE object

The Web GL API we are using eg., THREE

texture string

The sprite texture

materialProperties object

The sprite material properties

Return:

*

void

Throw:

Error

If the TextureLoader fails to load the supplied texture

Public Members

public material: SpriteMaterial source

THREE.SpriteMaterial instance.

public materialProperties: object source

The material properties for this object's SpriteMaterial NOTE This is required for testing purposes

public sprite: Sprite source

THREE.Sprite instance.

public texture: Texture source

The texture for the THREE.SpriteMaterial map.

Public Methods

public initialize(particle: Particle): * source

Sets the particle body to the sprite.

Override:

Initializer#initialize

Params:

NameTypeAttributeDescription
particle Particle

The particle to set the body of

Return:

*

void