Babylonjs模型3D设计,让HTML5可以开发3D效果,并支持 3DMax 大型3D渲染
Babylonjs
<script src="./script/babylon.custom.js"></script>
<canvas id="renderCanvas" touch-action="none"></canvas>
<script type="text/javascript">
var createScene = function () {
var scene = new BABYLON.Scene(engine);
var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 3, BABYLON.Vector3.Zero(), scene);
camera.attachControl(canvas, true);
camera.useAutoRotationBehavior = true;
camera.autoRotationBehavior.idleRotationSpeed = 1; //自动旋转速度
camera.autoRotationBehavior.idleRotationWaitTime = 1000; //用户交互后多少时间开启自动旋转(毫秒)
camera.autoRotationBehavior.idleRotationSpinupTime = 1000; //从开始自动旋转到设置的旋转速度所需要的时间(毫秒)
camera.autoRotationBehavior.zoomStopsAnimation = true; //设置缩放是否会停止自动旋转
var light1 = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(1, 1, 0), scene);
var light2 = new BABYLON.PointLight("light2", new BABYLON.Vector3(0, 1, -1), scene);
var sphere = BABYLON.MeshBuilder.CreateSphere("sphere", {}, scene);
return scene;
};
var demo = {
constructor: createScene,
onload: function () {
}
};
</script>
使用本插件注意会与同Babylonjs插件冲突,请开发者谨慎选择,本插件为1.0版本,后续会陆续更新。