gsap实现铁花飞舞粒子动画效果代码

代码语言:html

所属分类:粒子

代码描述:gsap实现铁花飞舞粒子动画效果代码

代码标签: 飞舞 粒子 动画 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">


  <title></title>
  
  
  
  
<style>
body {
 background: #000;
 overflow: hidden;
 text-align:center;
  display: flex;
  align-items: center;
  justify-content: center; 
}

body,
html {
 height: 100%;
 width: 100%;
 margin: 0;
 padding: 0;
}

svg {
 width: 100%;
 height: 100%;
 visibility: hidden;
 
}

.p {
	stroke: #00B0F8;
	stroke-width: 1px;
	/* stroke-linecap: round; */
/* 	mix-blend-mode: overlay; */
}

#ring {
	fill: none;
	/* mix-blend-mode: overlay; */
	stroke-width: 2px;
	stroke: #00E3FF;
	stroke-linecap: round;
	/* stroke-dasharray: 12 4; */
}
</style>


</head>

<body >
  <svg id="mainSVG" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600">

	<defs>
     <filter id="glow" x="-100%" y="-100%" width="250%" height="250%">
        <feGaussianBlur stdDeviation="16" result="coloredBlur" />
        <feOffset dx="0" dy="0" result="offsetblur"></feOffset>
        <feFlood id="glowAlpha" flood-color="#0096E9" flood-opacity="0.4"></feFlood>
        <feComposite in2="offsetblur" operator="in"></feComposite>
        <feMerge>
          <feMergeNode/>          
          <feMergeNode in="SourceGraphic"></feMergeNode>
        </feMerge>
      </filter>		
		<line class="p" x1="0" x2="0" y1="0" y2="0"/>
		</defs>
	<g filter="url(#glow)">
<g id="wheel" />
		</g>
	<circle id="ring" cx="400" cy="300" r="150"/>
</svg>

<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.5.2.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/DrawSVGPlugin3.min.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/Physics2DPlugin3.min.js"></script>
      <script >
let select = s => document.querySelector(s),
  selectAll = s =>  document.querySelectorAll(s),
		mainSVG = select('#mainSVG'),
		wheel = select('#wheel'),
		ring = select('#ring'),
		numEmitters = 50,
		numParticles = 6,
		mainCircleRadius = 100,
		step = 360 / numEmitters,
		xmlns = "http://www.w3.org/2000/svg",
		emitterArr = [],
		p = select('.p'),
		emmitterTl = gsap.timeline(),
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0