MCPcopy
hub / github.com/bgstaal/multipleWindow3dScene / updateNumberOfCubes

Function updateNumberOfCubes

main.js:111–138  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

109 }
110
111 function updateNumberOfCubes ()
112 {
113 let wins = windowManager.getWindows();
114
115 // remove all cubes
116 cubes.forEach((c) => {
117 world.remove(c);
118 })
119
120 cubes = [];
121
122 // add new cubes based on the current window setup
123 for (let i = 0; i < wins.length; i++)
124 {
125 let win = wins[i];
126
127 let c = new t.Color();
128 c.setHSL(i * .1, 1.0, .5);
129
130 let s = 100 + i * 50;
131 let cube = new t.Mesh(new t.BoxGeometry(s, s, s), new t.MeshBasicMaterial({color: c , wireframe: true}));
132 cube.position.x = win.shape.x + (win.shape.w * .5);
133 cube.position.y = win.shape.y + (win.shape.h * .5);
134
135 world.add(cube);
136 cubes.push(cube);
137 }
138 }
139
140 function updateWindowShape (easing = true)
141 {

Callers 1

windowsUpdatedFunction · 0.85

Calls 1

getWindowsMethod · 0.80

Tested by

no test coverage detected