![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to draw a 3D sphere in HTML5?
To create a 3D sphere, use the HTML5 canvas. You can use the following function in your code:
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 ++; } }
Advertisements