QU7JVYXAGGNN4754FJAT7HFTSFHLLIWWNIVYBMCBQJVSLTB5RNIQC
THNMNMVRZQVPZTEXHIK6WGYN3QDEFPKFOVOCB5HTWCYC5BOBYQ5AC
5BA7VZ3D36S2TC7NZ64R3O364TGXPY5BJUJTGCFZHWZ6JWAXJMUQC
OEKGYL6XZFMUSQPDFFMGGNAPDDKNW4XJNY6ALYQILBLNCRD5BFRAC
AAKN4XJLZ2GARZMUFYX3CJZKYHTRRZDYNTFRLMY7VPAY7K6W4N3QC
VQJBTLNEKPLH62WALLZABSTLHLEMS4SFVEVFUOXJ4EFABHISYF5QC
DYG4O2P7D2MWG6BZT4XJ4ISBK3DII52VOD76XLDJULKUBBN4MTZAC
}
private renderRecursion(center: Point, height: number, width: number) {
if (height < width) {
const newHeight = this.config.recursiveDownscale * height;
const newWidth = newHeight / this.config.aspectRatio;
const leftCenter = [
center[0] - width * this.config.recursiveOffset,
center[1],
];
const rightCenter = [
center[0] + width * this.config.recursiveOffset,
center[1],
];
return {
centers: [leftCenter, rightCenter],
height: newHeight,
width: newWidth,
};
} else {
const newWidth = this.config.recursiveDownscale * width;
const newHeight = newWidth / this.config.aspectRatio;
const topCenter = [
center[0],
center[1] - height * this.config.recursiveOffset,
];
const bottomCenter = [
center[0],
center[1] + height * this.config.recursiveOffset,
];
return {
centers: [topCenter, bottomCenter],
height: newHeight,
width: newWidth,
};
}
public drawRectangle() {
const center: Point = [this.config.canvasWidth / 2, this.config.canvasHeight / 2];
const startingHeight = 0.75 * this.config.canvasHeight;
const rectWidth = startingHeight * this.config.aspectRatio;
public drawStart() {
const { center, height, width } = this.drawRectangle();
const {
centers: newCenters,
height: newHeight,
width: newWidth,
} = this.renderRecursion(center, height, width);
this.drawRectangle(newCenters[0], newHeight, newWidth);
this.drawRectangle(newCenters[1], newHeight, newWidth);
let {
centers: newNewCenters,
height: newNewHeight,
width: newNewWidth,
} = this.renderRecursion(newCenters[0], newHeight, newWidth);
this.drawRectangle(newNewCenters[0], newNewHeight, newNewWidth);
this.drawRectangle(newNewCenters[1], newNewHeight, newNewWidth);
let { centers: newNewCenters2 } = this.renderRecursion(
newCenters[1],
newHeight,
newWidth
);
this.drawRectangle(newNewCenters2[0], newNewHeight, newNewWidth);
this.drawRectangle(newNewCenters2[1], newNewHeight, newNewWidth);
}
public drawRectangle(
center: Point = [this.config.canvasWidth / 2, this.config.canvasHeight / 2],
height = 0.95 * this.config.canvasHeight,
width = height * this.config.aspectRatio
) {
const startingHeight = height;
const rectWidth = width;
this.drawCircle([center[0] - rectWidth/2, center[1] - startingHeight/2])
this.drawCircle([center[0] + rectWidth/2, center[1] - startingHeight/2])
this.drawCircle([center[0] + rectWidth/2, center[1] + startingHeight/2])
this.drawCircle([center[0] - rectWidth/2, center[1] + startingHeight/2])
this.drawCircle([center[0] - rectWidth/2, center[1] - 0 * startingHeight/2])
this.drawCircle([center[0] + rectWidth/2, center[1] - 0* startingHeight/2])
this.drawCircle([center[0] + 0* rectWidth/2, center[1] - startingHeight/2])
this.drawCircle([center[0] + 0* rectWidth/2, center[1] + startingHeight/2])
this.drawCircle([
center[0] - rectWidth / 2,
center[1] - startingHeight / 2,
]);
this.drawCircle([
center[0] + rectWidth / 2,
center[1] - startingHeight / 2,
]);
this.drawCircle([
center[0] + rectWidth / 2,
center[1] + startingHeight / 2,
]);
this.drawCircle([
center[0] - rectWidth / 2,
center[1] + startingHeight / 2,
]);
this.drawCircle([
center[0] - rectWidth / 2,
center[1] - (0 * startingHeight) / 2,
]);
this.drawCircle([
center[0] + rectWidth / 2,
center[1] - (0 * startingHeight) / 2,
]);
this.drawCircle([
center[0] + (0 * rectWidth) / 2,
center[1] - startingHeight / 2,
]);
this.drawCircle([
center[0] + (0 * rectWidth) / 2,
center[1] + startingHeight / 2,
]);
return { center, height, width };