canvas彩色瀑布雾气动画效果代码

代码语言:html

所属分类:动画

代码描述:canvas彩色瀑布雾气动画效果代码

代码标签: canvas 彩色 瀑布 雾气 动画

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

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" />


</head>

<body>
    <canvas height="300" width="200" id="d"></canvas>
    <script type="text/javascript">
     //initial
var w = d.width = window.innerWidth,
    h = d.height = window.innerHeight,
    ctx = d.getContext('2d'),

    //parameters
    total = (w / 8) | 0,
    accelleration = .05,
    lineAlpha = .02,
    range = 25,

    //afterinitial calculations
    size = w / total,
    occupation = w / total,
    repaintColor = 'rgba(0, 0, 0, .04)'
colors = [],
dots = [],
dotsVel = [];

//setting the colors' hue
//and y level for all dots
var portion = 360 / total;
for (var i = 0; i < total; ++i) {
    colors[i] = portion * i;

   .........完整代码请登录后点击上方下载按钮下载查看

网友评论0