Added pingpongReverse to SequenceTimeline.

This commit is contained in:
Nathan Sweet 2021-12-13 15:07:40 -04:00
parent 473862c67e
commit a898aed293

View File

@ -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);