谁知道 lottie,为何我用在 web 上一直显示不出来?

2018-08-02 14:29:01 +08:00
 CSGO

指南: http://airbnb.io/lottie/web/web.html

我添加了

<script src="js/bodymovin.js" type="text/javascript"></script>

把 data.json 放到根目录,bodymovin.js 放在了根目录的 js 文件夹里,然后 js 文件夹里建立 index.js, 然后复制了指南的代码进去,修改了 id 名字,可是一直不显示啊!

project: https://pan.baidu.com/s/1dDf_wqx82tBY-06mRMvQIA

1864 次点击
所在节点    问与答
2 条回复
DeepCold
2018-08-02 15:39:54 +08:00
path: 'data.json', // 这个相对路径没填对,想万无一失可以用网络地址
renderer: 'svg/canvas/html', // 这个选一个就好,官网示例用的 svg,我用的 canvas 都 OK
CSGO
2018-08-03 09:02:13 +08:00
@DeepCold 看一下作者给我的回复:

Hi, your folder is named "_js" and the html is looking for a folder called "js".
Second, in the index you're passing a variable element as the container of the animation but you haven't specified what is the value of that variable. It should point to an element in the DOM.

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/476277

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX