js绘制一个canvas雪花形状动画旋转效果代码

代码语言:html

所属分类:动画

代码描述:js绘制一个canvas雪花形状动画旋转效果代码

代码标签: canvas 雪花 形状 动画 旋转 效果

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

<!doctype html>
<html>
<head>
<meta charset="utf-8">


<style>
* {
  margin: 0;
  overflow: hidden;
  background-color: #000;
}
canvas {
  display: block;
  margin: 0 auto;
  margin: calc(50vh - 250px) auto;
}</style>
</head>
<body>

<canvas id='c'></canvas>

<script>
var c = document.getElementById("c");
var ctx = c.getContext("2d");
var cw = c.width = 500;
var ch = c.height = 500;
var cx = cw / 2,
  cy = ch / 2;
var rad = Math.PI / 180;
var frames = 0;

ctx.lineWidth = 1;
ctx.strokeStyle = "hsla(210,90%,50%,.5)";
ctx.shadowBlur = 15;
ctx.shadowOffsetX = 1;
ctx.shadowOffsetY = 1;
ctx.shadowColor = "hsla(210,90%,50%,1)";

var I = 25;
var a = 6 * I;
var b = 1 * I;

var h = 0;
var r.........完整代码请登录后点击上方下载按钮下载查看

网友评论0