javascript - THREE.JS Creating an object dynamically -
javascript - THREE.JS Creating an object dynamically -
i have json config like:
{ shape:[ 'spheregeometry', [7, 16, 16] ] }
and seek load model like:
new three[shape[0]].apply( this, shape[1] )
as can see "new" , "apply" not alternative here. know trick or tip how can solve problem here?
thank in advance.
the solution based on use of .apply() 'new' operator. possible?
json config
{ shape: 'spheregeometry', properties: [ null, 7, 16, 16 ] }
and creating new object:
new (function.prototype.bind.apply( three[object.shape], object.properties ))
javascript three.js
Comments
Post a Comment