Skip to main content
100%

ScrollyTelling with FreeCamera API snippet

✓ Published0🌍 Public
HHirosaji
Last edited Aug 4, 2021
Created on Aug 4, 2021

This example demonstrates scroll-driven animation in a Mapbox GL map, syncing a free camera’s position and view target along geographic routes. Using Turf.js’s `length` and `along` functions, it interpolates points based on scroll rate, then sets the camera’s mercator coordinates and look-at point via `map.getFreeCameraOptions` and `map.setFreeCameraOptions`. A scroll event listener triggers `requestAnimationFrame` to update the view smoothly. The code shows route and camera path synchronization, with altitude fixed, rendering an animated flythrough tied to page scroll.

AI-generated description

Similar vizzes