#はじめに
下記のサイトを参考にLottieでjsonファイルとして書き出されたアニメーションを表示させたく思っています
Lottieで作ったアニメーションをWebサイトで実装(レスポンシブ対応)
#問題
サイトを元に、下記のようなディレクトリとファイルを作成しましたが、うまくアニメーションが表示されません。
ファイルは以下のように実装しています
-
data.json : https://lottiefiles.com/ よりインストールしたjsonファイル
-
index.js : アニメーションを実行するためのファイルで下記の通り
var animationTivel = lottie.loadAnimation({ container: document.getElementById('lottie'), renderer: 'svg', loop: true, autoplay: true, path: 'data.json' });
-
lottie.js, lottie.min.js : https://github.com/airbnb/lottie-web からダウンロード
-
test.html : 下記の通り
<!DOCTYPE html> <html lang="en"> <head> <!-- Meta --> <meta charset="UTF-8" /> <title>Bodymovin Demo</title> <!-- Styles --> <!-- <script src="https://cdnjs.com/libraries/bodymovin" type="text/javascript"></script> --> <script type="text/javascript" src="lottie.js"></script> <script type="text/javascript" src="lottie.min.js"></script> </head> <body> <div id="lottie" style="height: 300px; width: 300px; background: red;"></div> <!-- Scripts --> <!-- <script src="lottie.js"></script> --> <script src="index.js"></script> </body> </html>
どなたかアドバイスいただける方おりましたらよろしくお願いいたします。m(_ _)m
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。