motiondivision / motionone

https://motion.dev
MIT License
2.95k stars 52 forks source link

[Bug] inView margin has no effect #250

Closed BeetrootShoulders closed 8 months ago

BeetrootShoulders commented 8 months ago

1. Describe the bug

Adding margin to inView element seems to have no effect. Animations are triggered as soon as they enter the viewport regardless of any margin setting.

2. IMPORTANT: Provide a CodeSandbox reproduction of the bug

https://codesandbox.io/p/sandbox/sandpack-project-s9h5mf?file=%2Fsrc%2Findex.js&from-sandpack=true

3. Steps to reproduce

Steps to reproduce the behavior:

Add the margin option the inView function as per the docs

4. Expected behavior

With a negative value X as the first value in the margin property, I expect the target element to not appear until it is X pixels down the screen - not as soon as it appears on screen. With a positive value X, I expect the animation to occur when the element is off the bottom of the screen by X pixels.

5. Video or screenshots

N/A

6. Browser details

Windows, Firefox, Chrome

tzezar commented 2 months ago

Did you find a solution?