Html 3D Cube Control
For a while I have been experimenting with creating 3D objects in a regular web browser without resorting to plugins such as Flash, Silverlight etc. The Cube shown here is adapted from another 3D website I made earlier.
WebGL enables us to render complex 3D models in a browser. However, here I will be looking at creating a 3D object using the various CSS3 transform commands that can take a regular 2D Html element and project it into 3D space.
The advantage of using 3D transforms on regular Html elements is you can project things like Iframe content, images or any other html element into 3D creating some really neat effects.
As the 3D cube shown here uses CSS3 Matrix Transforms rather than the plain Rotate, Scale, Translate methods used by some other 3D Cubes, it works well in IE11. As well as IE11, it has been tested in Firefox, Chrome, Safari and Mobile Safari for iOS.
The important bit here is we include the "Cube.js" file. We also need JQuery, that is included as well.
The Div with the ID my3Dsurface will contain our 3D cube. Notice the data-facewidth="256" attribute. This specifies the size of our cube faces.
Next we create an instance of Js3DSurface and pass it an array of content that will be displayed on each face of our cube. In this example we are using images and simple html content. You can add more complex html such as Iframes, Video tags etc.
We also add 3 event handlers to enable us to spin the cube using the mouse. When the mouse moves with the left mouse button down, we call adjRot passing it the new X and Y position of the mouse.
Grab the sample code yourself from the link below and start creating cool 3D project Html cubes!
You need to login to 3D Cube in Css3: 3dCss3.zip, If you do not have a login you can register for free!
Drive fast before the crazy mutant zombies get you!
Guide the car to its parking space in this fun Car Parking game.
Aim for the Trash Can and get the various items of Trash in the bin.
Fly your plane in this colorful vertical scrolling shoot-em-up. Blast the bad guys and collect any bonus's they leave behind.
Pop as many bubbles as possible in this fun and colorful bubble popping game. The levels start off easy enough but gradually get harder!
Here we have a bunch of monsters that need to be matched up. Look out for the bomb and spinning monsters that will cause special damage!
Guide your friendly Bird through the maze of pipes and other obstacles collecting the Stars in this cool arcade game inspired by the legendary Flappy Bird.
You are stranded on an Alien planet. Your goal is to build a space rocket and escape. Start by building units to create power and mine the metal patches. Build defenses to defend your base from the advancing Aliens and Zombies!
Play Pool against the computer or battle against your friends in the online mode!
Slice the fruit that is thrown up onto the screen. Slice the fruit into multiple pieces for maximum points!
devesh gupta wrote: