3d rotating cube cubelet - Free Download 3D Rotating Cube In jQuery - Cubelet.js

Free Download 3D Rotating Cube In jQuery – Cubelet.js

Posted on

This time I will share jQuery Plugin and tutorial about 3D Rotating Cube In jQuery – Cubelet.js, hope it will help you in programming stack.

3d rotating cube cubelet - Free Download 3D Rotating Cube In jQuery - Cubelet.js
File Size: 75.3 KB
Views Total: 147
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Cubelet.js is a jQuery plugin to create a 3D cube that is rotatable and scalable using CSS3 rotateX, rotateY, rotateZ, and scale properties.

How to use it:

1. Load the Cubelet.js plugin after jQuery library.

1 <script src="/path/to/cdn/jquery.slim.min.js"></script>
2 <script src="/path/to/dist/jquery.cubelet.js"></script>

2. Create a container in which you wish to place the 3D rotating cube.

1 <div class="example-cubelet"></div>

3. Initialize the 3D rotating cube.

1 var $cubelet = $('.example-cubelet');
2 $cubelet.cubeletInit();

4. Get the current rotation coordinates of the cube.

1 $.fn.cubeletGetCoords();
2 // returned object:
3 { x: number, y: number, z: number, scale: number }

5. Set the rotation coordinates of the Cubelet. Sets the internal state of the widget as well as the inline CSS rotate styles. The coordinates parameter accepts any object with the following format:

1 $.fn.cubeletSetCoords({
2   x: number=, y: number=, z: number=, scale: number=
3 })

6. Show & hide the Cubelet.

1 // show
2 $.fn.cubeletShow();
3  
4 // hide
5 $.fn.cubeletHide();
6  
7 // check if is shown
8 $.fn.cubeletIsShown();

7. Takes the Cubelet’s current rotation coordinates and apply them to another jQuery collection. Note that this will overwrite any inline transform styles currently set on these elements.

1 $.fn.cubeletApplyRotationToElement(el);