
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
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 ++; } }
- Related Articles
- How to create a Sphere (3D) in JavaFX?
- How to draw a rectangle in HTML5 SVG?
- How to draw a polygon in HTML5 SVG?
- How to draw a polyline in HTML5 SVG?
- How to draw a star in HTML5 SVG?
- How to draw a circular gradient in HTML5?
- Plotting a 3d cube, a sphere and a vector in Matplotlib
- How to draw a line with lineTo() in HTML5?
- How to draw a circle with arc() in HTML5?
- How to draw a text with fillText() in HTML5?
- How to draw a text with strokeText() in HTML5?
- How to draw SVG Logo in HTML5?
- How to draw a rectangle on HTML5 Canvas?
- How to draw an oval in HTML5 canvas?
- How to draw shapes using SVG in HTML5?

Advertisements