Is there a solution to add stops when camera is following path using scroll controls #818
Replies: 1 comment 1 reply
-
You could try to use an easing function like easeInOutCubic. This function takes a range between 0 and 1.
'start' and 'end' are your previous and next breakpoint. You'll need to figure out which two breakpoints you're between. You could get that with a simple filter and lookup of the stops.
Here is a demonstration. It's not in R3F, but just drawing the math on a canvas. This way, you don't need to mess with the scroll. The scrolling can work as always, and let the math handle the smooth movement. |
Beta Was this translation helpful? Give feedback.
-
I have been experimenting with three.js for a website I’m making.
I came across the spline curve solution in order to make a camera follow a cinematic path, and linked it to the drei’s scroll component in order to make the camera follow a cinematic path relative to the current scroll of the page.
The problem that I’m facing is that I want the camera to have smoothed out stop points, I have already successfully added stop points without the smoothing, by using the range function from the offset object from the Drei’s scroll component and it works just fine.
I’m looking for a way to slow down the camera before it stops. Already tried to change the offset.range value (which is linear) to an exponential value, this partially works it slows down the camera movement until half of the function and after coming to a complete stop it turns around and goes in reverse in the path.
This is basically how I manage to add the stop points.
Beta Was this translation helpful? Give feedback.
All reactions