Function
computeParallaxPos
(
offset,
ratio,
camPos,
anchorPoint,
boundsW,
viewportW,
)
Source from the content-addressed store, hash-verified
| 605 | describe("parallax origin offset baking", () => { |
| 606 | // Helper: compute parallax position the way ImageLayer.draw does |
| 607 | function computeParallaxPos( |
| 608 | offset, |
| 609 | ratio, |
| 610 | camPos, |
| 611 | anchorPoint, |
| 612 | boundsW, |
| 613 | viewportW, |
| 614 | ) { |
| 615 | const ax = anchorPoint; |
| 616 | const rx = ratio; |
| 617 | return ax * (rx - 1) * (boundsW - viewportW) + offset - rx * camPos; |
| 618 | } |
| 619 | |
| 620 | it("baked offset matches explicit parallax origin (ax=0, ratio=0.5)", () => { |
| 621 | const layerOffset = 100; |
Tested by
no test coverage detected