complete visual overhaul
This commit is contained in:
1 parent
02bc2faca0
commit
25d06ec49a
51 files changed
+694
-664
No files matched your search
@@ -0,0 +1,52 @@
|
||||
import {AfterViewInit, Component, ElementRef, Inject, OnDestroy, OnInit, PLATFORM_ID, ViewChild, Input} from '@angular/core';
|
||||
import {DeviceDetectorService} from '../services/device-detector.service';
|
||||
import {isPlatformBrowser} from '@angular/common';
|
||||
import Parallax from 'parallax-js';
|
||||
|
||||
@Component({
|
||||
selector: 'app-parallax',
|
||||
imports: [],
|
||||
templateUrl: './parallax.component.html',
|
||||
styleUrl: './parallax.component.css',
|
||||
})
|
||||
export class ParallaxComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
@ViewChild('parallax') sceneRef!: ElementRef<HTMLDivElement>;
|
||||
|
||||
@Input() baseColor: string = '#0b0b0f';
|
||||
@Input() bgGradient: string =
|
||||
'radial-gradient(circle 120vw at center, rgba(90,78,130,0.32), transparent 40%), linear-gradient(180deg,#1b172c 0%, #0b0b0f 100%)';
|
||||
|
||||
isMobile: boolean = false;
|
||||
private parallaxInstance: Parallax | null = null;
|
||||
|
||||
constructor(
|
||||
private deviceService: DeviceDetectorService,
|
||||
@Inject(PLATFORM_ID) private platformId: Object
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
if (!isPlatformBrowser(this.platformId)) return;
|
||||
if (!this.sceneRef?.nativeElement) return;
|
||||
|
||||
this.parallaxInstance = new Parallax(this.sceneRef.nativeElement, {
|
||||
relativeInput: true,
|
||||
hoverOnly: false,
|
||||
clipRelativeInput: true,
|
||||
calibrateX: true,
|
||||
calibrateY: true,
|
||||
scalarX: this.isMobile ? 6 : 12,
|
||||
scalarY: this.isMobile ? 6 : 12,
|
||||
frictionX: 0.1,
|
||||
frictionY: 0.1,
|
||||
});
|
||||
}
|
||||
ngOnDestroy() {
|
||||
this.parallaxInstance?.destroy();
|
||||
this.parallaxInstance = null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user