canvas彩色流体线条动画效果代码

代码语言:html

所属分类:动画

代码描述:canvas彩色流体线条动画效果代码

代码标签: canvas 彩色 流体 线条

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">




    <style>
        body {
          color: #fff;
          background: #123;
          display: flex;
          justify-content: center;
          align-items: center;
          height: 100vh;
          margin: 0;
        }
        
        canvas {
          background: #000;
          width: 100vmin;
          height: 100vmin;
        }
    </style>



</head>

<body>
    <canvas></canvas>

    <script>
        console.clear();
        
        const canvas = document.querySelector("canvas");
        const ctx = canvas.getContext("2d");
        
        const actualDPR = () => Math.min(2, window.devicePixelRatio);
        
        
        let currentDPR = actualDPR();
        const dimensions = {
          get width() {
            return canvas.clientWidth * currentDPR;
          },
          get height() {
            return canvas.clientHeight * currentDPR;
          } };
        
        
        const field = {
          rows: 0,
          cols: 0,
          items: [] };
        
        
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0