问题标签 [dat.gui]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript - 如何在 dat.gui 中的按钮前插入标签?
几周前我开始使用 dat.GUI,我知道如何制作一个简单的按钮,该按钮将在 GUI 中可视地跨越整行。现在我需要一个“浏览”按钮,它前面有一个不可点击的标签,其中包含一些其他文本。我使用这样的东西来创建按钮:
该按钮将占据 dat.GUI 中的一整行。是否可以在它前面插入一个标签,以便它们都适合同一行?
javascript - 三.js中如何使用dat.gui来控制模型的旋转速度?
我想控制我的模型的旋转速度,所以我尝试使用 dat.gui 来完成它。我在我的渲染脚本中写了 follows:
控制是 dat.gui 的参数。
但是当我运行我的演示时,我的模型消失了!我只能看到我的场景。我想知道错误发生在哪里,所以我修改它:
我发现第一个警报是-0.004,但其他(第二个,第三个等)未定义。所以我猜我的演示只渲染了第一帧,因为模型没有完全加载,所以我看不到它。
我想知道为什么会这样,如何解决?</p>
Ps:所有代码如下:
dat.gui - dat.gui 的日历输入
有没有办法为 dat.GUI 提供日历输入?如果可能的话,我希望能够使用 UI 来输入日期。我目前的解决方法是将日期输入为文本,但我更喜欢使用某种类型的日历。谢谢!
javascript - Three.js - Torus 不绕 0z 轴旋转
我尝试torus
沿 2 个轴旋转 a:Ox 和 Oz。我想dat.gui
用鼠标修改的滑块应用这种旋转。
我已经定义了torus
:
我的问题是旋转Ox axis
工作正常,但旋转不是这种情况Oz axis
。
我通过调用以下函数为圆环旋转:
对于上述函数,我调用render('init')
计算相机位置的函数。
如何使这个圆环旋转Oz axis
?为什么它沿着Ox axis
而不是沿着旋转Oz axis
?
如果有人可以提供线索,那就好了。
谢谢
更新 1:
我找到了解决方案,因为我没有考虑到Euler angles
,即 2 次旋转(绕轴X
和Y
轴)的顺序。解决方案是设置torus.rotation.order = 'ZXY';
javascript - dat.GUI doesn't update when I change the object
Description of the problem:
There are 2 variable:
and a control
variable
I attached dat.GUI to control.i
.
So it displays the value of controller1.i
and when I change value in dat.GUI, it changes value of controller1.i
.
After that, I run:
When I change the value in dat.GUI
, I want it to change controller2.i
, but right now it changes controller1.i
.
Here is the pen: http://codepen.io/kranzy/pen/QKzYAW
or Stack Snippets:
The only way I can see is deleting the controller and init it again everytime I change
control
variable, but I want to know another way.
That way is suggested here: Refreshing dat.gui variable (not really the same as my question, but related).
If you don't know anything aboutdat.GUI
, you can take the tour here and see if you can help me.
javascript - 刷新 dat.gui 变量
这是 dat.gui 界面中的下拉列表。单击任何数字后, jumpSwitcher 将是您选择的任何数字。我正在尝试根据用户选择的内容替换与其特定编号相关的每个列表Starsystem
。
solPlanets= ['Ilos', 'Tuchanka', 'Illium', 'Palaven']
当您单击 2 时,列表 2 中显示的内容也是如此。默认情况下,solPlanets 显示 ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune' ] 因为默认是 jumpSwitcher = 1。
solPlanets= ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune']
问题是,无论 jumpSwitcher 是否为 2 ,列表将始终显示为。
如果 jumpSwitcher 为 2,我通过放置一条警报消息确认了这一点,并且警报弹出,但列表不会改变。这可能与 dat.gui 不更新的类似问题有关。我已经尝试过 listen() 方法,因为它是主要给出的答案,但它对我不起作用。
我已经弄好了。
PS:我以前问过这个问题,但现在我意识到这可能与 dat.gui 不刷新值而不是 javascript 有关。所以我删除了这个问题,因为它接触到了错误的受众,而且我没有为它做任何事。
javascript - 如何更改 dat.GUI 上的滑块值以及如何重置 dat.GUI
1) 我正在开发一个有 2 个滑块的 dat.GUI 应用程序。我想在另一个更改时重置一个。例如 :
这只是一个示例,但将滑块重置或设置为其默认值(在 FizzyText 中)非常重要。
上面的例子来自https://workshop.chromeexperiments.com/examples/gui/#9--Updating-the-Display-Automatically我不能自动更新滑块
2)我想添加一个重置按钮,其中所有滑块都将被重置。但是有了前面的答案,我就可以重置所有值
javascript - 将 dat.GUI 严格放置在 THREE.js 场景中
When a THREE.js scene is occupies the entirety of an html page, the dat.GUI
is forced inside the scene, like this.
However, when the THREE.js scene does not take up the whole page, then placement of the dat.GUI
becomes more awkward. The THREE.js docs place examples in <iframe>
tags which then forces the dat.GUI
inside the frame, and hence inside the THREE.js scene. This looks great, but for me it is a problem since I have set the X-Frame-Options: Deny
cookie.
How can I place the THREE.js scene and the dat.GUI
in the same <div>
with the same relative positioning as they would be if they occupied the entire page? Note that this answer does not work for me, since the styling is applied both to the THREE.js scene and the dat.GUI
.
javascript - Dat.gui 为数组中的每个元素添加滑块
所以我有一个看起来像这样的javascript对象
我想为每个 opacityCs 和每个 whiteThreshold 添加一个滑块。
对于其他参数很容易
或者
但我找不到添加数组元素的方法。任何人都可以帮忙吗?
three.js - 三.js如何使用DAT.Gui控制Vector3值z的位置
我是 three.js 的新手,我尝试使用 Dat.Gui 修改 Vector3 中 Z 的位置值。这是我的代码,但我没有运气。
谢谢!