Home >Web Front-end >HTML Tutorial >一个轻量级的3D CSS 库_html/css_WEB-ITnose

一个轻量级的3D CSS 库_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-21 08:57:00850browse

JavaScript 3D library

该项目的目的是为了打造轻量级的、实用简单的3D CSS库。

Usage使用方法

下载 minified库文件 和 css文件,并将其包含于你的HTML中,就如此简单。

<script src="js/voxelcss.js"></script><link rel='stylesheet' href="css/voxel.css"></link>

下面这段代码既是对其应用:

<script>    var scene, world, editor;    init();    function init() {    scene = new voxelcss.Scene();    scene.rotate(-Math.PI / 8, Math.PI / 4, 0);    scene.attach(document.body);    var lightSource = new voxelcss.LightSource(300, 300, 300, 750, 0.3, 1);    scene.addLightSource(lightSource);    world = new voxelcss.World(scene);    editor = new voxelcss.Editor(world);    editor.enableAutoSave();    editor.load();    if(world.getVoxels().length === 0)      editor.add(new voxelcss.Voxel(0, 0, 0, 100, {        mesh: voxelcss.Meshes.grass      }));    }</script>
  • 官方文档
  • 3D CSS 应用  Demo
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