首页 > 其他分享 >点击效果(页脚htlm代码)

点击效果(页脚htlm代码)

时间:2023-10-17 21:26:16浏览次数:31  
标签:function 页脚 color random ctx htlm 点击 var Math

/* 点击爆炸效果*/ <canvas class="fireworks" style="position: fixed; left: 0px; top: 0px; z-index: 1; pointer-events: none; width: 1440px; height: 451px;" width="2880" height="902"></canvas> <script type="text/javascript" src="//cdn.bootcss.com/animejs/2.2.0/anime.min.js"></script> <script type="text/javascript"> "use strict";function updateCoords(e){pointerX=(e.clientX||e.touches[0].clientX)-canvasEl.getBoundingClientRect().left,pointerY=e.clientY||e.touches[0].clientY-canvasEl.getBoundingClientRect().top}function setParticuleDirection(e){var t=anime.random(0,360)*Math.PI/180,a=anime.random(50,180),n=[-1,1][anime.random(0,1)]*a;return{x:e.x+n*Math.cos(t),y:e.y+n*Math.sin(t)}}function createParticule(e,t){var a={};return a.x=e,a.y=t,a.color=colors[anime.random(0,colors.length-1)],a.radius=anime.random(16,32),a.endPos=setParticuleDirection(a),a.draw=function(){ctx.beginPath(),ctx.arc(a.x,a.y,a.radius,0,2*Math.PI,!0),ctx.fillStyle=a.color,ctx.fill()},a}function createCircle(e,t){var a={};return a.x=e,a.y=t,a.color="#F00",a.radius=0.1,a.alpha=0.5,a.lineWidth=6,a.draw=function(){ctx.globalAlpha=a.alpha,ctx.beginPath(),ctx.arc(a.x,a.y,a.radius,0,2*Math.PI,!0),ctx.lineWidth=a.lineWidth,ctx.strokeStyle=a.color,ctx.stroke(),ctx.globalAlpha=1},a}function renderParticule(e){for(var t=0;t<e.animatables.length;t++){e.animatables[t].target.draw()}}function animateParticules(e,t){for(var a=createCircle(e,t),n=[],i=0;i<numberOfParticules;i++){n.push(createParticule(e,t))}anime.timeline().add({targets:n,x:function(e){return e.endPos.x},y:function(e){return e.endPos.y},radius:0.1,duration:anime.random(1200,1800),easing:"easeOutExpo",update:renderParticule}).add({targets:a,radius:anime.random(80,160),lineWidth:0,alpha:{value:0,easing:"linear",duration:anime.random(600,800)},duration:anime.random(1200,1800),easing:"easeOutExpo",update:renderParticule,offset:0})}function debounce(e,t){var a;return function(){var n=this,i=arguments;clearTimeout(a),a=setTimeout(function(){e.apply(n,i)},t)}}var canvasEl=document.querySelector(".fireworks");if(canvasEl){var ctx=canvasEl.getContext("2d"),numberOfParticules=30,pointerX=0,pointerY=0,tap="mousedown",colors=["#FF1461","#18FF92","#5A87FF","#FBF38C"],setCanvasSize=debounce(function(){canvasEl.width=2*window.innerWidth,canvasEl.height=2*window.innerHeight,canvasEl.style.width=window.innerWidth+"px",canvasEl.style.height=window.innerHeight+"px",canvasEl.getContext("2d").scale(2,2)},500),render=anime({duration:1/0,update:function(){ctx.clearRect(0,0,canvasEl.width,canvasEl.height)}});document.addEventListener(tap,function(e){"sidebar"!==e.target.id&&"toggle-sidebar"!==e.target.id&&"A"!==e.target.nodeName&&"IMG"!==e.target.nodeName&&(render.play(),updateCoords(e),animateParticules(pointerX,pointerY))},!1),setCanvasSize(),window.addEventListener("resize",setCanvasSize,!1)}"use strict";function updateCoords(e){pointerX=(e.clientX||e.touches[0].clientX)-canvasEl.getBoundingClientRect().left,pointerY=e.clientY||e.touches[0].clientY-canvasEl.getBoundingClientRect().top}function setParticuleDirection(e){var t=anime.random(0,360)*Math.PI/180,a=anime.random(50,180),n=[-1,1][anime.random(0,1)]*a;return{x:e.x+n*Math.cos(t),y:e.y+n*Math.sin(t)}}function createParticule(e,t){var a={};return a.x=e,a.y=t,a.color=colors[anime.random(0,colors.length-1)],a.radius=anime.random(16,32),a.endPos=setParticuleDirection(a),a.draw=function(){ctx.beginPath(),ctx.arc(a.x,a.y,a.radius,0,2*Math.PI,!0),ctx.fillStyle=a.color,ctx.fill()},a}function createCircle(e,t){var a={};return a.x=e,a.y=t,a.color="#F00",a.radius=0.1,a.alpha=0.5,a.lineWidth=6,a.draw=function(){ctx.globalAlpha=a.alpha,ctx.beginPath(),ctx.arc(a.x,a.y,a.radius,0,2*Math.PI,!0),ctx.lineWidth=a.lineWidth,ctx.strokeStyle=a.color,ctx.stroke(),ctx.globalAlpha=1},a}function renderParticule(e){for(var t=0;t<e.animatables.length;t++){e.animatables[t].target.draw()}}function animateParticules(e,t){for(var a=createCircle(e,t),n=[],i=0;i<numberOfParticules;i++){n.push(createParticule(e,t))}anime.timeline().add({targets:n,x:function(e){return e.endPos.x},y:function(e){return e.endPos.y},radius:0.1,duration:anime.random(1200,1800),easing:"easeOutExpo",update:renderParticule}).add({targets:a,radius:anime.random(80,160),lineWidth:0,alpha:{value:0,easing:"linear",duration:anime.random(600,800)},duration:anime.random(1200,1800),easing:"easeOutExpo",update:renderParticule,offset:0})}function debounce(e,t){var a;return function(){var n=this,i=arguments;clearTimeout(a),a=setTimeout(function(){e.apply(n,i)},t)}}var canvasEl=document.querySelector(".fireworks");if(canvasEl){var ctx=canvasEl.getContext("2d"),numberOfParticules=30,pointerX=0,pointerY=0,tap="mousedown",colors=["#FF1461","#18FF92","#5A87FF","#FBF38C"],setCanvasSize=debounce(function(){canvasEl.width=2*window.innerWidth,canvasEl.height=2*window.innerHeight,canvasEl.style.width=window.innerWidth+"px",canvasEl.style.height=window.innerHeight+"px",canvasEl.getContext("2d").scale(2,2)},500),render=anime({duration:1/0,update:function(){ctx.clearRect(0,0,canvasEl.width,canvasEl.height)}});document.addEventListener(tap,function(e){"sidebar"!==e.target.id&&"toggle-sidebar"!==e.target.id&&"A"!==e.target.nodeName&&"IMG"!==e.target.nodeName&&(render.play(),updateCoords(e),animateParticules(pointerX,pointerY))},!1),setCanvasSize(),window.addEventListener("resize",setCanvasSize,!1)}; </script> /* 鼠标点击求赞文字特效 */ <script type="text/javascript"> var a_idx = 0; jQuery(document).ready(function($) {     $("body").click(function(e) {         var a = new Array(             "❤我欲与君相知,长命无绝衰。山无陵,江水为竭,冬雷震震,夏雨雪,天地合,乃敢与君绝!❤"         ,"❤对酒当歌,人生几何!譬如朝露,去日苦多。慨当以慷,忧思难忘。何以解忧?唯有杜康❤"         ,"❤青青子衿,悠悠我心。但为君故,沉吟至今。呦呦鹿鸣,食野之苹❤"         ,"❤希望天空❤"         ,"❤除了春天、爱情和樱花❤"         ,"❤why❤"         ,"❤少年❤"         ,"❤palette❤"         ,"❤rain❤"         ,"❤君不见黄河之水天上来,奔流到海不复回❤"         ,"❤blueming❤"         ,"❤京口瓜洲一水间,钟山只隔数重山。春风又绿江南岸,明月何时照我还❤");         var $i = $("<span></span>").text(a[a_idx]);         a_idx = (a_idx + 1) % a.length;         var x = e.pageX,         y = e.pageY;         $i.css({             "z-index": 999999999999999999999999999999999999999999999999999999999999999999999,             "top": y - 20,             "left": x,             "position": "absolute",             "font-weight": "bold",             "color": "rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"         });         $("body").append($i);         $i.animate({             "top": y - 180,             "opacity": 0         },         1500,         function() {             $i.remove();         });     }); }); </script> /*鼠标跟随效果*/ <style type="text/css">     .draw {         position: fixed;         width: 1px;         line-height: 1px;         pointer-events: none;     }     @keyframes floatOne {         0% {                     opacity:0.8;         }         50% {                     opacity:0.8;         }         100% {                     opacity:0;             transform:translate3D(0, -20px, 0) scale(5) rotate(45deg);         }     } </style> <script type="text/javascript">     var H = 0;     $(document).bind('mousemove touchmove',function(e) {         e.preventDefault();         var drawSize = 10;         var drawType = '♡';         var floatType = 'floatOne';         var xPos = e.originalEvent.pageX;         var yPos = e.originalEvent.pageY;
        $('body').append('<div class="draw" style=" font-size:'+drawSize+'px;left:'+xPos+'px;top:'+yPos+'px;-webkit-animation:'+floatType+' .9s 1;-moz-animation:'+floatType+' .9s 1;color:#FF83FA;">'+drawType+'</div>');
        $('.draw').each(function() {             var div = $(this);             setTimeout(function() {$(div).remove();},800);         });     }); </script>

 <script src="https://blog-static.cnblogs.com/files/yjlblog/cursor-effects.js"></script>  <canvas width="1366" height="662" style="position: fixed; left: 0px; top: 0px; z-index: 2147483647; pointer-events: none;"></canvas>

