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,CAAS,SAAT;AACA,aAAK,GAAL,CAAS,IAAT;AACH,KAdO;AAgBA,QAAA,SAAA,CAAA,QAAA,GAAR,UAAkB,EAAlB,EAA8B,EAA9B,EAA0C,EAA1C,EAAsD,EAAtD,EAAgE;AAC5D,aAAK,GAAL,CAAS,SAAT,GAAqB,GAArB;AACA,aAAK,GAAL,CAAS,WAAT,GAAuB,MAAvB;AAEA,aAAK,GAAL,CAAS,SAAT;AACA,aAAK,GAAL,CAAS,MAAT,CAAgB,EAAhB,EAAoB,EAApB;AACA,aAAK,GAAL,CAAS,MAAT,CAAgB,EAAhB,EAAoB,EAApB;AACA,aAAK,GAAL,CAAS,MAAT;AACH,KARO;AAUA,QAAA,SAAA,CAAA,WAAA,GAAR,UAAqB,EAArB,EAAiC,EAAjC,EAA6C,EAA7C,EAAyD,EAAzD,EAAmE;AAC/D,YAAM,IAAI,KAAK,EAAf;AACA,YAAM,IAAI,KAAK,EAAf;AAEA,eAAO,KAAK,IAAL,CAAU,IAAI,CAAJ,GAAQ,IAAI,CAAtB,CAAP;AACH,KALO;AAMZ,WAAA,GAAA;AApFA,CAAA,EAAA;AAAa,QAAA,GAAA,GAAA,GAAA","file":"generative.fd39fdd9.map","sourceRoot":"..","sourcesContent":["export class App {\r\n    private canvas: HTMLCanvasElement;\r\n    private ctx: CanvasRenderingContext2D;\r\n\r\n    constructor() {\r\n        this.canvas = document.getElementById('image') as HTMLCanvasElement;\r\n        this.ctx = this.canvas.getContext('2d');\r\n\r\n        this.canvas.width = window.innerWidth;\r\n        this.canvas.height = window.innerHeight ;\r\n    }\r\n\r\n    public run(): void {\r\n        const routine = () => {\r\n            this.clear();\r\n            this.draw();\r\n\r\n            window.setTimeout(routine, 500);\r\n        };\r\n\r\n        routine();\r\n    }\r\n\r\n    public clear () {\r\n        this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);\r\n    }\r\n\r\n    private draw () {\r\n        this.drawBranch([0, 0]);\r\n    }\r\n\r\n    private getAngle (): number {\r\n        return Math.random() * Math.PI / 2;\r\n    }\r\n\r\n    private getLength (): number {\r\n        return 25 + Math.random() * 25;\r\n    }\r\n\r\n    private drawBranch (from: number[], i = 0) {\r\n        const a = this.getAngle();\r\n        const l = this.getLength();\r\n        const to = [from[0] + l * Math.cos(a), from[1] + l * Math.sin(a)];\r\n\r\n        this.drawLine(from[0], from[1], to[0], to[1]);\r\n\r\n        if (i < 40) {\r\n            this.drawBranch(to, i + 1);\r\n            if (Math.random() < 0.15) { this.drawBranch(to, i + 1); }\r\n        }\r\n    }\r\n\r\n    private drawPoint (x: number, y: number, r: number = 5) {\r\n        this.ctx.lineWidth = 1;\r\n        this.ctx.strokeStyle = '#000';\r\n        this.ctx.fillStyle = '#900';\r\n\r\n        this.ctx.beginPath();\r\n        this.ctx.arc(x, y, r, 0, Math.PI * 2);\r\n        this.ctx.closePath();\r\n        this.ctx.stroke();\r\n\r\n        this.ctx.beginPath();\r\n        this.ctx.arc(x, y, 1, 0, Math.PI * 2);\r\n        this.ctx.closePath();\r\n        this.ctx.fill();\r\n    }\r\n\r\n    private drawLine (x1: number, y1: number, x2: number, y2: number) {\r\n        this.ctx.lineWidth = 0.1;\r\n        this.ctx.strokeStyle = '#000';\r\n\r\n        this.ctx.beginPath();\r\n        this.ctx.moveTo(x1, y1);\r\n        this.ctx.lineTo(x2, y2);\r\n        this.ctx.stroke();\r\n    }\r\n\r\n    private getDistance (x1: number, y1: number, x2: number, y2: number): number {\r\n        const a = x2 - x1;\r\n        const b = y2 - y1;\r\n\r\n        return Math.sqrt(a * a + b * b);\r\n    }\r\n}\r\n","import { App } from './App';\r\n\r\nconst app = new App();\r\napp.run();\r\n"]}