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.516189.........完整代码请登录后点击上方下载按钮下载查看
网友评论0