gsap实现canvas绿色气泡上升动画效果代码

代码语言:html

所属分类:动画

代码描述:gsap实现canvas绿色气泡上升动画效果代码

代码标签: gsap canvas 绿色 气泡 上升 动画

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

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

<head>
  <meta charset="UTF-8">
  

  <meta name="viewport" content="width=device-width, initial-scale=1">
  
  
  
<style>
html, body {
  margin:0;
  padding:0;
  width:100%;
  height:100%;
}

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


  
</head>

<body >
  <canvas></canvas>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.11.0.js"></script>
      <script >
const c = document.querySelector('canvas')
const ctx = c.getContext('2d')
const cw = c.width = innerWidth*0.4
const ch = c.height = innerHeight//*0.9
const dots = Array(750)
const dur = 25
const hue = 105
const mPos = {x:cw/2, y:ch}

c.onpointermove = (e)=> gsap.to(mPos, {x:e.offsetX, y:e.offsetY})

for (let i=0;.........完整代码请登录后点击上方下载按钮下载查看

网友评论0