Skip to content

Visualize Your Ideas With Code

fix(2d): add curve completion for videos (#1117)

Jacob445bda03a7c9
diff --git a/packages/2d/src/lib/components/Video.ts b/packages/2d/src/lib/components/Video.ts
index 32536d84..4946ccb8 100644
--- a/packages/2d/src/lib/components/Video.ts
+++ b/packages/2d/src/lib/components/Video.ts
@@ -123,6 +123,13 @@ export class Video extends Rect {
}
}
+ /**
+ * {@inheritDoc Curve.completion}
+ */
+ public curveCompletion(): number {
+ return super.completion();
+ }
+
public isPlaying(): boolean {
return this.playing();
}
@@ -148,6 +155,13 @@ export class Video extends Rect {
return custom;
}
+ /**
+ * The completion of this video in the range from 0 to 1.
+ *
+ * @remarks
+ * To get the percentage of the stroke that's currently visible, use
+ * {@link Video.curveCompletion} instead.
+ */
@computed()
public override completion(): number {
return this.clampTime(this.time()) / this.video().duration;