canvas模拟迷你太阳系行星运行旋转图

代码语言:html

所属分类:动画

代码描述:通过canvas来绘制迷你太阳系行星运行旋转图,大小近1kb的代码量,非常简洁

代码标签: 太阳系 行星 运行 旋转

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

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
body {
  background: #111;
}

canvas {
  display: block;
  margin: 0 auto;
  width: 600px;
}
</style>

</head>
<body translate="no">
<canvas id="canvas" width="600" height="600"></canvas>

<script >
let a = document.querySelector('canvas'),c = canvas.getContext('2d'),i,H = 600,M = Math,S = function () {let a = this;a.x, a.y, a.a = [], a.l = {}, a.n = 0;};S.prototype.P = function (a) {let d = this;a[6] = null == a[6] ? d : d.l[a[6]];let e = new B(a);e.U(), d.a.push(e), d.l[a[0]] = e, d.n++;}, S.prototype.U = function () {for (i = 0; i < this.n; i++) {let a = this.a[i];a.U();}};var B = function (a) {let d = this;return d.id = a[0], d.d = a[1], d.o = a[2], d.s = a[3], d.c = '#' + a[4], d.r = a[5], d.p = a[6], d.x, d.y, d.vx, d.vy, d;};B.prototype.U.........完整代码请登录后点击上方下载按钮下载查看

网友评论0