è¶ ç°¡åã«3DCGã§ããJavaScriptã©ã¤ãã©ãªä½ã£ã
ãã©ã¦ã¶ã§WebGLã使ããããã«ãªã£ã¦3DCGããã°ã©ãã³ã°ã¯ããã¶ã身è¿ãªãã®ã«ãªãã¾ãããã¨æ¸ãã¦ããã°ããéåæãæãããããçã®WebGLãJavaScriptã§æ¸ãã®ã¯æ·å±
ãé«ãã£ãããã¾ããã§ããªãã¯ãªããã©åæã¨ãªãç¥èãããªãå¿
è¦ãªæãã
ã
three.jsãç»å ´ããã¨ãã¯ãããã§æ®éã«3DCGãã§ããã¨ãããã¨ã§ä¸æ°ã«ã²ãã¾ãã¾ãããã¨ã¯ãããããã§ãã¾ã ãããã¨ã¯å¤ããç»é¢ã«åè§ãç®±ã表示ããå ´å以ä¸ã®ãããªããã°ã©ã ãæ¸ããã¨ã«ãªãã¾ãã
ãã»ã·ã¼ã³ãä½æ
ãã»ã©ã¤ããä½æãä½ç½®ã¨åããè¨å®ãã·ã¼ã³ã«è¿½å
ãã»ã«ã¡ã©ãä½æãä½ç½®ã¨åããè¨å®ãã·ã¼ã³ã«è¿½å
ãã»ãããªã¢ã«ãä½æãè²ãæå®
ãã»BoxGeometryãä½æããµã¤ãºãæå®
ãã»ã¡ãã·ã¥ãä½æãä½ç½®ã¨åããè¨å®ãã·ã¼ã³ã«è¿½å
ãã»ã¬ã³ãã©ã¼ãä½æ
ãã»ã¬ã³ããªã³ã°ã«ã¼ãå¦ç
ãããã®ã²ã¨ã¤ã§ãééããããã©ã¡ã¼ã¿ã¼ãé©åã§ãªãã¨ç®±ã¯è¡¨ç¤ºããã¾ããã
ã
ãããªããã§ãè¶
ç°¡åã«3DCGãæããthree.jsã®ã©ããã¼ã©ã¤ãã©ãªãä½æãã¾ããã
http://aikelab.net/threepiece/
https://github.com/aike/ThreePiece.js
ã
â ããã¯ã¹ã表示
var t = new ThreePiece(); t.eval({obj:"box"});
ãã®ã©ã¤ãã©ãªã®åºæ¬çãªæ¹éã¨ãã¦ã¯ãã©ã¤ããã«ã¡ã©ãããã©ã«ãå¤ãæã£ã¦ãã¦ãä½ãæå®ããªãã¨ããã©ã«ãå¤ã使ãããã¨ãããã®ã§ãããªãã¸ã§ã¯ããçæããã¨ç»é¢ã®è¦ãããä½ç½®ã«è¦ãããè²ãè¦ããã大ããã§è¡¨ç¤ºããã¾ããDOMããªã¼ä¸ã®ä½ç½®ããdivã®IDãæå®ãããdivã®ä¸ã«çæããçç¥ããã¨bodyã®ç´ä¸ã«çæãã¾ãã
ã
â è¤æ°ãªãã¸ã§ã¯ãã®è¡¨ç¤º
ãªãã¸ã§ã¯ãã追å ããããã°ãªãããæãããã¯ãããªæãã
var t = new ThreePiece(); t.eval([ {obj:"grid"}, {obj:"box", x:-1, col:0xffff00}, {obj:"sphere", x:1, col:0x0000ff} ]);
ã
â è¦ç¹ã®å転
3DCGã¯ãä¸æ¹åããè¦ãã ãã§ã¯ãåãªãã¸ã§ã¯ãã®ä½ç½®é¢ä¿ããããã¥ãããã¾ãã«ã¡ã©ã®å¾ãå´ã«ãªãã¸ã§ã¯ããçæããã¦ãããã¨ãããã¨ããã£ãããã¾ããããããã¨ãã®ãã©ã¡ã¼ã¿ã¼èª¿æ´ã«ä¾¿å©ãªãè¦ç¹ãå転ããrotate()å½ä»¤ãç¨æãã¾ããã
var t = new ThreePiece(); t.eval([ {obj:"ground"}, {obj:"box", x:-2, scale:2}, {obj:"cylinder", x:2, scale:2, col:0x0000FF}, ]); t.rotate();
ã
â ã¢ãã«ã«ååãã¤ãã¦æä½
ã¢ãã«ã«ååãã¤ãã¦ãå¾ããååã§æ¤ç´¢ãã¦æä½ãããã¨ãã§ãã¾ãã
ã¾ããaddHook()ã使ããã¨ã§ãã¬ã³ããªã³ã°ã«ã¼ãã«ç¬èªã®å¦çã追å ã§ãã¾ãã
var t = new ThreePiece(); t.eval([ {obj:"grid"}, {obj:"box", name:"myobj"} ]); t.addHook(function(msec) { t.obj("myobj").position.x = Math.sin(msec / 1000) * 4; });
ã
â ã°ã«ã¼ãå
ã¢ãã«ãè¤éã«ãªã£ã¦ããã¨ãè¤æ°ã®ã¢ãã«ãã°ã«ã¼ãåãããããªãã¸ã§ã¯ãã«å¤åããã£ãã¨ãã®ã¿åæç»ããã(ãããããã¼ãã£ã¼ãã©ã°)ã¨ãã£ãæ©è½ãã»ãããªãã¾ãã
var t = new ThreePiece(); t.define("face", {obj:"group", z:2, data:[ {obj:"box", col:0xEEEEEE}, {obj:"circle", w:0.1, z:0.51, x:-0.2, y:0.2, col:0x222222}, {obj:"circle", w:0.1, z:0.51, x: 0.2, y:0.2, col:0x222222}, {obj:"plane", w:0.6, h:0.2, z:0.51, y:-0.2, col:0xAA2222} ]}); var data = [ {obj:"grid"}, {obj:"face", x:-3, y:0}, {obj:"face", x: 0, y:0, name:"centerface"}, {obj:"face", x: 3, y:0} ]; t.useDirtyFlag(); t.eval(data); var pos = 1; setInterval(function() { pos = 1 - pos; t.obj("centerface").position.y = pos; t.setDirty(); }, 500);
ã
â å¿ç¨ä¾
ããã°ãã°ãããªãã¨ãã§ãã¾ãã
http://aikelab.net/websynthv2/
ã
Enjoy!
ã
- ä½è : é è¤çå¹³
- åºç社/ã¡ã¼ã«ã¼: ã«ããã·ã¹ãã
- çºå£²æ¥: 2013/09/01
- ã¡ãã£ã¢: åè¡æ¬
- ãã®ååãå«ãããã°ãè¦ã
MOOG ã¢ã¼ã° / Minimoog Voyager Select Series Blue/Quarter Sawn
- åºç社/ã¡ã¼ã«ã¼: moog
- ã¡ãã£ã¢:
- ãã®ååãå«ãããã°ãè¦ã