canvas直播点赞冒泡动画效果代码
代码语言:html
所属分类:动画
代码描述:canvas直播点赞冒泡动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style type="text/css"> html, body { height: 100%; position: relative; width: 100%; } canvas { display: block; position: absolute; bottom: 100px; right: -24px; z-index: 20; cursor: pointer; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .journal-reward { position: absolute; bottom: 70px; right: 20px; height: 80px; width: 80px; display: block; z-index: 21; } .zancont { position: relative; width: 300px; height:100%; } </style> </head> <body> <div class="zancont"> <img src="//repo.bfw.wiki/bfwrepo/image/5f9e911f6d925.png" class="journal-reward" /> </div> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script> <script type="text/javascript"> /** * @ProjectName flutter-hearts-zmt * @Version 0.0.0 * @Author Jiangshilong(https://github.com/JSL8023) * @Update 2018-03-22 17:24 pm */ ! function(t, e) { "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : t.BubbleHearts = e() }(this, function() { "use strict"; function t(t, n, r) { var i = e.uniformDiscrete(89, 91) / 100, o = 1 - i, u = (e.uniformDiscrete(45, 60) + e.uniformDiscrete(45, 60)) / 100, a = function(t) { return t > i ? Math.max(((1 - t) / o).toFixed(2), .1) * u : u }, c = e.uniformDiscrete(-30, 30), f = function(t) { return c }, h = 10, s = n.width / 2 + e.uniformDiscrete(-h, h), d = (n.width - Math.sqrt(Math.pow(t.width, 2) + Math.pow(t.height, 2))) / 2 - h, l = e.uniformDiscrete(.8 * d, d) * (e.uniformDiscrete(0, 1) ? 1 : -1), m = e.uniformDiscrete(250, 400), w = function(t) { return t > i ? s : s + l * Math.sin(m * (i - t) * Math.PI / 180) }, v = function(e) { return t.height / 2 + (n.height - t.height / 2) * e }, p = e.uniformDiscrete(14, 18) / 100, g = function(t) { return t > p ? 1 : 1 - ((p - t) / p).toFixed(2) }; return function(e) { if(!(e >= 0)) return !0; r.save(); var n = a(e), i = f(e), o = w(e), u = v(e); r.translate(o, u), r.scale(n, n), r.rotate(i * Math.PI / 180), r.globalAlpha = g(e), r.drawImage(t, -t.width / 2, -t.height / 2, t.width, t.height), r.restore() } } var e = function(t) { var e = t, n = Math.floor, r = Math.random; return t.uniform = function(t, e) { return t + (e - t) * r() }, t.uniformDiscrete = function(t, r) { return t + n((r - t + 1) * e.uniform(0, 1)) }, t }({}), n = function(t, e) { if(!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }, r = function() { .........完整代码请登录后点击上方下载按钮下载查看
网友评论0