快活林资源网 Design By www.csstdc.com
本文实例为大家分享了js实现直播点击飘心效果的具体代码,供大家参考,具体内容如下
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>直播点击飘心效果</title> <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: 60px; width: 60px; display: block; z-index: 21; cursor: pointer; } </style> </head> <body> <img src="/UploadFiles/2021-04-02/reward.png">flutter-hearts-zmt.js
! function(t, e) { "object" == typeof exports && "undefined" != typeof module "function" == typeof define && define.amd "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 "Cannot call a class as a function") }, r = function() { function t(t, e) { for(var n = 0; n < e.length; n++) { var r = e[n]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function(e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } }(), i = window.requestAnimationFrame || window.webkitRequestAnimationFrame || function(t) { return setTimeout(t, 16) }, o = function() { function o() { n(this, o); var t = this.canvas = document.createElement("canvas"), e = this.context = t.getContext("2d"), r = this._children = [], u = function n() { i(n), e.clearRect(0, 0, t.width, t.height); for(var o = 0, u = r.length; o < u;) { var a = r[o]; a.render.call(null, (a.timestamp + a.duration - new Date) / a.duration) "bubble", value: function(n) { var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e.uniformDiscrete(2400, 3600), i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : t(n, this.canvas, this.context); return this._children.push({ render: i, duration: r, timestamp: +new Date }), this } }]), o }(); return o }); // 图片地址在此处更换 可换成你的图片 var assets = [ 'img/1.png', 'img/2.png', 'img/3.png', 'img/4.png', 'img/5.png', ]; assets.forEach(function(src, index) { assets[index] = new Promise(function(resolve) { var img = new Image; img.onload = resolve.bind(null, img); img.src = src; }); }); Promise.all(assets).then(function(images) { var random = { uniform: function(min, max) { return min + (max - min) * Math.random(); }, uniformDiscrete: function(i, j) { return i + Math.floor((j - i + 1) * random.uniform(0, 1)); }, }; var stage = new BubbleHearts(); var canvas = stage.canvas; canvas.width = 170; canvas.height = 300; canvas.style['width'] = '170px'; canvas.style['height'] = '300px'; document.body.appendChild(canvas); //journal-reward 为赏桃的按钮 document.getElementsByClassName('journal-reward')[0].addEventListener('click', function() { //随机飘动 stage.bubble(images[random.uniformDiscrete(0, images.length - 1)]); }, false); });以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
快活林资源网 Design By www.csstdc.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
快活林资源网 Design By www.csstdc.com
暂无评论...
更新日志
2024年12月23日
2024年12月23日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]