const circles1 = [];
const circles2 = [];
const centerPoints = [];
for (let x = 1; x < 8; x++) {
for (let y = 1; y < 8; y++) {
const center: Bit.Inputs.Base.Point3 = [x, y, 0];
centerPoints.push(center);
const circle = bitbybit.verb.curve.circle.createCircle({ center: [x, y, 0], radius: (x / 25 + 1), xAxis: [1, 0, 0], yAxis: [0, 1, 0] });
const rotated1 = bitbybit.verb.curve.transform({ curve: circle, transformation: bitbybit.babylon.transforms.rotationCenterX({ angle: y * 20, center }) })
circles1.push(rotated1);
const circle2 = bitbybit.verb.curve.circle.createCircle({ center: [x, y, 0], radius: (y / 15) + 0.5, xAxis: [1, 0, 0], yAxis: [0, 1, 0] });
const rotated2 = bitbybit.verb.curve.transform({ curve: circle2, transformation: bitbybit.babylon.transforms.rotationCenterX({ angle: -y * 20, center }) })
circles2.push(rotated2);
}
}
const curveDraw = new Bit.Inputs.Verb.DrawCurvesDto();
curveDraw.curves = circles1;
let circlesTransformed1 = [];
let circlesTransformed2 = [];
let param1 = 3;
let param2 = 10;
let step1 = 0.4;
let step2 = 0.8;
circles1.forEach(circle => {
const center = bitbybit.verb.curve.pointAtParam({ parameter: 0, curve: circle });
const transformation = bitbybit.babylon.transforms.rotationCenterZ({ angle: param1 * 10, center })
let circleTransformed = bitbybit.verb.curve.transform({ transformation: transformation, curve: circle });
circlesTransformed1.push(circleTransformed);
})
circles2.forEach(circle => {
const center = bitbybit.verb.curve.pointAtParam({ parameter: 0, curve: circle });
const transformation = bitbybit.babylon.transforms.rotationCenterY({ angle: param2 * 10, center })
let circleTransformed = bitbybit.verb.curve.transform({ transformation: transformation, curve: circle });
circlesTransformed2.push(circleTransformed);
})
let circles1Mesh;
let circles2Mesh;
const drawOptionsOut = new Bit.Inputs.Verb.DrawCurvesDto(circlesTransformed1);
drawOptionsOut.updatable = true;
drawOptionsOut.size = 30;
drawOptionsOut.opacity = 0.3;
drawOptionsOut.colours = '#ffffff';
const drawLinesColor = new Bit.Inputs.Verb.DrawCurvesDto(circlesTransformed2);
drawLinesColor.updatable = true;
drawLinesColor.size = 1;
drawLinesColor.opacity = 1;
drawLinesColor.colours = '#ffffff';
let circleCurves1;
let circleCurves2;
bitbybit.time.registerRenderFunction((update) => {
circlesTransformed1.length = 0;
circlesTransformed2.length = 0;
circles1.forEach((circle, index) => {
const center = centerPoints[index];
const transformation = bitbybit.babylon.transforms.rotationCenterZ({ angle: param1 * ((index + 5) / 10), center })
let circleTransformed = bitbybit.verb.curve.transform({ transformation: transformation, curve: circle });
circlesTransformed1.push(circleTransformed);
})
circles2.forEach((circle, index) => {
const center = centerPoints[index];
const transformation = bitbybit.babylon.transforms.rotationCenterY({ angle: param2 * ((circles2.length - index + 1) / 20), center })
let circleTransformed = bitbybit.verb.curve.transform({ transformation: transformation, curve: circle });
circlesTransformed2.push(circleTransformed);
})
param1 += step1;
param2 += step2;
if (circleCurves1) {
drawOptionsOut.curvesMesh = circleCurves1;
}
if (circleCurves2) {
drawLinesColor.curvesMesh = circleCurves2;
}
circleCurves1 = bitbybit.verb.curve.drawCurves(drawOptionsOut);
circleCurves2 = bitbybit.verb.curve.drawCurves(drawLinesColor);
});