CustomPropertyAnimation
Description​
Ce composant crée une animation sur une entité.
Propriétés​
Propriété | Type | Défaut | Description |
---|---|---|---|
attribut | chaîne de caractères | '' | Attribut sélectionné à animer (par exemple, position, échelle, matériau) |
propriété | chaîne de caractères | '' | Propriété individuelle à animer (par exemple x, y ou z pour un attribut vectoriel) |
cible | eid | indéfini | L'objet cible à animer. Si elle n'est pas spécifiée, l'animation est exécutée sur l'objet auquel le composant est attaché. |
de | objet | indéfini | L'état de départ de l'animation |
à | objet | indéfini | L'état final de l'animation |
autoFrom | booléen | faux | Si cette option est activée, la propriété "from" est ignorée et l'animation se fait à partir de l'état de l'objet au début de l'animation. |
durée | nombre | 0 | Durée de l'animation en millisecondes. |
boucle | booléen | faux | Si cette option est activée, l'animation est répétée. |
inverser | booléen | faux | Indique si la lecture doit se faire en sens inverse, si la boucle est réglée. |
easeIn | booléen | faux | Si cette option est activée, la fonction d'assouplissement sera appliquée dans le temps au lieu d'une interpolation directe. |
facilitéSortie | booléen | faux | Si cette option est activée, la fonction d'assouplissement sera appliquée dans le temps au lieu d'une interpolation directe. |
easingFunction | chaîne de caractères | '' | Choisissez parmi les options suivantes : quadratique (par défaut), cubique, quartique, quintique, sinuso ïdale, exponentielle, circulaire, élastique, retour et rebond. |
Fonctions​
Get​
Returns a read-only reference.
Example
ecs.CustomPropertyAnimation.get(world, component.eid)
Set​
Ensures the component exists on the entity, then assigns the (optional) data to the component.
Example
ecs.CustomPropertyAnimation.set(world, component.eid, {
attribute: 'attribut',
propriété: 'propriété',
from: {
x: 0,
y: 0,
z: 0
},
to: {
x: 10,
y: 10,
z: 10
},
autoFrom: false,
duration: 1000,
loop: false,
reverse: false,
easeIn: false,
easeOut: false,
easingFunction: 'Cubic'
})
Mutate​
Perform an update to the component within a callback function. Return true
to indicate no changes made.
Example
ecs.CustomPropertyAnimation.mutate(world, component.eid, (cursor) => {
cursor.duration = 1000 ;
cursor.loop = true ;
return false;
})
Remove​
Removes the component from the entity.
Example
ecs.CustomPropertyAnimation.remove(world, component.eid)
Has​
Returns true
if the component is present on the entity.
Example
ecs.CustomPropertyAnimation.has(world, component.eid)
Reset​
Adds, or resets the component to its default state.
Example
ecs.CustomPropertyAnimation.reset(world, component.eid)
Advanced Functions​
Cursor​
Returns a mutable reference. Cursors are reused so only one cursor for each component can exist at a time.
Example
ecs.CustomPropertyAnimation.cursor(world, component.eid)
Acquire​
Same behavior as cursor, but commit must be called after the cursor is done being used.
Example
ecs.CustomPropertyAnimation.acquire(world, component.eid)
Commit​
Called after acquire. An optional third argument determines whether the cursor was mutated or not.
Example
ecs.CustomPropertyAnimation.commit(world, component.eid)
ecs.CustomPropertyAnimation.commit(world, component.eid, false)
Dirty​
Mark the entity as having been mutated. Only needed in a specific case where systems are mutating data.
Example
ecs.CustomPropertyAnimation.dirty(world, component.eid)