https://codepen.io/popmotion/pen/Kyewbv
由于某种原因,这不起作用。
https://popmotion.io/pure/如此处所述,它必须是
const slider = document.querySelector('.slider');
const sliderX = value(0, styler(slider).set('x'))
listen(slider, 'mousedown touchstart').start(() => {
pointer({ x: sliderX.get() })
.pipe(({ x }) => x, clampMovement)
.start(sliderX);
});
listen(document, 'mouseup touchend').start(() => {
decay({
from: sliderX.get(),
velocity: sliderX.getVelocity()
}).pipe(clampMovement)
.start(sliderX);
});
每当我使用它时,夹子运动都显示为未定义。实际上应该是什么?有什么可以让它工作的吗?