带有参数的Dat.gui函数调用?

编程入门 行业动态 更新时间:2024-10-25 03:29:21
本文介绍了带有参数的Dat.gui函数调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我对 dat.gui 很陌生。根据此小教程,您可以从以下位置调用对象的函数gui,只需将其传递给gui的 add 函数:

I am quite new with dat.gui. According to this little tutorial, you can invoke an object's function from the gui, just passing it to the gui's add function:

gui.add(fizzyText, 'explode');

是否可以将参数传递给爆炸函数?

Is it possible to pass arguments to the explode function?

谢谢!

推荐答案

将参数传递给按钮的功能。但是,您可以在该函数中访问对象的其他属性:

It is not possible to pass arguments to a button's function. You can however access other properties of your object in that function:

function myViewModel() { var self = this; this.name = "name1", this.score = 9, this.check = function() { if(self.score >= 5) { // access to the score property alert('you pass!'); } else { alert('try again.'); } } };

更多推荐

带有参数的Dat.gui函数调用?

本文发布于:2023-07-21 11:08:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1176910.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:函数   参数   Dat   gui

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!