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.