mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
Merge pull request #2092 from anojht/backgroundanimation
Dynamic Background Animation
This commit is contained in:
commit
af319cfa87
7 changed files with 71 additions and 7 deletions
12
src/Ombi/ClientApp/app/animations/fadeinout.ts
Normal file
12
src/Ombi/ClientApp/app/animations/fadeinout.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { animate, style, transition, trigger } from "@angular/animations";
|
||||||
|
import { AnimationEntryMetadata } from "@angular/core";
|
||||||
|
|
||||||
|
export const fadeInOutAnimation: AnimationEntryMetadata = trigger("fadeInOut", [
|
||||||
|
transition(":enter", [ // :enter is alias to 'void => *'
|
||||||
|
style({ opacity: 0 }),
|
||||||
|
animate(1000, style({ opacity: 1 })),
|
||||||
|
]),
|
||||||
|
transition(":leave", [ // :leave is alias to '* => void'
|
||||||
|
animate(1000, style({ opacity: 0 })),
|
||||||
|
]),
|
||||||
|
]);
|
|
@ -1,5 +1,5 @@
|
||||||
<div *ngIf="landingPageSettings && customizationSettings">
|
<div *ngIf="landingPageSettings && customizationSettings">
|
||||||
<div *ngIf="background" class="bg" [style.background-image]="background"></div>
|
<div *ngIf="background" @fadeInOut class="bg" [style.background-image]="background"></div>
|
||||||
|
|
||||||
<div class="centered col-md-12">
|
<div class="centered col-md-12">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { PlatformLocation } from "@angular/common";
|
import { PlatformLocation } from "@angular/common";
|
||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||||
|
|
||||||
import { IMediaServerStatus } from "../interfaces";
|
import { IMediaServerStatus } from "../interfaces";
|
||||||
import { ICustomizationSettings, ILandingPageSettings } from "../interfaces";
|
import { ICustomizationSettings, ILandingPageSettings } from "../interfaces";
|
||||||
|
@ -9,17 +9,21 @@ import { SettingsService } from "../services";
|
||||||
import { DomSanitizer } from "@angular/platform-browser";
|
import { DomSanitizer } from "@angular/platform-browser";
|
||||||
import { ImageService } from "../services";
|
import { ImageService } from "../services";
|
||||||
|
|
||||||
|
import { fadeInOutAnimation } from "../animations/fadeinout";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: "./landingpage.component.html",
|
templateUrl: "./landingpage.component.html",
|
||||||
|
animations: [fadeInOutAnimation],
|
||||||
styleUrls: ["./landingpage.component.scss"],
|
styleUrls: ["./landingpage.component.scss"],
|
||||||
})
|
})
|
||||||
export class LandingPageComponent implements OnInit {
|
export class LandingPageComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
public customizationSettings: ICustomizationSettings;
|
public customizationSettings: ICustomizationSettings;
|
||||||
public landingPageSettings: ILandingPageSettings;
|
public landingPageSettings: ILandingPageSettings;
|
||||||
public background: any;
|
public background: any;
|
||||||
public mediaServerStatus: IMediaServerStatus;
|
public mediaServerStatus: IMediaServerStatus;
|
||||||
public baseUrl: string;
|
public baseUrl: string;
|
||||||
|
private timer: any;
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService,
|
constructor(private settingsService: SettingsService,
|
||||||
private images: ImageService, private sanitizer: DomSanitizer, private landingPageService: LandingPageService,
|
private images: ImageService, private sanitizer: DomSanitizer, private landingPageService: LandingPageService,
|
||||||
|
@ -31,6 +35,9 @@ export class LandingPageComponent implements OnInit {
|
||||||
this.images.getRandomBackground().subscribe(x => {
|
this.images.getRandomBackground().subscribe(x => {
|
||||||
this.background = this.sanitizer.bypassSecurityTrustStyle("linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%), url(" + x.url + ")");
|
this.background = this.sanitizer.bypassSecurityTrustStyle("linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%), url(" + x.url + ")");
|
||||||
});
|
});
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
this.cycleBackground();
|
||||||
|
}, 10000);
|
||||||
|
|
||||||
const base = this.location.getBaseHrefFromDOM();
|
const base = this.location.getBaseHrefFromDOM();
|
||||||
if (base.length > 1) {
|
if (base.length > 1) {
|
||||||
|
@ -41,4 +48,18 @@ export class LandingPageComponent implements OnInit {
|
||||||
this.mediaServerStatus = x;
|
this.mediaServerStatus = x;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ngOnDestroy() {
|
||||||
|
clearInterval(this.timer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public cycleBackground() {
|
||||||
|
this.images.getRandomBackground().subscribe(x => {
|
||||||
|
this.background = "";
|
||||||
|
});
|
||||||
|
this.images.getRandomBackground().subscribe(x => {
|
||||||
|
this.background = this.sanitizer
|
||||||
|
.bypassSecurityTrustStyle("linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%), url(" + x.url + ")");
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ include the remember me checkbox
|
||||||
-->
|
-->
|
||||||
<div *ngIf="form && customizationSettings">
|
<div *ngIf="form && customizationSettings">
|
||||||
|
|
||||||
<div *ngIf="background" class="bg" [style.background-image]="background"></div>
|
<div *ngIf="background" @fadeInOut class="bg" [style.background-image]="background"></div>
|
||||||
<div class="container" id="login">
|
<div class="container" id="login">
|
||||||
<div class="card card-container">
|
<div class="card card-container">
|
||||||
<!-- <img class="profile-img-card" src="//lh3.googleusercontent.com/-6V8xOA6M7BA/AAAAAAAAAAI/AAAAAAAAAAA/rzlHcD0KYwo/photo.jpg?sz=120" alt="" /> -->
|
<!-- <img class="profile-img-card" src="//lh3.googleusercontent.com/-6V8xOA6M7BA/AAAAAAAAAAI/AAAAAAAAAAA/rzlHcD0KYwo/photo.jpg?sz=120" alt="" /> -->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||||
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from "@ngx-translate/core";
|
||||||
|
@ -13,11 +13,14 @@ import { StatusService } from "../services";
|
||||||
import { DomSanitizer } from "@angular/platform-browser";
|
import { DomSanitizer } from "@angular/platform-browser";
|
||||||
import { ImageService } from "../services";
|
import { ImageService } from "../services";
|
||||||
|
|
||||||
|
import { fadeInOutAnimation } from "../animations/fadeinout";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: "./login.component.html",
|
templateUrl: "./login.component.html",
|
||||||
|
animations: [fadeInOutAnimation],
|
||||||
styleUrls: ["./login.component.scss"],
|
styleUrls: ["./login.component.scss"],
|
||||||
})
|
})
|
||||||
export class LoginComponent implements OnInit {
|
export class LoginComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
public form: FormGroup;
|
public form: FormGroup;
|
||||||
public customizationSettings: ICustomizationSettings;
|
public customizationSettings: ICustomizationSettings;
|
||||||
|
@ -25,6 +28,7 @@ export class LoginComponent implements OnInit {
|
||||||
public background: any;
|
public background: any;
|
||||||
public landingFlag: boolean;
|
public landingFlag: boolean;
|
||||||
public baseUrl: string;
|
public baseUrl: string;
|
||||||
|
private timer: any;
|
||||||
|
|
||||||
private errorBody: string;
|
private errorBody: string;
|
||||||
private errorValidation: string;
|
private errorValidation: string;
|
||||||
|
@ -67,6 +71,10 @@ export class LoginComponent implements OnInit {
|
||||||
this.images.getRandomBackground().subscribe(x => {
|
this.images.getRandomBackground().subscribe(x => {
|
||||||
this.background = this.sanitizer.bypassSecurityTrustStyle("linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%),url(" + x.url + ")");
|
this.background = this.sanitizer.bypassSecurityTrustStyle("linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%),url(" + x.url + ")");
|
||||||
});
|
});
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
this.cycleBackground();
|
||||||
|
}, 10000);
|
||||||
|
|
||||||
const base = this.location.getBaseHrefFromDOM();
|
const base = this.location.getBaseHrefFromDOM();
|
||||||
if (base.length > 1) {
|
if (base.length > 1) {
|
||||||
this.baseUrl = base;
|
this.baseUrl = base;
|
||||||
|
@ -102,4 +110,19 @@ export class LoginComponent implements OnInit {
|
||||||
}, err => this.notify.error(this.errorBody));
|
}, err => this.notify.error(this.errorBody));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ngOnDestroy() {
|
||||||
|
clearInterval(this.timer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private cycleBackground() {
|
||||||
|
this.images.getRandomBackground().subscribe(x => {
|
||||||
|
this.background = "";
|
||||||
|
});
|
||||||
|
this.images.getRandomBackground().subscribe(x => {
|
||||||
|
this.background = this.sanitizer
|
||||||
|
.bypassSecurityTrustStyle("linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%), url(" + x.url + ")");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,4 +98,12 @@
|
||||||
<None Include="wwwroot\translations\*.json" />
|
<None Include="wwwroot\translations\*.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="ClientApp\app\animations\fadeinout.ts" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<TypeScriptCompile Include="ClientApp\app\animations\fadeinout.ts" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue