lottie实现触碰小草动画效果代码
代码语言:html
所属分类:动画
代码描述:lottie实现触碰小草动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { min-height: 100vh; display: flex; justify-content: center; align-items: center; } * { box-sizing: border-box; } .btn { color: black; padding: 12px; cursor: pointer; border-radius: 50%; transition: all 0.2s ease; -webkit-tap-highlight-color: transparent; } .btn:hover { background-color: rgba(0, 0, 0, 0.04); } .btn div { width: 56px; height: 56px; transform: translate3d(0, 0, 0); } .btn div svg path { margin: 0 auto; } </style> </head> <body translate="no"> <div class="btn tg"> <div id="tg-icon"></div> </div> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/lottie.5.12.2.js"></script> <script > var animationTouchGrass = { "v": "5.7.5", "fr": 100, "ip": 0, "op": 210, "w": 28, "h": 28, "nm": "Comp 1", "ddd": 0, "metadata": { "backgroundColor": { "r": 255, "g": 255, "b": 255 }, "lottielabInteractivity": { "__version": "v1", "initialState": "State 1", "states": { "State 1": { "segment": [0, 0], "speed": 1, "direction": "forward", "loop": false, "on": { "mouseEnter:interactivity-trigger-16fc3b4f-1bd3-4477-9b04-27b9baa4bfbb": { "goTo": "State 2", "startAt": "start", "duration": 0.15, "easing": { "i": { "x": 0.8, "y": 1 }, "o": { "x": 0.4, "y": 0 } } } } }, "State 2": { "segment": [0, 2.1], "speed": 1, "direction": "forward", "loop": true, "on": { "mouseLeave:interactivity-trigger-16fc3b4f-1bd3-4477-9b04-27b9baa4bfbb": { "goTo": "State 1", "startAt": "start", "duration": 0.15, "easing": { "i": { "x": 0.8, "y": 1 }, "o": { "x": 0.4, "y": 0 } } } } } } } }, "assets": [], "layers": [{ "ddd": 0, "ind": 1, "ty": 4, "nm": "Icon", "sr": 1, "ks": { "p": { "a": 0, "k": [14, 14], "ix": 2 }, "a": { "a": 0, "k": [0, 0], "ix": 2 }, "s": { "a": 0, "k": [100, 100], "ix": 2 }, "r": { "a": 0, "k": 0, "ix": 2 }, "o": { "a": 0, "k": 100, "ix": 2 }, "sk": { "a": 0, "k": 0, "ix": 2 }, "sa": { "a": 0, "k": 0, "ix": 2 } }, "ao": 0, "shapes": [{ "ty": "gr", "nm": "hand", "it": [{ "ty": "gr", "nm": "Finger 1", "it": [{ "ty": "sh", "d": 1, "ks": { "a": 1, "k": [{ "t": 0, "s": [{ "c": false, "v": [[10.22652721405029, 4.654325485229492], [5.709684371948242, 4.411433696746826], [2.260602474212646, 5.692534923553467], [-0.5161898136138916, 4.525851726531982], [-0.201917752623558, 3.585160493850708], [5.967581748962402, 0.1641440689563751], [8.87728214263916, -0.5885660648345947], [12.70968532562256, -0.5885644555091858]], "i": [[0, 0], [0, 0], [0, 0], [0.4730699956417084, 1.060379981994629], [-0.3328900039196014, 0.1845899969339371], [0, 0], [-1.018100023269653, 0], [0, 0]], "o": [[0, 0], [0, 0], [-1.088430047035217, 0.4043000042438507], [-0.1550900042057037, -0.3476099967956543], [0, 0], [0.8902999758720398, -0.4936800003051758], [0, 0], [0, 0]] }], "i": { "x": [0.75], "y": [0.75] }, "o": { "x": [0.25], "y": [0.25] } }, { "t": 40, "s": [{ "c": false, "v": [[9.741700172424316, 5.307611465454102], [5.801572799682617, 4.873761177062988], [3.420565366744995, 6.869668960571289], [0.643773078918457, 5.702985763549805], [0.9580443501472473, 4.762301921844482], [5.263857364654541, 0.2910404205322266], [8.173558235168457, -0.4616697430610657], [12.83554172515869, 0.05166381224989891]], "i": [[0, 0], [0, 0], [0, 0], [0.4730699956417084, 1.060379981994629], [-0.3328900039196014, 0.1845899969339371], [0, 0], [-1.018100023269653, 0], [0, 0]], "o": [[0, 0], [0, 0], [-1.088430047035217, 0.4043000042438507], [-0.1550900042057037, -0.3476099967956543], [0, 0], [0.8902999758720398, -0.4936800003051758], [0, 0], [0, 0]] }], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 60, "s": [{ "c": false, "v": [[9.908662796020508, 5.475735187530518], [5.709684371948242, 4.411433696746826], [2.260602474212646, 5.692534923553467], [-0.5161898136138916, 4.525851726531982], [-0.201917752623558, 3.585160493850708], [5.967581748962402, 0.1641440689563751], [8.87728214263916, -0.5885660648345947], [12.70968532562256, -0.5885644555091858]], "i": [[0, 0], [0, 0], [0, 0], [0.4730699956417084, 1.060379981994629], [-0.3328900039196014, 0.1845899969339371], [0, 0], [-1.018100023269653, 0], [0, 0]], "o": [[0, 0], [0, 0], [-1.088430047035217, 0.4043000042438507], [-0.1550900042057037, -0.3476099967956543], [0, 0], [0.8902999758720398, -0.4936800003051758], [0, 0], [0, 0]] }], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 80, "s": [{ "c": false, "v": [[9.904329299926758, 5.480085849761963], [5.709684371948242, 4.411433696746826], [2.260602474212646, 5.692534923553467], [-0.5161898136138916, 4.525851726531982], [-0.201917752623558, 3.585160493850708], [5.967581748962402, 0.1641440689563751], [8.87728214263916, -0.5885660648345947], [12.86220169067383, 0.3165746033191681]], "i": [[0, 0], [0, 0], [0, 0], [0.4730699956417084, 1.060379981994629], [-0.3328900039196014, 0.1845899969339371], [0, 0], [-1.018100023269653, 0], [0, 0]], "o": [[0, 0], [0, 0], [-1.088430047035217, 0.4043000042438507], [-0.1550900042057037, -0.3476099967956543], [0, 0], [0.8902999758720398, -0.4936800003051758], [0, 0], [0, 0]] }], "i": { "x": [0.2183908045977012], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 140, "s": [{ "c": false, "v": [[10.22361183166504, 4.900527000427246], [5.801572799682617, 4.873761177062988], [3.420565366744995, 6.869668960571289], [0.643773078918457, 5.702985763549805], [0.9580443501472473, 4.762301921844482], [5.263857364654541, 0.2910404205322266], [8.173558235168457, -0.4616697430610657], [12.70968532562256, -0.5885644555091858]], "i": [[0, 0], [0, 0], [0, 0], [0.4730699956417084, 1.060379981994629], [-0.3328900039196014, 0.1845899969339371], [0, 0], [-1.018100023269653, 0], [0, 0]], "o": [[0, 0], [0, 0], [-1.088430047035217, 0.4043000042438507], [-0.1550900042057037, -0.3476099967956543], [0, 0], [0.8902999758720398, -0.4936800003051758], [0, 0], [0, 0]] }], "i": { "x": [0.3505747126436782], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 210, "s": [{ "c": false, "v": [[10.22652721405029, 4.654325485229492], [5.709684371948242, 4.411433696746826], [2.260602474212646, 5.692534923553467], [-0.5161898136138916, 4.525851726531982], [-0.201917752623558, 3.585160493850708], [5.967581748962402, 0.1641440689563751], [8.87728214263916, -0.5885660648345947], [12.70968532562256, -0.5885644555091858]], "i": [[0, 0], [0, 0], [0, 0], [0.4730699956417084, 1.060379981994629], [-0.3328900039196014, 0.1845899969339371], [0, 0], [-1.018100023269653, 0], [0, 0]], "o": [[0, 0], [0, 0], [-1.088430047035217, 0.4043000042438507], [-0.1550900042057037, -0.3476099967956543], [0, 0], [0.8902999758720398, -0.4936800003051758], [0, 0], [0, 0]] }], "i": { "x": [0.75], "y": [0.75] }, "o": { "x": [0.25], "y": [0.25] } }], "ix": 2 } }, { "ty": "st", "c": { "a": 0, "k": [0, 0, 0], "ix": 2 }, "o": { "a": 0, "k": 100, "ix": 2 }, "w": { "a": 0, "k": 2, "ix": 2 }, "lc": 1, "lj": 1, "ml": 4 }, { "ty": "tr", "p": { "a": 0, "k": [0.08003591746091843, -0.06688070297241211], "ix": 2 }, "a": { "a": 0, "k": [6.644830226898193, 3.20966100692749], "ix": 2 }, "s": { "a": 0, "k": [100, 100], "ix": 2 }, "r": { "a": 0, "k": 0, "ix": 2 }, "o": { "a": 0, "k": 100, "ix": 2 }, "sk": { "a": 0, "k": 0, "ix": 2 }, "sa": { "a": 0, "k": 0, "ix": 2 } }] }, { "ty": "gr", "nm": "Thumb 1", "it": [{ "ty": "sh", "d": 1, "ks": { "a": 0, "k": { "c": false, "v": [[8.5, 2.000289916992188], [6.625499725341797, 3.071490287780762], [3.164199829101562, 3.633090019226074], [0, 3.000289916992188], [0.5447998046875, 1.367079734802246], [2.442299842834473, 1.960893314389978e-8], [4.5, 0.0002899366081692278]], "i": [[0, 0], [0, 0], [1.18369996547699, 0.2368000000715256], [0, 0], [0, 0], [-0.8607000112533569, -0.000119999996968545], [0, 0]], "o": [[0, 0], [-1.048099994659424, 0.5989000201225281], [0, 0], [0, 0], [0.2723999917507172, -0.816540002822876], [0, 0], [0, 0]] } } }, { "ty": "st", "c": { "a": 0, "k": [0, 0, 0], "ix": 2 }, "o": { "a": 0, "k": 100, "ix": 2 }, "w": { "a": 0, "k": 2, "ix": 2 }, "lc": 3, "lj": 2, "ml": 4 }, { "ty": "tr", "p": { "a": 0, "k": [9.400765419006348, 1.645613193511963], "ix": 2 }, "a": { "a": 0, "k": [10.75598526000977, 1.510738727808817], "ix": 2 }, "s": { "a": 0, "k": [100, 100], "ix": 2 }, "r": { "a": 1, "k": [{ "t": 0, "s": [-12.98378662420084], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 60, "s": [-21.46908706086932], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 80, "s": [-21.46908706086932], "i": { "x": [0.22], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 210, "s": [-12.98378662420084], "i": { "x": [0.75], "y": [0.75] }, "o": { "x": [0.25], "y": [0.25] } }], "ix": 2 }, "o": { "a": 0, "k": 100, "ix": 2 }, "sk": { "a": 0, "k": 0, "ix": 2 }, "sa": { "a": 0, "k": 0, "ix": 2 } }] }, { "ty": "tr", "p": { "a": 1, "k": [{ "t": 0, "s": [7, -0.269775390625], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 40, "s": [7.144775390625, 1.999992370605469], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 60, "s": [4.115257263183594, 1.959442138671875], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 80, "s": [5.615257263183594, 0.959442138671875], "i": { "x": [0.2183908045977012], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 140, "s": [11.644775390625, 1.499992370605469], "i": { "x": [0.3505747126436782], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 210, "s": [7, -0.269775390625], "i": { "x": [0.75], "y": [0.75] }, "o": { "x": [0.25], "y": [0.25] } }], "ix": 2 }, "a": { "a": 0, "k": [7.144775390625, 3.8651123046875], "ix": 2 }, "s": { "a": 0, "k": [100, 100], "ix": 2 }, "r": { "a": 1, "k": [{ "t": 0, "s": [0], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 40, "s": [-6.283521594411989], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 60, "s": [2.716478405588011], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 80, "s": [-16.1969200210622], "i": { "x": [0.2183908045977012], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 140, "s": [-6.416779079216314], "i": { "x": [0.3505747126436782], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 210, "s": [0], "i": { "x": [0.75], "y": [0.75] }, "o": { "x": [0.25], "y": [0.25] } }], "ix": 2 }, "o": { "a": 0, "k": 100, "ix": 2 }, "sk": { "a": 0, "k": 0, "ix": 2 }, "sa": { "a": 0, "k": 0, "ix": 2 } }] }, { "ty": "gr", "nm": "Grass", "it": [{ "ty": "gr", "nm": "Grass 4", "it": [{ "ty": "sh", "d": 1, "ks": { "a": 1, "k": [{ "t": 25, "s": [{ "c": true, "v": [[1.5, 5], [0, 0], [4, 5], [1.5, 5]], "i": [[0, 0], [0, 1.5], [-0.5, -2], [0, 0]], "o": [[-1, -1], [1.5, 0.5], [0, 0], [0, 0]] }], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 40, "s": [{ "c": true, "v": [[1.5, 5], [-2.384956359863281, 0.8654613494873047], [4, 5], [1.5, 5]], "i": [[0, 0], [0.0725095272064209, 2.296135663986206], [-0.5, -2], [0, 0]], "o": [[-0.960402250289917, 0.1676979064941406], [4.326406478881836, 1.45019006729126], [0, 0], [0, 0]] }], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 60, "s": [{ "c": true, "v": [[1.5, 5], [-2.16939377784729, 0.2764911651611328], [4, 5], [1.5, 5]], "i": [[0, 0], [0.0725095272064209, 2.296135663986206], [-0.5, -2], [0, 0]], "o": [[-0.960402250289917, 0.1676979064941406], [3.428692817687988, 2.875334978103638], [0, 0], [0, 0]] }], "i": { "x": [0.75], "y": [0.75] }, "o": { "x": [0.25], "y": [0.25] } }, { "t": 70, "s": [{ "c": true, "v": [[1.5, 5], [-2.16939377784729, 0.2764911651611328], [4, 5], [1.5, 5]], "i": [[0, 0], [0.0725095272064209, 2.296135663986206], [-0.5, -2], [0, 0]], "o": [[-0.960402250289917, 0.1676979064941406], [3.428692817687988, 2.875334978103638], [0, 0], [0, 0]] }], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 80, "s": [{ "c": true, "v": [[1.5, 5], [-2.463269233703613, 2], [4, 5], [1.5, 5]], "i": [[0, 0], [2.030208587646484, 1.74462103843689], [0, -1.274402856826782], [0, 0]], "o": [[-2.884291172027588, 0], [3.721832513809204, -1.010728120803833], [0, 0], [0, 0]] }], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 102, "s": [{ "c": true, "v": [[1.5, 5], [-0.9215285657019832, 1.187758840753184], [4, 5], [1.5, 5]], "i": [[0, 0], [0.8045580288223988, 1.651556829443469], [-0.4534893285488599, -1.48390099567201], [0, 0]], "o": [[-2.694116115570068, 0.1012630462646484], [2.442617433153267, -0.122784305734029], [0, 0], [0, 0]] }], "i": { "x": [0.75], "y": [0.75] }, "o": { "x": [0.25], "y": [0.25] } }, { "t": 130, "s": [{ "c": true, "v": [[1.5, 5], [2.398796081542969, -0.5615005493164062], [4, 5], [1.5, 5]], "i": [[0, 0], [-1.835028409957886, 1.451131820678711], [-1.43013334274292, -1.935080528259277], [0, 0]], "o": [[-1, -1], [-0.3123266696929932, 1.789509892463684], [0, 0], [0, 0]] }], "i": { "x": [0.8], "y": [1] }, "o": { "x": [0.4], "y": [0] } }, { "t": 160, "s": [{ "c": true, "v": [[1.5, 5], [-0.3662503063678741, 0.2527062296867371], [4, 5], [1.5, 5]], "i": [[0, 0], [0.5138038396835327, 1.512868285179138], [-0.5, -2], [0, 0]], "o": [[-1, -1], [2.055219173431396, 0.485258162021637], [0, 0], [0, 0]] }], "i": { "x": [0.8], "y": [.........完整代码请登录后点击上方下载按钮下载查看
网友评论0