aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_elements/carousel-vertical/carousel-vertical.component.ts
diff options
context:
space:
mode:
authorDanijel Anđelković <adanijel99@gmail.com>2022-04-23 01:28:46 +0200
committerDanijel Anđelković <adanijel99@gmail.com>2022-04-23 01:28:46 +0200
commit1177f4b29b616a59af39f4aef11b116f9660357d (patch)
tree36aaa26c5b78a2a5de9d86c6cde299b25f348091 /frontend/src/app/_elements/carousel-vertical/carousel-vertical.component.ts
parentc8165d451b295ec610702b36fc05b8cc6047497b (diff)
Reorganizovao stranice i komponente.
Diffstat (limited to 'frontend/src/app/_elements/carousel-vertical/carousel-vertical.component.ts')
-rw-r--r--frontend/src/app/_elements/carousel-vertical/carousel-vertical.component.ts65
1 files changed, 0 insertions, 65 deletions
diff --git a/frontend/src/app/_elements/carousel-vertical/carousel-vertical.component.ts b/frontend/src/app/_elements/carousel-vertical/carousel-vertical.component.ts
deleted file mode 100644
index d8849ea6..00000000
--- a/frontend/src/app/_elements/carousel-vertical/carousel-vertical.component.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import { AfterViewInit, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
-
-@Component({
- selector: 'app-carousel-vertical',
- templateUrl: './carousel-vertical.component.html',
- styleUrls: ['./carousel-vertical.component.css']
-})
-export class CarouselVerticalComponent implements OnInit, AfterViewInit {
-
- @ViewChild('wrapper') wrapper!: ElementRef;
-
- @Input() items!: any[];
-
- itemsToShow: any[] = [];
-
- @Input() type: string = "Object";
-
- scroll = 0;
- height = 9; //rem
-
- currentIndex = 0;
-
- @Input() shownElements: number = 5;
-
- constructor() {
- }
-
- ngOnInit(): void {
- this.itemsToShow = [...this.items.slice(0, this.shownElements)];
- console.log('0', this.itemsToShow);
- }
-
- ngAfterViewInit(): void {
- const container = this.wrapper.nativeElement
-
- container.addEventListener('scroll', (event: Event) => {
- this.scroll = (container.scrollTop / (container.scrollHeight - container.clientHeight));
- if (this.scroll == 1.0) {
- //console.log('removed', this.itemsToShow.splice(0, 1)[0].name);
- const itemToAdd = this.items[(this.currentIndex + this.shownElements) % (this.items.length - 1)];
- this.itemsToShow.push(itemToAdd);
- //console.log('added', itemToAdd.name);
- this.currentIndex = (this.currentIndex + 1);
- container.scrollTop = (container.scrollHeight - container.clientHeight) / 2;
- }
- });
- }
-
- clickItem(index: number) {
- }
-
- calcVisibility(i: number) {
- //return ((Math.sin((((i) / this.shownElements) - this.scroll) * Math.PI) + 1) / 2)
- const iPercent = (i + 1 - this.scroll) / this.shownElements;
- return iPercent;
- }
-
- calcStyle(i: number) {
- const a = this.calcVisibility(i)
- const v = (Math.sin(a * Math.PI) + 1) / 2;
- return `transform: translateY(${v * 100}%) scale(${v}) perspective(${v * 200}em) rotateX(${(1 - a) * 180 - 90}deg);
- opacity: ${v};
- height: ${this.height}rem;`;
- }
-}