jquery实现彩色粒子圈圈连线动画效果代码
代码语言:html
所属分类:粒子
代码描述:jquery实现彩色粒子圈圈连线动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!doctype html> <html> <head> <meta charset="utf-8"> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script> <style> @import url("https://fonts.googleapis.com/css?family=Montserrat:200,300,400,600"); .more-pens { position: fixed; left: 20px; bottom: 20px; z-index: 10; font-family: "Montserrat"; font-size: 12px; } a.white-mode, a.white-mode:link, a.white-mode:visited, a.white-mode:active { font-family: "Montserrat"; font-size: 12px; text-decoration: none; background: #212121; padding: 4px 8px; color: #f7f7f7; } a.white-mode:hover, a.white-mode:link:hover, a.white-mode:visited:hover, a.white-mode:active:hover { background: #edf3f8; color: #212121; } body { margin: 0; padding: 0; overflow: hidden; width: 100%; height: 100%; background: #000000; } .title { z-index: 10; position: absolute; left: 50%; top: 50%; transform: translateX(-50%) translateY(-50%); font-family: "Montserrat"; text-align: center; width: 100%; } .title h1 { position: relative; color: #EEEEEE; font-weight: 600; font-size: 60px; padding: 0; margin: 0; line-height: 1; text-shadow: 0 0 30px #000155; } .title h1 span { font-weight: 600; padding: 0; margin: 0; color: #BBB; } .title h3 { font-weight: 200; font-size: 20px; padding: 0; margin: 0; line-height: 1; color: #EEEEEE; letter-spacing: 2px; text-shadow: 0 0 30px #000155; } </style> </head> <body> <!--<div class="title"> <h3>PLASM.it - 2017</h3> <h1>CONNECTIONS</h1> <h3>dot-life</h3> </div>--><script> let max_particles = 100; let particles = []; let frequency = 100; let init_num = max_particles; let max_time = frequency*max_particles; let time_to_recreate = false; // Enable repopolate setTimeout(function(){ time_to_recreate = true; }.bind(this), max_time) // Popolate particles popolate(max_particles); var tela = document.createElement('canvas'); tela.width = $(window).width(); tela.height = $(window).height(); $("body").append(tela); var canvas = tela.getContext('2d'); class Particle{ constructor(canvas, options){ let colors = ["#feea00","#a9df85","#5dc0ad", "#ff9a00","#fa3f20"] let types = ["full","fill","empty"] this.random = Math.random() this.canvas = canvas; this.progress = 0; this.x = ($(window).width()/2) + (Math.random()*200 - Math.random()*200) this.y = ($(window).height()/2) + (Math.random()*200 - Math.random()*200) this.w = $(window).width() this.h = $(window).height() this.radius = 1 + (8*this.random) this.type = types[this.randomIntFromInterval(0,types.length-1)]; this.color = colors[this.randomIntFromInterval(0,colors.length-1)]; this.a = .........完整代码请登录后点击上方下载按钮下载查看
网友评论0