Three.js
three.jsは、ウェブブラウザ上でリアルタイムレンダリングによる3次元コンピュータグラフィックスを描画する、クロス�…
|
Three.jsの例のスクリーンショット | |
| 作者 | Ricardo Cabello (Mr.doob) |
|---|---|
| 開発元 | Three.js Authors[1] |
| 初版 | 2010年4月24日[2] |
| 最新版 |
185[3] |
| リポジトリ | |
| プログラミング 言語 | JavaScript |
| サイズ | 409,474 KB, gzip: 98,706 KB[2] |
| サポート状況 | アクティブ |
| 種別 | JavaScriptライブラリ |
| ライセンス | MITライセンス[1] |
| 公式サイト |
threejs |
three.jsは、ウェブブラウザ上でリアルタイムレンダリングによる3次元コンピュータグラフィックスを描画する、クロスブラウザ対応の軽量なJavaScriptライブラリおよびAPIである。
HTML5のcanvas要素、Scalable Vector Graphics、WebGLとの組み合わせが可能である。ソースコードはGitHubでホストされている。
WebGLというWeb標準技術の登場により[4]、商用のブラウザ拡張機能に頼らずに、HTMLファイル内に埋め込まれたJavaScriptを介して、GPUアクセラレーションによる動的表現を描画することが可能になった[5][6]。three.jsは、WebGLのAPIを簡略化するためのラッパである。
例
ライブラリは単一のJavaScriptファイルであり、以下のようにHTML内でローカルやリモートコピーにリンクすることで動作する。
<script src="js/three.min.js"></script>
以下のコードはdocument.body要素内に、画面上にカメラ、XY軸で回転する立方体、WebGL描画表示域を追加する。
<script>
var camera, scene, renderer,
geometry, material, mesh;
init();
animate();
function init() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.z = 1000;
geometry = new THREE.BoxGeometry( 200, 200, 200 );
material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );
mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
}
function animate() {
requestAnimationFrame( animate );
render();
}
function render() {
mesh.rotation.x += 0.01;
mesh.rotation.y += 0.02;
renderer.render( scene, camera );
}
</script>
脚注
- ^ a b “Three.js/license”. github.com/mrdoob. 2012年5月20日閲覧。
- ^ a b “Three.js/readme.md”. github.com/mrdoob. 2012年5月20日閲覧。
- ^ “Release 185” (2026年6月25日). 2026年6月25日閲覧。
- ^ “Khronos Releases Final WebGL 1.0 Specification”. Khronos Group. March 3, 2011. 2012年6月2日閲覧.
- ^ O3D
- ^ Unity
外部リンク
- 公式ウェブサイト
- three.js - GitHub
- Three.js (@threejs) - X(旧Twitter)
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.