animot-presenter 0.5.9 → 0.5.10
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/utils/camera.js
CHANGED
|
@@ -59,8 +59,17 @@ export function parallaxOffset(camera, depth, worldWidth, worldHeight) {
|
|
|
59
59
|
const cy = camera.y + camera.height / 2;
|
|
60
60
|
const wx = worldWidth / 2;
|
|
61
61
|
const wy = worldHeight / 2;
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
|
|
62
|
+
// Parallax magnitude is `depth × camera-offset-from-world-center × factor`.
|
|
63
|
+
// The earlier 0.4 factor blew up on large worlds (6000×4000) because the
|
|
64
|
+
// camera-offset term scales with world size — depth=0.7 gave ±840px shifts,
|
|
65
|
+
// destroying composition.
|
|
66
|
+
//
|
|
67
|
+
// Fix: scale the factor by the CAMERA WIDTH ratio to a 1920-baseline so the
|
|
68
|
+
// effect feels the same regardless of world size. A 1920-wide camera gets
|
|
69
|
+
// the original feel; a 3200-wide camera (zoomed out) gets a smaller offset
|
|
70
|
+
// per unit-of-world-distance so the layout doesn't fly apart.
|
|
71
|
+
const baseFactor = depth * 0.15;
|
|
72
|
+
const widthScale = Math.min(1, 1920 / Math.max(1, camera.width));
|
|
73
|
+
const factor = baseFactor * widthScale;
|
|
65
74
|
return { x: -(cx - wx) * factor, y: -(cy - wy) * factor };
|
|
66
75
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "animot-presenter",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.10",
|
|
4
4
|
"description": "Embed animated presentations anywhere. Works with vanilla JS, React, Vue, Angular, Svelte, and any frontend framework. Morphing animations, code highlighting, charts, particles, and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"svelte": "./dist/index.js",
|