@markdy/renderer-dom 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -8
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -639,6 +639,7 @@ function buildAction(ev, el, s, baseOpts, delayMs, durMs, ast, states, scene, as
|
|
|
639
639
|
function createPlayer(opts) {
|
|
640
640
|
const { container, code, assets: assetOverrides = {}, autoplay = true, loop = true, copyright = true, progressBar = true } = opts;
|
|
641
641
|
const ast = parse(code);
|
|
642
|
+
const totalDurationMs = (ast.meta.duration ?? 0) * 1e3;
|
|
642
643
|
const viewport = document.createElement("div");
|
|
643
644
|
Object.assign(viewport.style, {
|
|
644
645
|
position: "relative",
|
|
@@ -776,12 +777,11 @@ function createPlayer(opts) {
|
|
|
776
777
|
sceneMs += timestamp - lastRafTs;
|
|
777
778
|
}
|
|
778
779
|
lastRafTs = timestamp;
|
|
779
|
-
|
|
780
|
-
if (totalMs > 0 && sceneMs >= totalMs) {
|
|
780
|
+
if (totalDurationMs > 0 && sceneMs >= totalDurationMs) {
|
|
781
781
|
if (loop) {
|
|
782
|
-
sceneMs = sceneMs %
|
|
782
|
+
sceneMs = sceneMs % totalDurationMs;
|
|
783
783
|
} else {
|
|
784
|
-
sceneMs =
|
|
784
|
+
sceneMs = totalDurationMs;
|
|
785
785
|
applyCurrentTime();
|
|
786
786
|
isPlaying = false;
|
|
787
787
|
lastRafTs = null;
|
|
@@ -790,8 +790,7 @@ function createPlayer(opts) {
|
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
792
|
applyCurrentTime();
|
|
793
|
-
|
|
794
|
-
if (totalMsP > 0) updateProgressBar(sceneMs / totalMsP);
|
|
793
|
+
if (totalDurationMs > 0) updateProgressBar(sceneMs / totalDurationMs);
|
|
795
794
|
rafId = requestAnimationFrame(rafTick);
|
|
796
795
|
}
|
|
797
796
|
const player = {
|
|
@@ -813,8 +812,7 @@ function createPlayer(opts) {
|
|
|
813
812
|
seek(seconds) {
|
|
814
813
|
sceneMs = seconds * 1e3;
|
|
815
814
|
applyCurrentTime();
|
|
816
|
-
|
|
817
|
-
if (totalMsS > 0) updateProgressBar(sceneMs / totalMsS);
|
|
815
|
+
if (totalDurationMs > 0) updateProgressBar(sceneMs / totalDurationMs);
|
|
818
816
|
},
|
|
819
817
|
destroy() {
|
|
820
818
|
player.pause();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markdy/renderer-dom",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "Web Animations API renderer for MarkdyScript scenes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@markdy/core": "0.5.
|
|
46
|
+
"@markdy/core": "0.5.6"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"tsup": "^8.5.1",
|