@markdy/renderer-dom 0.5.2 → 0.5.4
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/README.md +4 -1
- package/dist/index.js +11 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -50,7 +50,10 @@ player.destroy(); // clean up DOM + cancel animations
|
|
|
50
50
|
| `container` | `HTMLElement` | *(required)* | DOM element to mount the scene into |
|
|
51
51
|
| `code` | `string` | *(required)* | MarkdyScript source code |
|
|
52
52
|
| `assets` | `Record<string, string>` | `{}` | Asset URL overrides (key = asset name) |
|
|
53
|
-
| `autoplay` | `boolean` | `
|
|
53
|
+
| `autoplay` | `boolean` | `true` | Start playing immediately |
|
|
54
|
+
| `loop` | `boolean` | `true` | Loop the animation when it reaches the end |
|
|
55
|
+
| `copyright` | `boolean` | `true` | Show a small "Powered by Markdy" badge below the animation |
|
|
56
|
+
| `progressBar` | `boolean` | `true` | Show a rainbow progress bar around the viewport border |
|
|
54
57
|
|
|
55
58
|
### `Player`
|
|
56
59
|
|
package/dist/index.js
CHANGED
|
@@ -659,11 +659,12 @@ function createPlayer(opts) {
|
|
|
659
659
|
});
|
|
660
660
|
viewport.appendChild(progressEl);
|
|
661
661
|
}
|
|
662
|
+
const tlAngle = (Math.atan2(-ast.meta.width / 2, ast.meta.height / 2) * 180 / Math.PI + 360) % 360;
|
|
662
663
|
function updateProgressBar(pct) {
|
|
663
664
|
if (!progressEl) return;
|
|
664
665
|
const deg = pct * 360;
|
|
665
666
|
const rainbow = "hsl(0,90%,60%), hsl(45,90%,55%), hsl(90,80%,50%), hsl(180,80%,50%), hsl(270,80%,55%), hsl(330,90%,60%)";
|
|
666
|
-
progressEl.style.background = `conic-gradient(from
|
|
667
|
+
progressEl.style.background = `conic-gradient(from ${tlAngle}deg, ${rainbow} ${deg}deg, transparent ${deg}deg)`;
|
|
667
668
|
progressEl.style.mask = `linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)`;
|
|
668
669
|
progressEl.style.webkitMask = progressEl.style.mask;
|
|
669
670
|
progressEl.style.maskComposite = "exclude";
|
|
@@ -686,7 +687,9 @@ function createPlayer(opts) {
|
|
|
686
687
|
textDecoration: "none",
|
|
687
688
|
padding: "3px 6px 0",
|
|
688
689
|
opacity: "0.7",
|
|
689
|
-
transition: "opacity 0.2s"
|
|
690
|
+
transition: "opacity 0.2s",
|
|
691
|
+
maxWidth: container.style.maxWidth || "100%",
|
|
692
|
+
width: "100%"
|
|
690
693
|
});
|
|
691
694
|
badge.addEventListener("mouseenter", () => {
|
|
692
695
|
badge.style.opacity = "1";
|
|
@@ -694,7 +697,11 @@ function createPlayer(opts) {
|
|
|
694
697
|
badge.addEventListener("mouseleave", () => {
|
|
695
698
|
badge.style.opacity = "0.7";
|
|
696
699
|
});
|
|
697
|
-
container.
|
|
700
|
+
if (container.parentNode) {
|
|
701
|
+
container.parentNode.insertBefore(badge, container.nextSibling);
|
|
702
|
+
} else {
|
|
703
|
+
container.appendChild(badge);
|
|
704
|
+
}
|
|
698
705
|
}
|
|
699
706
|
const scene = document.createElement("div");
|
|
700
707
|
Object.assign(scene.style, {
|
|
@@ -814,7 +821,7 @@ function createPlayer(opts) {
|
|
|
814
821
|
for (const anim of allAnims) anim.cancel();
|
|
815
822
|
resizeObserver.disconnect();
|
|
816
823
|
if (progressEl?.parentNode === viewport) viewport.removeChild(progressEl);
|
|
817
|
-
if (badge?.parentNode
|
|
824
|
+
if (badge?.parentNode) badge.parentNode.removeChild(badge);
|
|
818
825
|
if (viewport.parentNode === container) container.removeChild(viewport);
|
|
819
826
|
}
|
|
820
827
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markdy/renderer-dom",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
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.4"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"tsup": "^8.5.1",
|