Home >Web Front-end >JS Tutorial >Three-dimensional cube implemented in javascript (compatible with ie7, ff)_image special effects

Three-dimensional cube implemented in javascript (compatible with ie7, ff)_image special effects

WBOY
WBOYOriginal
2016-05-16 19:06:101267browse

Record the rotation by updating the transformation matrix (function remx()).
Use the matrix to calculate the coordinates of the rotated cube vertices,
Convert the spatial coordinates of each vertex into plane coordinates according to "near large, far small" (function p2d()),
Use the z coordinate of the normal vector of each face of the cube to determine whether the face is visible,
Use a div layer with a height of 1px to simulate drawing a quadrilateral (function gra2htm()).
Drag the mouse The code is modified with someone else’s code.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn