mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ts] Default parameters for AnimationState.
This commit is contained in:
parent
7800918ea4
commit
e03fa1d5d3
@ -506,7 +506,7 @@ module spine {
|
|||||||
/** Sets an animation by name.
|
/** Sets an animation by name.
|
||||||
*
|
*
|
||||||
* See {@link #setAnimationWith()}. */
|
* See {@link #setAnimationWith()}. */
|
||||||
setAnimation (trackIndex: number, animationName: string, loop: boolean) {
|
setAnimation (trackIndex: number, animationName: string, loop: boolean = false) {
|
||||||
let animation = this.data.skeletonData.findAnimation(animationName);
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
||||||
if (!animation) throw new Error("Animation not found: " + animationName);
|
if (!animation) throw new Error("Animation not found: " + animationName);
|
||||||
return this.setAnimationWith(trackIndex, animation, loop);
|
return this.setAnimationWith(trackIndex, animation, loop);
|
||||||
@ -518,7 +518,7 @@ module spine {
|
|||||||
* duration. In either case {@link TrackEntry#trackEnd} determines when the track is cleared.
|
* duration. In either case {@link TrackEntry#trackEnd} determines when the track is cleared.
|
||||||
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
||||||
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
||||||
setAnimationWith (trackIndex: number, animation: Animation, loop: boolean) {
|
setAnimationWith (trackIndex: number, animation: Animation, loop: boolean = false) {
|
||||||
if (!animation) throw new Error("animation cannot be null.");
|
if (!animation) throw new Error("animation cannot be null.");
|
||||||
let interrupt = true;
|
let interrupt = true;
|
||||||
let current = this.expandToIndex(trackIndex);
|
let current = this.expandToIndex(trackIndex);
|
||||||
@ -543,7 +543,7 @@ module spine {
|
|||||||
/** Queues an animation by name.
|
/** Queues an animation by name.
|
||||||
*
|
*
|
||||||
* See {@link #addAnimationWith()}. */
|
* See {@link #addAnimationWith()}. */
|
||||||
addAnimation (trackIndex: number, animationName: string, loop: boolean, delay: number) {
|
addAnimation (trackIndex: number, animationName: string, loop: boolean = false, delay: number = 0) {
|
||||||
let animation = this.data.skeletonData.findAnimation(animationName);
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
||||||
if (!animation) throw new Error("Animation not found: " + animationName);
|
if (!animation) throw new Error("Animation not found: " + animationName);
|
||||||
return this.addAnimationWith(trackIndex, animation, loop, delay);
|
return this.addAnimationWith(trackIndex, animation, loop, delay);
|
||||||
@ -557,7 +557,7 @@ module spine {
|
|||||||
* previous entry is looping, its next loop completion is used instead of its duration.
|
* previous entry is looping, its next loop completion is used instead of its duration.
|
||||||
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
||||||
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
||||||
addAnimationWith (trackIndex: number, animation: Animation, loop: boolean, delay: number) {
|
addAnimationWith (trackIndex: number, animation: Animation, loop: boolean = false, delay: number = 0) {
|
||||||
if (!animation) throw new Error("animation cannot be null.");
|
if (!animation) throw new Error("animation cannot be null.");
|
||||||
|
|
||||||
let last = this.expandToIndex(trackIndex);
|
let last = this.expandToIndex(trackIndex);
|
||||||
@ -595,7 +595,7 @@ module spine {
|
|||||||
* {@link TrackEntry#setMixDuration()}. Mixing from an empty animation causes the new animation to be applied more and
|
* {@link TrackEntry#setMixDuration()}. Mixing from an empty animation causes the new animation to be applied more and
|
||||||
* more over the mix duration. Properties keyed in the new animation transition from the value from lower tracks or from the
|
* more over the mix duration. Properties keyed in the new animation transition from the value from lower tracks or from the
|
||||||
* setup pose value if no lower tracks key the property to the value keyed in the new animation. */
|
* setup pose value if no lower tracks key the property to the value keyed in the new animation. */
|
||||||
setEmptyAnimation (trackIndex: number, mixDuration: number) {
|
setEmptyAnimation (trackIndex: number, mixDuration: number = 0) {
|
||||||
let entry = this.setAnimationWith(trackIndex, AnimationState.emptyAnimation(), false);
|
let entry = this.setAnimationWith(trackIndex, AnimationState.emptyAnimation(), false);
|
||||||
entry.mixDuration = mixDuration;
|
entry.mixDuration = mixDuration;
|
||||||
entry.trackEnd = mixDuration;
|
entry.trackEnd = mixDuration;
|
||||||
@ -613,7 +613,7 @@ module spine {
|
|||||||
* loop completion is used instead of its duration.
|
* loop completion is used instead of its duration.
|
||||||
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
||||||
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
||||||
addEmptyAnimation (trackIndex: number, mixDuration: number, delay: number) {
|
addEmptyAnimation (trackIndex: number, mixDuration: number = 0, delay: number = 0) {
|
||||||
let entry = this.addAnimationWith(trackIndex, AnimationState.emptyAnimation(), false, delay <= 0 ? 1 : delay);
|
let entry = this.addAnimationWith(trackIndex, AnimationState.emptyAnimation(), false, delay <= 0 ? 1 : delay);
|
||||||
entry.mixDuration = mixDuration;
|
entry.mixDuration = mixDuration;
|
||||||
entry.trackEnd = mixDuration;
|
entry.trackEnd = mixDuration;
|
||||||
@ -623,7 +623,7 @@ module spine {
|
|||||||
|
|
||||||
/** Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix
|
/** Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix
|
||||||
* duration. */
|
* duration. */
|
||||||
setEmptyAnimations (mixDuration: number) {
|
setEmptyAnimations (mixDuration: number = 0) {
|
||||||
let oldDrainDisabled = this.queue.drainDisabled;
|
let oldDrainDisabled = this.queue.drainDisabled;
|
||||||
this.queue.drainDisabled = true;
|
this.queue.drainDisabled = true;
|
||||||
for (let i = 0, n = this.tracks.length; i < n; i++) {
|
for (let i = 0, n = this.tracks.length; i < n; i++) {
|
||||||
|
|||||||
@ -124,7 +124,7 @@ module spine {
|
|||||||
this.r = parseInt(hex.substr(0, 2), 16) / 255;
|
this.r = parseInt(hex.substr(0, 2), 16) / 255;
|
||||||
this.g = parseInt(hex.substr(2, 2), 16) / 255;
|
this.g = parseInt(hex.substr(2, 2), 16) / 255;
|
||||||
this.b = parseInt(hex.substr(4, 2), 16) / 255;
|
this.b = parseInt(hex.substr(4, 2), 16) / 255;
|
||||||
this.a = (hex.length != 8 ? 1 : parseInt(hex.substr(6, 2), 16) / 255);
|
this.a = hex.length != 8 ? 1 : parseInt(hex.substr(6, 2), 16) / 255;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user