ImageAsset
@physion/app / Exports / ImageAsset
Class: ImageAsset
Serves as the base class for most classes in Physion.
CoreObject itself extends EventEmitter to allow notifying the outside world on important events.
Hierarchy
↳
ImageAsset
Constructors
constructor
• new ImageAsset(url?
): ImageAsset
Parameters
Name | Type | Default value |
---|---|---|
url | string | "" |
Returns
Inherited from
Properties
EVT_NAME_CHANGED
▪ Static
Readonly
EVT_NAME_CHANGED: "nameChanged"
The name of the event that is emitted whenever the name of this object changes.
The argument suplied is the new CoreObject.name of the object.
Inherited from
EVT_PROPERTY_CHANGED
▪ Static
Readonly
EVT_PROPERTY_CHANGED: "propertyChanged"
The name of the event that is emitted whenever a property of this object changes.
The arguments supplied are: (1) The name of the property that has changed and (2) the new value of that property.
Inherited from
EVT_UPDATED
▪ Static
Readonly
EVT_UPDATED: "updated"
Inherited from
Accessors
flags
• get
flags(): CoreObjectFlags
Returns
CoreObjectFlags
Inherited from
WebAsset.flags
id
• get
id(): string
Object's (unique) id
Note that the id of the object cannot be set (it is automatically assigned upon construction)
Returns
string
Inherited from
WebAsset.id
metaObject
• get
metaObject(): undefined
| MetaObject
Returns the MetaObject that describes this class
Returns
undefined
| MetaObject
Inherited from
WebAsset.metaObject
name
• get
name(): string
The object's name
The object's name is a free text value which defaults to an empty string.
Note that when the name of the object changes, the CoreObject.EVT_NAME_CHANGED signal will be emitted.
Returns
string
Inherited from
WebAsset.name
• set
name(v
): void
Parameters
Name | Type |
---|---|
v | string |
Returns
void
Inherited from
WebAsset.name
url
• get
url(): string
Returns
string
Inherited from
WebAsset.url
• set
url(v
): void
Parameters
Name | Type |
---|---|
v | string |
Returns
void
Inherited from
WebAsset.url
Methods
deserialize
▸ deserialize(d
): void
Parameters
Name | Type |
---|---|
d | any |
Returns
void
Inherited from
getExtras
▸ getExtras(): any
Returns any extra data that this object needs to save during serialization.
In some cases an object might need to save some extra data without necessarily this extra data being part of its state (e.g. the AssetsLibrary of a Scene). In these cases subclasses can re-implement this method and return the data required.
The default implementation returns undefined
meaning that no extra data
needs to be saved during serialization.
Returns
any
Inherited from
getState
▸ getState(minified?
): any
Returns this object's state
The object's state is an object containing key/value pairs corresponding to this object's properties. For example:
{
id: "Ssba4ch5ruok",
name: "Circle",
radius: 2,
// ...
}
To avoid including properties that are currently in their default value you can set minified = true when calling getState.
Note that read-only properties are not part of the object's state (with the exception of the id)
Parameters
Name | Type | Default value | Description |
---|---|---|---|
minified | boolean | false | Whether to return a minified state or not |
Returns
any
Inherited from
getType
▸ getType(): AssetType
Returns
AssetType
Overrides
serialize
▸ serialize(): Object
Returns
Object
Name | Type |
---|---|
id | string |
name | string |
type | AssetType |
url | string |
Inherited from
setExtras
▸ setExtras(_x
): boolean
Sets any extra data that this object needs during de-serialization.
Returns true on success, otherwise returns false.
The default implementation does nothing and returns true.
Parameters
Name | Type |
---|---|
_x | any |
Returns
boolean
Inherited from
setFlag
▸ setFlag(flag
, on?
): void
Parameters
Name | Type | Default value |
---|---|---|
flag | CoreObjectFlags | undefined |
on | boolean | true |
Returns
void
Inherited from
setState
▸ setState(state
, updateId?
): boolean
Sets the object's state
Parameters
Name | Type | Default value | Description |
---|---|---|---|
state | any | undefined | The state to be set |
updateId | boolean | true | Whether to also update the id property |
Returns
boolean
True on success otherwise false
Inherited from
testFlag
▸ testFlag(flag
): boolean
Parameters
Name | Type |
---|---|
flag | CoreObjectFlags |
Returns
boolean