RLottie: Fix segment animation (#2985)
This commit is contained in:
parent
0070dfa941
commit
aaca95737c
@ -190,7 +190,7 @@ const AnimatedSticker: FC<OwnProps> = ({
|
||||
}
|
||||
|
||||
if (playSegmentRef.current) {
|
||||
animation.playSegment(playSegmentRef.current);
|
||||
animation.playSegment(playSegmentRef.current, viewId);
|
||||
} else {
|
||||
animation.play(shouldRestart, viewId);
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ class RLottie {
|
||||
private tgsUrl: string,
|
||||
private container: HTMLDivElement | HTMLCanvasElement,
|
||||
private renderId: string,
|
||||
private viewId: string = generateIdFor(ID_STORE, true),
|
||||
viewId: string = generateIdFor(ID_STORE, true),
|
||||
private params: Params = {},
|
||||
private customColor?: [number, number, number],
|
||||
private onLoad?: NoneToVoidFunction | undefined,
|
||||
@ -197,10 +197,14 @@ class RLottie {
|
||||
}
|
||||
}
|
||||
|
||||
playSegment([startFrameIndex, stopFrameIndex]: [number, number]) {
|
||||
playSegment([startFrameIndex, stopFrameIndex]: [number, number], viewId?: string) {
|
||||
if (viewId) {
|
||||
this.views.get(viewId)!.isPaused = false;
|
||||
}
|
||||
this.approxFrameIndex = Math.floor(startFrameIndex / this.reduceFactor);
|
||||
this.stopFrameIndex = Math.floor(stopFrameIndex / this.reduceFactor);
|
||||
this.direction = startFrameIndex < stopFrameIndex ? 1 : -1;
|
||||
|
||||
this.doPlay();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user