CSGO
V2EX  ›  问与答

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

  •  
  •   CSGO · Aug 2, 2018 · 2311 views
    This topic created in 2865 days ago, the information mentioned may be changed or developed.

    指南: 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

    2 replies    2018-08-03 09:02:13 +08:00
    DeepCold
        1
    DeepCold  
       Aug 2, 2018
    path: 'data.json', // 这个相对路径没填对,想万无一失可以用网络地址
    renderer: 'svg/canvas/html', // 这个选一个就好,官网示例用的 svg,我用的 canvas 都 OK
    CSGO
        2
    CSGO  
    OP
       Aug 3, 2018 via Android
    @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.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2603 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 01:54 · PVG 09:54 · LAX 18:54 · JFK 21:54
    ♥ Do have faith in what you're doing.