ソース掲示板




すべてから検索

キーワード   条件 表示 現行ログ 過去ログ トピックス 名前 本文
Three.js キューブデモを Shdowbox IFRAME に documet.write で実装
日時: 2013/03/30 03:35
名前: lightbox








<script type="text/javascript">
if ( window['loadjQuery'] !== true ) {
	window['loadjQuery'] = true;
	document.write("<"+"script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js\"></"+"script>");
}
</script>
<script type="text/javascript" src="http://homepage2.nifty.com/lightbox/sbx33/loadShadowbox.js"></script>
<script type="text/javascript">
$(function(){
	$("#image1").click(function(){
			Shadowbox.open({ 
				player: 'iframe', 
				content: 'about:blank', 
				options: { 
					onFinish: function() {
						setTimeout(  function() {
							var doc = document.getElementById("sb-player").contentWindow.document;

str="";
str+="<"+"script type=\"text/javascript\" src=\"http://homepage2.nifty.com/lightbox/three/three.min57.js\" charset=\"utf-8\"></"+"script> \n";
str+="<"+"script type=\"text/javascript\" src=\"http://homepage2.nifty.com/lightbox/three/user_cubes1.js\" charset=\"utf-8\"></"+"script> \n";
str+="<"+"script type=\"text/javascript\" src=\"http://homepage2.nifty.com/lightbox/three/user_play1.js\" charset=\"utf-8\"></"+"script> \n";
str+=" \n";
str+="<"+"script type=\"text/javascript\"> \n";
str+=" \n";
str+="var w = 600,h = 500; \n";
str+="var camera, scene, renderer; \n";
str+="var user_play; \n";
str+=" \n";
str+="// 表示エリア作成 \n";
str+="document.write(\"<div id=\\\"three_area\\\" style='width:100%;height:100%;'></div>\"); \n";
str+=" \n";
str+="// 処理開始 \n";
str+="build_3d_world(); \n";
str+=" \n";
str+="function build_3d_world() { \n";
str+=" \n";
str+="	// カメラ \n";
str+="	camera = new THREE.PerspectiveCamera( 70, w / h, 1, 10000 ); \n";
str+=" \n";
str+="	// シーン \n";
str+="	scene = new THREE.Scene(); \n";
str+=" \n";
str+="	// オブジェクト \n";
str+="	var UserCubes = new THREE.UserCubes1( scene ); \n";
str+=" \n";
str+="	// レンダラー \n";
str+="	renderer = new THREE.CanvasRenderer(); \n";
str+="	renderer.setSize( window.innerWidth, window.innerHeight ); \n";
str+=" \n";
str+="	// 実装 \n";
str+="	document.getElementById(\"three_area\").appendChild( renderer.domElement ); \n";
str+=" \n";
str+="	// アニメーション \n";
str+="	user_play = new THREE.UserPlay1( scene, camera, renderer, animate ); \n";
str+="	user_play.start(); \n";
str+=" \n";
str+="} \n";
str+="// ループ処理 \n";
str+="function animate() { \n";
str+=" \n";
str+="	requestAnimationFrame( animate ); \n";
str+="	user_play.render(); \n";
str+=" \n";
str+="} \n";
str+=" \n";
str+="</"+"script> ";
							doc.write(str);

							doc.close();
						},100 );
					}
				} 
	
			}); 

});
});
</script>
メンテナンス


日時: 2013/03/30 03:35
名前: lightbox