admin管理员组文章数量:1431727
Hi so I have a code as follows for dat.GUI interface.
var gui = new dat.GUI();
var obj1 = { x: 5};
gui.add(obj1, 'x');
How do I get the value of x from the gui into a variable? for example
var xval = (something that returns the value of x from the gui)
If I do var xval = obj1;
and I did console.log(xval)
then I would get this Object {x=5}
Just wondering how to get the value of that 5 out into a variable.
Thanks for the help in advance!
Hi so I have a code as follows for dat.GUI interface.
var gui = new dat.GUI();
var obj1 = { x: 5};
gui.add(obj1, 'x');
How do I get the value of x from the gui into a variable? for example
var xval = (something that returns the value of x from the gui)
If I do var xval = obj1;
and I did console.log(xval)
then I would get this Object {x=5}
Just wondering how to get the value of that 5 out into a variable.
Thanks for the help in advance!
2 Answers
Reset to default 4You just have to call the x ponent from the object just like you would with a geometry.
var xval = obj1.x;
i am not worked with three.js in the past but in plain it would be for example:
var obj1 = { x: 5};
var xval = obj1.x;
console.log(xval);
本文标签: Javascript Getting values from datGUIStack Overflow
版权声明:本文标题:Javascript Getting values from dat.GUI - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745567005a2663820.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论