Class: Avatar
Defined in: | src/avatar.coffee |
Overview
A simple model class providing convenience methods for working with avatars.
Instance Method Summary
- - (void) constructor(client, attributes) Constructor Create a new Avatar.
- - (void) representation(representation, notify = true) Sets and gets the avatar's representation.
- - (void) clear() Clear and initialise the avatar's current ensemble.
- - (void) build(ensemble) Equip some or all of an avatar's categories with assets.
- - (Object) equip(category, asset, colours = null) Equip an asset to a category.
- - (Object) equipped(category) Get the asset equipped to the given category.
- - (Object) ensemble() Get the complete ensemble equipped to the avatar.
- - (void) colour1(colour, category) Get and set colour1 globally or by category.
- - (void) colour2(colour, category) Get and set colour2 globally or by category.
- - (void) colourEnsemble(palette) Set colours on the given categories.
- - (String) imageUrl(options = {}) Get the url for a rendered image of the avatar.
- - (Object) save() Save the avatar to remote storage.
- - (Object) delete() Delete the avatar from remote storage.
- - (Array<Object>) assetList() Get a list of assets equipped to the avatar.
- - (void) metadata(key = null, value) Get and set metadata on the avatar.
Constructor Details
- (void) constructor(client, attributes)
Create a new Avatar.
Avatars should normally be created by Totem, using Totem#avatar or by retrieval using Totem#avatars.
Instance Method Details
- (void) representation(representation)
Sets and gets the avatar's representation.
@param [String] representation
The representation to set @param [Boolean] notify
Whether to notify observers to the "representationChange"
event. Defaults to true
@return [String]
The representation currently set
@overload representation() Gets the representation currently set.
@return [String] The representation currently set
- (void) clear()
Clear and initialise the avatar's current ensemble.
- (void) build(ensemble)
Equip some or all of an avatar's categories with assets.
Notifies observers to the "build" event.
Data sent with the event is avatar:<Avatar>
.
- (Object) equip(category, asset, colours = null)
Equip an asset to a category.
Notifies observers to the "equip" event.
Data sent with the event is avatar:<Avatar>, category:<String>
.
- (Object) equipped(category)
Get the asset equipped to the given category.
- (Object) ensemble()
Get the complete ensemble equipped to the avatar.
- (void) colour1(colour)
- (void) colour1(colour, category)
Get and set colour1 globally or by category.
- (void) colour2(colour)
- (void) colour2(colour, category)
Get and set colour2 globally or by category.
- (void) colourEnsemble(palette)
Set colours on the given categories.
Notifies observers of the "colourEnsemble" event.
Data sent with the event is avatar:<Avatar>
.
- (String) imageUrl(options = {})
Get the url for a rendered image of the avatar.
- (Object) save()
Save the avatar to remote storage.
- (Object) delete()
Delete the avatar from remote storage.
- (Array<Object>) assetList()
Get a list of assets equipped to the avatar.
- (Object) metadata()
- (Object) metadata(key)
- (Object) metadata(metadata)
- (Object) metadata(key, value)
Get and set metadata on the avatar.