BenutzerdefinierteVec3Animation
Beschreibung
Diese Komponente erstellt eine Animation für ein Objekt.
Eigenschaften
Eigentum | Typ | Standard | Beschreibung |
---|---|---|---|
Attribut | String | '' | Ausgewähltes Attribut, das animiert werden soll (z. B. Position, Maßstab, Material) |
Ziel | eid | undefiniert | Das Zielobjekt, das animiert werden soll. Wenn nicht angegeben, wird die Animation auf dem Objekt ausgeführt, an das die Komponente angehängt ist. |
von | Objekt | undefiniert | Der Ausgangszustand der Animation |
zu | Objekt | undefiniert | Der Endzustand der Animation |
autoFrom | boolean | falsch | Wenn aktiviert, wird die Eigenschaft "von" ignoriert und die Animation beginnt mit dem Zustand des Objekts zu Beginn der Animation. |
Dauer | Nummer | 0 | Die Dauer der Animation in Millisekunden. |
Schleife | boolean | falsch | Wenn aktiviert, wird die Animation wiederholt. |
umkehren | boolean | falsch | Ob rückwärts abgespielt werden soll, wenn Schleife eingestellt ist. |
easeIn | boolean | falsch | Wenn diese Funktion aktiviert ist, wird anstelle einer geraden Interpolation eine zeitliche Staffelung vorgenommen. |
easeOut | boolean | falsch | Wenn diese Funktion aktiviert ist, wird anstelle einer geraden Interpolation eine zeitliche Staffelung vorgenommen. |
easingFunction | String | '' | Wählen Sie zwischen quadratisch (Standard), kubisch, quartisch, quintisch, sinusförmig, exponentiell, kreisförmig, elastisch, zurück und prellen. |
Get
Returns a read-only reference.
Example
ecs.CustomVec3Animation.get(world, component.eid)
Set
Ensures the component exists on the entity, then assigns the (optional) data to the component.
Example
ecs.CustomVec3Animation.set(world, component.eid, {
attribute: 'position',
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.CustomVec3Animation.mutate(world, component.eid, (cursor) => {
cursor.duration = 1000;
cursor.loop = true;
return false;
})
Remove
Removes the component from the entity.
Example
ecs.CustomVec3Animation.remove(world, component.eid)
Has
Returns true
if the component is present on the entity.
Example
ecs.CustomVec3Animation.has(world, component.eid)