mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Added pingpongReverse to SequenceTimeline.
This commit is contained in:
parent
473862c67e
commit
a898aed293
@ -2494,16 +2494,22 @@ public class Animation {
|
|||||||
case loop:
|
case loop:
|
||||||
index %= count;
|
index %= count;
|
||||||
break;
|
break;
|
||||||
case pingpong:
|
case pingpong: {
|
||||||
int n = (count << 1) - 2;
|
int n = (count << 1) - 2;
|
||||||
index %= n;
|
index %= n;
|
||||||
if (index >= count) index = n - index;
|
if (index >= count) index = n - index;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case onceReverse:
|
case onceReverse:
|
||||||
index = Math.max(count - 1 - index, 0);
|
index = Math.max(count - 1 - index, 0);
|
||||||
break;
|
break;
|
||||||
case loopReverse:
|
case loopReverse:
|
||||||
index = count - 1 - (index % count);
|
index = count - 1 - (index % count);
|
||||||
|
break;
|
||||||
|
case pingpongReverse:
|
||||||
|
int n = (count << 1) - 2;
|
||||||
|
index = (index + count - 1) % n;
|
||||||
|
if (index >= count) index = n - index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
slot.setSequenceIndex(index);
|
slot.setSequenceIndex(index);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user