Mashiane Expert Licensed User Longtime User Aug 6, 2019 #1 Hi there Just hit a wall... B4X: var FizzyText = function() { this.message = 'dat.gui'; this.speed = 0.8; this.displayOutline = false; this.explode = function() { ... }; // Define render logic ... }; window.onload = function() { var text = new FizzyText(); var gui = new dat.GUI(); gui.add(text, 'message'); gui.add(text, 'speed', -5, 5); gui.add(text, 'displayOutline'); gui.add(text, 'explode'); }; I'm assuming B4X: Sub FizzyText Dim message As String = "dat.gui" Dim speed As Double = 0.08 Dim displayOutline As Boolean = False End Sub but then how do I declare the call for, B4X: var text = new FizzyText(); works and is able to have the variables defined in that sub available? The test of the part, seems fairly understandable.. B4X: Dim gui As BANanoObject gui.Initialize2("dat.GUI", Null) gui.RunMethod("add", array(text, "message")) .... I'm trying B4X: Dim text as BANanoObject text.Initialize2("FizzyText", null)
Hi there Just hit a wall... B4X: var FizzyText = function() { this.message = 'dat.gui'; this.speed = 0.8; this.displayOutline = false; this.explode = function() { ... }; // Define render logic ... }; window.onload = function() { var text = new FizzyText(); var gui = new dat.GUI(); gui.add(text, 'message'); gui.add(text, 'speed', -5, 5); gui.add(text, 'displayOutline'); gui.add(text, 'explode'); }; I'm assuming B4X: Sub FizzyText Dim message As String = "dat.gui" Dim speed As Double = 0.08 Dim displayOutline As Boolean = False End Sub but then how do I declare the call for, B4X: var text = new FizzyText(); works and is able to have the variables defined in that sub available? The test of the part, seems fairly understandable.. B4X: Dim gui As BANanoObject gui.Initialize2("dat.GUI", Null) gui.RunMethod("add", array(text, "message")) .... I'm trying B4X: Dim text as BANanoObject text.Initialize2("FizzyText", null)
Mashiane Expert Licensed User Longtime User Aug 6, 2019 #2 SOLUTION: Think objects... B4X: Dim FizzyText As Map = CreateMap() FizzyText.put("message", "dat.gui") FizzyText.put("speed", 0.08) FizzyText.put("displayOutline", False) The rest of the assignment works..., but then again I could be wrong... Upvote 0
SOLUTION: Think objects... B4X: Dim FizzyText As Map = CreateMap() FizzyText.put("message", "dat.gui") FizzyText.put("speed", 0.08) FizzyText.put("displayOutline", False) The rest of the assignment works..., but then again I could be wrong...
Mashiane Expert Licensed User Longtime User Aug 6, 2019 #3 Funny, there is this... B4X: control = new function () { this.rotationSpeed = 0.005; this.scale = 1; }; Upvote 0
Funny, there is this... B4X: control = new function () { this.rotationSpeed = 0.005; this.scale = 1; };