three.js all in one
2024-10-10 10:20:22
three.js all in one
https://www.npmjs.com/package/three
# yarn add three
# OR
$ npm i three
https://github.com/mrdoob/three.js
https://threejs.org/docs/index.html#manual/en/introduction/Installation
import * as THREE from './js/three.module.js';
var camera, scene, renderer;
var geometry, material, mesh;
init();
animate();
function init() {
camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.01, 10 );
camera.position.z = 1;
scene = new THREE.Scene();
geometry = new THREE.BoxGeometry( 0.2, 0.2, 0.2 );
material = new THREE.MeshNormalMaterial();
mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
}
function animate() {
requestAnimationFrame( animate );
mesh.rotation.x += 0.01;
mesh.rotation.y += 0.02;
renderer.render( scene, camera );
}
WebGL
canvas
old version
https://www.npmjs.com/package/three.js
# yarn add three.js
# OR
$ npm i three.js
refs
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
最新文章
- Memo
- ASP.Net请求处理机制初步探索之旅 - Part 1 前奏
- springmvc处理上传图片代码(校验图片尺寸、图片大小)
- CI框架入门1
- XML转JSON
- MySQL的几种连接 join/inner join/cross join/逗号/left join/right join/natural join
- Python argparse
- javascript实现栈功能
- 关于bootstrap--列表(ol、ul)
- winform程序中Label自动换行
- 一张地图告诉你,只JavaScript不够!
- DotNetOpenAuth搭建OAuth2.0
- 在Eclipse中用TODO标签管理任务(Task)
- hzoj 2301(莫比乌斯反演)
- 热烈庆祝自已厉精13年开发的 DB查询分析器 7.01(最新版本) 在中关村在线本月获得近6000次的下载量
- JS 数据类型、赋值、深拷贝和浅拷贝
- PTA第四次作业
- Windows7下Jupyter Notebook使用入门
- 【python小工具】我在bilibili个人资料里控制家里的电脑
- JS Function类型
热门文章
- You shouldn't use *any* general-purpose hash function for user passwords, not BLAKE2, and not MD5, SHA-1, SHA-256, or SHA-3
- https://github.com/golang/go/wiki/CommonMistakes
- 阿里一面,给了几条SQL,问需要执行几次树搜索操作?
- 采用pandas读取文件,进行自动化统计小程序
- 深度学习论文翻译解析(十八):MobileNetV2: Inverted Residuals and Linear Bottlenecks
- Python 字符串指定位置替换字符
- LSTM机器学习生成音乐
- getline()的使用注意
- 2019牛客暑期多校训练营(第三场)G.Removing Stones(ST+分治)
- Codeforces Round #627 (Div. 3) A - Yet Another Tetris Problem(逻辑)