diff options
author | Danijel Anđelković <adanijel99@gmail.com> | 2022-04-17 23:20:18 +0200 |
---|---|---|
committer | Danijel Anđelković <adanijel99@gmail.com> | 2022-04-17 23:20:18 +0200 |
commit | 56fbc59007fe5064168af33c9770a0d378343b85 (patch) | |
tree | 0f48d398377f3c5229149c1bae8e89ffdbe7ecfe /frontend/src/app/_elements/reactive-background/reactive-background.component.ts | |
parent | 87b1858bfb9d53f9932767d48e1b21bdc7d536fb (diff) |
Promenio stil home strane.
Diffstat (limited to 'frontend/src/app/_elements/reactive-background/reactive-background.component.ts')
-rw-r--r-- | frontend/src/app/_elements/reactive-background/reactive-background.component.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/frontend/src/app/_elements/reactive-background/reactive-background.component.ts b/frontend/src/app/_elements/reactive-background/reactive-background.component.ts index 9d7f5522..73cdb326 100644 --- a/frontend/src/app/_elements/reactive-background/reactive-background.component.ts +++ b/frontend/src/app/_elements/reactive-background/reactive-background.component.ts @@ -22,6 +22,8 @@ export class ReactiveBackgroundComponent implements AfterViewInit { @Input() pointColor: string = '#ffffff'; @Input() cursorLineColor: string = '#ff0000'; + private fleeSpeed = 0.005; + private points: Point[] = []; private width = 200; @@ -160,8 +162,8 @@ export class ReactiveBackgroundComponent implements AfterViewInit { const distToCursor = this.distance(p.x, p.y, mx, my); if (distToCursor < this.cursorDistance) { - p.x -= ((mx - p.x) / distToCursor) / 500; - p.y -= ((my - p.y) / distToCursor) / 500; + p.x -= ((mx - p.x) / distToCursor) * this.fleeSpeed; + p.y -= ((my - p.y) / distToCursor) * this.fleeSpeed; const grd = this.ctx.createLinearGradient(p.x * this.width, p.y * this.height, mx * this.width, my * this.height); const alpha = HEX[Math.round(p.size / this.maxSize * (HEX.length - 1))]; |