<embed frameborder="no" border="1" marginwidth="0" marginheight="0"  width=330 height=450 src="//music.163.com/outchain/player?type=0&id=8805512651&auto=1&height=430">

标签:function,页脚,color,random,ctx,htlm,点击,var,Math
From: https://www.cnblogs.com/wwdbk/p/17770708.html

相关文章

  • h5网页点击一键跳转小程序
    我的需求是从公众号h5页面,点击跳转某个a链接跳转到小程序,此文档也是记录我的实现过程.开发语音:PHP前期准备工作:微信公众号ip白名单设置      js授权安全域名设置     access_token获取权限设置设置此次开发相关的工作:   登录微信公众后......
  • 输入售价后点击计算税费,自动显示在税费输入框!
    <!DOCTYPEhtml><html><headlang="en"><metacharset="UTF-8"></head><body><divstyle="text-align:center;">输入售价后点击计算税费,自动显示在税费输入框!</div><divclass="item&......
  • Android TextView设置某段文字可点击
    初次进入app,需要有个勾选隐私协议的UI,其中的隐私协议文字点击是可跳转到新页面对隐私协议机型展示这里选择使用Android自带的SpannedString来设置TextView的文字内容即可设置点击事件,具体代码如下:tvDesc.text=buildSpannedString{ append("点击开始表示你同意") //设置点击......
  • z-index 点击 不生效 遮挡 如何让被遮挡的下层元素能被点击到(且上层也能) 上层下层都能
    https://stackoverflow.com/questions/64052019/make-element-with-smaller-z-index-clickable一种方案是在上层元素的点击事件调用的函数中,通过js代码,选择器选中下层元素,然后.click()代码触发下层元素的点击事件 (如果上层不需要被点击,可以用pointer-events:none;)......
  • uniapp部分浏览器input框设置disabled之后点击事件不生效
    给input设置css属性,外边包个盒子抛出点击事件 .disabled{pointer-events:none;}......
  • selenium 点击 弹窗中的确认和取消按钮
    html效果 当点击弹窗上的确认按钮后 <!DOCTYPEhtml><html><head><metacharset="UTF-8"><title>弹窗示例</title><style>body{text-align:center;padding-top:50px;}</style></head><body><h1......
  • threejs CSS2DObject点击事件触发不了
    原因:在three.js  0.13X版本后,上面dom的onclick不会触发,原因是控制器Controls,可以尝试一下去掉控制器,看看dom上的点击事件是否ok letobtControls=newOrbitControls(camera,container); // OrbitControls对页面的事件进行监听,并且阻止穿透 ......
  • 视频直播源码,Flutter 富文本 部分文字可以触发点击
    视频直播源码,Flutter富文本部分文字可以触发点击 Widget_buildBottomTip(){  returnContainer(   child:Text.rich(    TextSpan(     children:[      TextSpan(        text:"这是要显示的文字",    ......
  • 【Unity】 ScriptableObject ——生成多个ScriptableObject作为子对象,可以点击展开并
     官方是这么介绍ScriptabelObject的: “ScriptableObject是一个可独立于类实例来保存大量数据的数据容器。ScriptableObject的一个主要用例是通过避免重复值来减少项目的内存使用量。如果项目有一个预制件在附加的MonoBehaviour脚本中存储不变的数据,这将非常有用。每次实......
  • uniapp 点击video全屏播放
    话不多说直接上代码<video:id="item.id"@play="playFullscreen(item.id)":src="$IMG_URL+item.video"></video>不要写点击事件@click不会生效的要写@play播放事件以上代码中由于作者需循环渲染video故id是动态的如果没有动态的需求也可以写死playFullscreen(id){ uni......