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

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -