js实现canvas粒子立体球转动效果代码
代码语言:html
所属分类:粒子
代码描述:js实现canvas粒子立体球转动效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
html,
body {
background: #111;
text-align: center;
}
canvas {
margin: 0 auto;
box-sizing: content-box;
}
</style>
</head>
<body>
<canvas id="c"></canvas>
<script >
var canvas,
ctx,
sphere = new Sphere3D(40),
distance = 300,
mouse = {
down: false,
button: 1,
x: 0,
y: 0,
px: 0,
py: 0 },
modify = 1;
window.requestAnimFrame =
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function (callback) {
window.setTimeout(callback, 1000 / 60);
};
Number.prototype.clamp = function (min, max) {
return Math.min(Math.max(this, min), max);
};
function Point3D() {
this.x = 0;
th.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0