I want to create a slider where 3 elements are always visible, when a new element is added the element on the other side should fly out again.
(The blurred images should be outside the window.)
The whole thing should happen in an endless loop, so I use the carousel function.
The whole thing works so far so good, except for the side effect that the other elements of the carousel are visible in the background although they should actually be offset to the left or right!
This is the formula with which I create the offset:
translateX(calc((50vw * clamp(0, var(--x-slide-distance) - 1, 1)) * var(--x-slide-balance)))
Access data and more info in the security note.
UPDATE:
I have now created the push-out slider on another page where the effect works much better. There seems to be no problem with the carousel elements.
Unfortunately there are still a few points that don’t quite work:
-
the start of the animation seems to be shifted to the right and only aligns itself correctly to the center after the first slide change.
-
on an iPhone Chrome Browser the animation does not appear correctly and seems choppy. On safari it seems to be better.
-
on some images a dark line seems to appear during the animation. But then it disappears. (Chrome Browser)
I have added the access data to the second page as well.
The slider looks really cool, and i would be happy to see it working perfectly