最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

js實(shí)現(xiàn)直播點(diǎn)擊飄心效果

 更新時(shí)間:2020年08月19日 10:42:53   作者:施主請(qǐng)別摸老衲的臉  
這篇文章主要為大家詳細(xì)介紹了js實(shí)現(xiàn)直播點(diǎn)擊飄心效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了js實(shí)現(xiàn)直播點(diǎn)擊飄心效果的具體代碼,供大家參考,具體內(nèi)容如下

<!DOCTYPE html>
<html>
 <head>
 <meta charset="UTF-8">
 <title>直播點(diǎn)擊飄心效果</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="img/reward.png" class="journal-reward" /> 
<script src="jquery.min.js"></script> 
<script src="flutter-hearts-zmt.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>

flutter-hearts-zmt.js

! 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() {
 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) ? (r.splice(o, 1), u--) : o++
  }
  };
 i(u)
 }
 return r(o, [{
 key: "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() {
 //隨機(jī)飄動(dòng)
 stage.bubble(images[random.uniformDiscrete(0, images.length - 1)]);
 
 }, false);
 
});

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 微信小程序點(diǎn)擊生成朋友圈分享圖(遇到的坑)

    微信小程序點(diǎn)擊生成朋友圈分享圖(遇到的坑)

    這篇文章主要介紹了微信小程序 點(diǎn)擊生成朋友圈分享圖,本文給大家分享小編在實(shí)現(xiàn)此功能時(shí)遇到的各種坑,通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-06-06
  • json字符串對(duì)象轉(zhuǎn)換代碼實(shí)例

    json字符串對(duì)象轉(zhuǎn)換代碼實(shí)例

    這篇文章主要介紹了json字符串對(duì)象轉(zhuǎn)換代碼實(shí)例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-09-09
  • echarts同一頁(yè)面中四個(gè)圖表切換的js數(shù)據(jù)交互方法示例

    echarts同一頁(yè)面中四個(gè)圖表切換的js數(shù)據(jù)交互方法示例

    這篇文章主要給大家介紹了關(guān)于echarts同一頁(yè)面中四個(gè)圖表切換的js數(shù)據(jù)交互的相關(guān)資料,文中給出了完整的示例代碼供大家參考學(xué)習(xí),對(duì)大家的學(xué)習(xí)或者工作具有一定的幫助,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2018-07-07
  • JavaScript 函數(shù)式編程的原理

    JavaScript 函數(shù)式編程的原理

    要了解JavaScript中的函數(shù)式編程原理,必須理解一下兩個(gè)知識(shí)點(diǎn)
    2009-10-10
  • uniapp中uni.request(OBJECT)接口請(qǐng)求封裝實(shí)例代碼

    uniapp中uni.request(OBJECT)接口請(qǐng)求封裝實(shí)例代碼

    在開發(fā)的時(shí)候經(jīng)常會(huì)用到前端請(qǐng)求后端接口,每次的請(qǐng)求都會(huì)出現(xiàn)地址不一樣,參數(shù)不一樣,方式不一樣等等情況,下面這篇文章主要給大家介紹了關(guān)于uniapp中uni.request(OBJECT)接口請(qǐng)求封裝的相關(guān)資料,需要的朋友可以參考下
    2022-12-12
  • 使javascript也能包含文件

    使javascript也能包含文件

    使javascript也能包含文件...
    2006-10-10
  • bootstrap3中container與container_fluid外層容器的區(qū)別講解

    bootstrap3中container與container_fluid外層容器的區(qū)別講解

    .container與.container_fluid是bootstrap中的兩種不同類型的外層容器。這篇文章主要介紹了bootstrap3中container與container_fluid的區(qū)別,需要的朋友可以參考下
    2017-12-12
  • 詳解webpack babel的配置

    詳解webpack babel的配置

    本篇文章主要介紹了詳解webpack babel的配置,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-01-01
  • Jquery把獲取到的input值轉(zhuǎn)換成json

    Jquery把獲取到的input值轉(zhuǎn)換成json

    本篇文章主要介紹了Jquery把獲取到的input值轉(zhuǎn)換成json的相關(guān)知識(shí),具有很好的參考價(jià)值。下面跟著小編一起來(lái)看下吧
    2017-05-05
  • JS?加載性能Tree?Shaking優(yōu)化詳解

    JS?加載性能Tree?Shaking優(yōu)化詳解

    這篇文章主要為大家介紹了JS?加載性能Tree?Shaking優(yōu)化詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-11-11

最新評(píng)論

库伦旗| 吉林省| 萨迦县| 镇沅| 扎囊县| 扎兰屯市| 锡林郭勒盟| 广饶县| 法库县| 汤阴县| 崇礼县| 寻乌县| 资兴市| 奇台县| 苏尼特左旗| 溧水县| 扬州市| 且末县| 买车| 河南省| 遂昌县| 南陵县| 虎林市| 南靖县| 和硕县| 阿拉善盟| 都匀市| 平乡县| 普兰店市| 东乡县| 屯门区| 桃源县| 应城市| 都江堰市| 青龙| 蓬莱市| 凤台县| 灵武市| 武隆县| 高州市| 沙雅县|