javascript - 悬停在桌面上时启动抽奖动画
问题描述
我希望我的抽奖动画在悬停在桌面上时开始动画并在移动视图上自动播放。有没有办法做到这一点?
我希望动画在光标关闭时倒回 像这样的东西
这是我用来制作动画的代码。
谢谢
export default function Landing() {
useHorizontal();
const box1 = {
loop: true,
autoplay: true,
animationData: svg1,
rendererSettings: {
preserveAspectRatio: 'xMidYMid slice',
},
};
const box2 = {
loop: true,
autoplay: true,
animationData: svg2,
rendererSettings: {
preserveAspectRatio: 'xMidYMid slice',
},
};
const box3 = {
loop: true,
autoplay: true,
animationData: svg3,
rendererSettings: {
preserveAspectRatio: 'xMidYMid slice',
},
};
return (
<div className="app" style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<Lottie options={box1} height={900} width={900} />
<Lottie options={box2} height={900} width={900} />
<Lottie options={box3} height={900} width={900} />
</div>
);
}
解决方案
推荐阅读
- node.js - useEffect 中的返回值始终相同
- java - 如何在 RecyclerView 中的某些元素之间添加分隔符?
- python - 来自 Django 中静态文件夹的 CSS
- excel - Excel Power Query 向下钻取时仅检索 1000 行
- node.js - 网络聊天中的 Azure 测试:HTTP 状态代码 NotFound
- javascript - 在 js 中设置时间并使用 Date 获取 ms
- android - Android,Koin:如何防止viewModel绑定的接口创建新的viewModel实例?
- c++ - 运算符 ^ 重载类型为“void”和“<未解析的重载函数类型>”的无效操作数错误
- perl - 为什么当我使用 open ':std', ':encoding(UTF-8)'; 时 File::Slurp 得到 UTF8 字符错误?
- java - 由于 Fragment 类中缺少公共构造方法,在 android 中旋转设备后出现异常