如何在 HTML5 中绘制 3D 球体?


要创建一个 3D 球体,请使用 HTML5 画布。你可以在代码中使用以下函数

function display(r) {
   this.point = new Array();
   this.color = "blue)"
   this.r = (typeof(r) == "undefined") ? 20.0 : r;
   this.r = (typeof(r) != "number") ? 20.0 : r;
   this.vertexes = 0;

   for(alpha = 0; alpha <= 6.28; alpha += 0.17) {
      p = this.point[this. vertexes] = new Point3D();
      p.x = Math.cos(alpha) * this.r;
      p.y = 0;
      p.z = Math.sin(alpha) * this.r;
      this.vertexes ++;
   }
}

更新于: 2020 年 6 月 25 日

601 次浏览

开启你的 职业生涯

完成课程,获得认证

开始
广告
© . All rights reserved.