How to change object in one sitepage?(three.js) -
i want build gallery of 3d objects,but when finish showing 1 object, how can change object pressing ?how delete first object , release memorise? knowledges should learn?
i've tried build-and-remove iframes display object receive memory leak : here part of code:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <script language="javascript"> <!-- $=function(s){return document.getelementbyid(s)} window.onload=function(){ var t=[]; var btn1=$('btn1'),btn2=$('btn2'),btn3=$('btn3'); btn1.onclick=function(){ if($('ifm1'))return; var c=$('content'); var ifm=document.createelement('iframe'); ifm.src='a.html'; ifm.id='ifm1'; c.appendchild(ifm); t.push(ifm); } btn2.onclick=function(){ var ifm=$('ifm1'); ifm.src=""; ifm.parentnode.removechild(ifm); } } //--> </script> </head> <body> <input id="btn1" type="button" value="open"/> <input id="btn2" type="button" value="close"/> <div id="content"></div> </body> </html>
well, want create of gallery objects , show 1 @ time, putting others visible:false
(with use of traverse
function). when you're finished 1 object - delete scene, same way added there in first place (adding: scene.add()
; deleting: scene.remove()
). way won't have memory leaking.
Comments
Post a Comment