Skip to content

Commit

Permalink
feat(app): make animation presets configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
9inpachi committed Jun 6, 2021
1 parent e07725a commit bd5f161
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@
import { Component } from '@angular/core';
import { Component, Input } from '@angular/core';
import { AnimationPreset, SceneManager } from 'phoenix-event-display';
import { EventDisplayService } from '../../../services/event-display.service';

export const defaultAnimationPresets: {
[key: string]: AnimationPreset;
} = {
'Preset 1': {
positions: [
{
position: [11976, 7262, 11927],
duration: 1000,
},
{
position: [1000, 0, 11927],
duration: 1000,
},
{
position: [-1000, 0, 1000],
duration: 2000,
},
{
position: [-5000, 0, 1000],
duration: 3000,
},
{
position: [-5000, 0, 1000],
duration: 2000,
},
{
position: [11976, 7262, 11927],
duration: 2000,
},
],
animateEventAfterInterval: 3000,
collisionDuration: 2500,
},
};

@Component({
selector: 'app-animate-camera',
templateUrl: './animate-camera.component.html',
styleUrls: ['./animate-camera.component.scss'],
})
export class AnimateCameraComponent {
animationPresets: {
[key: string]: AnimationPreset;
} = {
'Preset 1': {
positions: [
{
position: [11976, 7262, 11927],
duration: 1000,
},
{
position: [1000, 0, 11927],
duration: 1000,
},
{
position: [-1000, 0, 1000],
duration: 2000,
},
{
position: [-5000, 0, 1000],
duration: 3000,
},
{
position: [-5000, 0, 1000],
duration: 2000,
},
{
position: [11976, 7262, 11927],
duration: 2000,
},
],
animateEventAfterInterval: 3000,
collisionDuration: 2500,
},
};
@Input() animationPresets = defaultAnimationPresets;

animationPresetsKeys = Object.keys(this.animationPresets);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<app-animate-event></app-animate-event>

<!-- Toggle for animating camera through event -->
<app-animate-camera></app-animate-camera>
<app-animate-camera [animationPresets]="animationPresets"></app-animate-camera>

<!-- Toggle for collections info -->
<app-collections-info></app-collections-info>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
EventDataFormat,
EventDataImportOption,
} from '../../services/extras/event-data-import';
import { defaultAnimationPresets } from './animate-camera/animate-camera.component';

@Component({
selector: 'app-ui-menu',
Expand All @@ -13,6 +14,8 @@ export class UiMenuComponent {
@Input()
eventDataImportOptions: EventDataImportOption[] =
Object.values(EventDataFormat);
@Input()
animationPresets = defaultAnimationPresets;

hideUIMenu: boolean = false;
}

0 comments on commit bd5f161

Please sign in to comment.