I recently finished a website with a 3D animation binded to the page scroll.
This is my first project with Babylon.js, took a while to grasp everything but I finally managed !
This is a website for a local brewery, with stickers animated to fly and stick to the beer bottles, synchronized with each showcased beer.
Amazing, really nice!!
I’m developing a similar project where I have to synchronize a quite complex fbx animation with the scroll.
I’ve it almost finished and finally the best way I’ve found to make it work well is to reproduce the exact second of the fbx animation depending on the exact position of the scroll.
On scroll, each sticker animation is set to a specific frame depending on the distance between the actual informative block in the page and the center of the viewport.
I use : window[‘animation_name’].start(false, 1.0, required_frame, required_frame, false);
Don’t know if there was another way to do this, but it works !
But I think I couldn’t even make one ? In the playground, we can’t use a “normal” webpage and use it’s scroll position with JS, right ? i don’t think we can even scroll in the playground, just display a “standalone” Babylon.js scene ?
I could make a playground to help if it’s possible, but I believe it isn’t
@Clement Thanks for your reply. My question is the 3d scene is being same as background but other html elements are moving while scrolling, How it is working.
@jayakannan This is quite simple, the babylon scene is in a div with “position: fixed” as CSS, while the rest of the page is just a “classic web page”.
On my site, the babylon scene is fixed only for a part of the page, and scrolls when reaching the bottom : I just detected with JS when the page is between a upper and a lower limit, and switched the div to fixed if we’re between the 2 limits, and to absolute if we’re not.
Thanks for your explanation @Clement . Very simplified explanation you gave. just have a look into the below link. It is confusing me. please help me to understand, if you get any points from it.