const circles1 = [];
const circles2 = [];
const adjOpt = new Bit.Inputs.BabylonScene.CameraConfigurationDto();
adjOpt.position = [15, 5, -30];
adjOpt.lookAt = [15, 8, 0];
adjOpt.panningSensibility = 400;
adjOpt.wheelPrecision = 3;
bitbybit.babylon.scene.adjustActiveArcRotateCamera(adjOpt)
for (let x = 0; x < 30; x++) {
for (let y = 0; y < 20; y++) {
const circle = bitbybit.verb.curve.circle.createCircle({ center: [x, y, 0], radius: 2, xAxis: [1, 0, 0], yAxis: [0, 1, 0] });
const rotated1 = bitbybit.verb.curve.transform({ curve: circle, transformation: bitbybit.babylon.transforms.rotationCenterZ({ angle: y * 10, center: [x, y, 0] }) })
circles1.push(rotated1);
const rotated2 = bitbybit.verb.curve.transform({ curve: circle, transformation: bitbybit.babylon.transforms.rotationCenterY({ angle: -y * 20, center: [x, y, 0] }) })
circles2.push(rotated2);
}
}
const curveDraw = new Bit.Inputs.Verb.DrawCurvesDto();
curveDraw.curves = circles1;
let points1 = [];
let points2 = [];
circles1.forEach(circle => {
let point = bitbybit.verb.curve.pointAtParam({ parameter: param1, curve: circle });
points1.push(point);
})
circles2.forEach(circle => {
let point = bitbybit.verb.curve.pointAtParam({ parameter: param1, curve: circle });
points2.push(point);
})
const lines = [];
const drawOptionsOut = new Bit.Inputs.Draw.DrawBasicGeometryOptions();
drawOptionsOut.updatable = true;
drawOptionsOut.size = 500;
drawOptionsOut.opacity = 0.05;
drawOptionsOut.colours = '#ffffff';
const drawLinesColor = new Bit.Inputs.Draw.DrawBasicGeometryOptions();
drawLinesColor.updatable = true;
drawLinesColor.size = 50;
drawLinesColor.opacity = 0.1;
drawLinesColor.colours = '#f2c4aa';
let param1 = 0;
let param2 = 0.5;
let step1 = 0.0004;
let step2 = 0.0008;
let drawnBabylonLines1Mesh;
let drawnBabylonLines2Mesh;
bitbybit.time.registerRenderFunction((update) => {
if (param2 > 3 || param2 < -1) {
step2 *= -1;
}
if (param1 > 2 || param1 < -1) {
step1 *= -1;
}
points1.length = 0;
points2.length = 0;
lines.length = 0;
circles1.forEach((circle, index) => {
let point = bitbybit.verb.curve.pointAtParam({ parameter: param1 + index / 200, curve: circle });
points1.push(point);
});
circles2.forEach((circle, index) => {
let point = bitbybit.verb.curve.pointAtParam({ parameter: param2 - index / 200, curve: circle });
points2.push(point);
});
param1 += step1;
param2 += step2;
points1.forEach((pt, i) => {
lines.push(bitbybit.line.create({ start: pt, end: points2[i] }));
});
drawnBabylonLines1Mesh = bitbybit.draw.drawAny({ entity: lines, babylonMesh: drawnBabylonLines1Mesh, options: drawOptionsOut });
drawnBabylonLines2Mesh = bitbybit.draw.drawAny({ entity: lines, babylonMesh: drawnBabylonLines2Mesh, options: drawLinesColor });
});