trim method
dynamic
trim(
- dynamic startTime,
- dynamic endTime
Implementation
trim(startTime, endTime) {
var times = this.times, nKeys = times.length;
var from = 0, to = nKeys - 1;
while (from != nKeys && times[from] < startTime) {
++from;
}
while (to != -1 && times[to] > endTime) {
--to;
}
++to; // inclusive -> exclusive bound
if (from != 0 || to != nKeys) {
// empty tracks are forbidden, so keep at least one keyframe
if (from >= to) {
to = Math.max(to, 1).toInt();
from = to - 1;
}
var stride = getValueSize();
this.times = AnimationUtils.arraySlice(times, from, to);
values = AnimationUtils.arraySlice(
values, (from * stride).toInt(), (to * stride).toInt());
}
return this;
}