diff --git a/projects/nls-guilloche/src/nls/components/graphs.component.ts b/projects/nls-guilloche/src/nls/components/graphs.component.ts index 4c1ffa4..27c07ac 100644 --- a/projects/nls-guilloche/src/nls/components/graphs.component.ts +++ b/projects/nls-guilloche/src/nls/components/graphs.component.ts @@ -15,7 +15,7 @@ */ import { ViewChild, Component, Input, Output, SimpleChanges, OnChanges, EventEmitter, HostListener } from '@angular/core'; -import { Observable, interval, Subscription } from 'rxjs'; +import { Observable, interval } from 'rxjs'; import * as Selection from 'd3-selection'; import * as Shape from 'd3-shape'; import * as Random from 'd3-random'; @@ -125,7 +125,8 @@ export class NlsGraphsComponent implements OnChanges { this.graphs = curveList.map(curve => { return { ...this.adjustGraph(curve), - spread: this.config.spread + spread: this.config.spread, + interval: this.config.interval }; }); this.hash = this.historyService.hash(this.graphs); diff --git a/projects/nls-guilloche/src/nls/directives/guilloche.directive.ts b/projects/nls-guilloche/src/nls/directives/guilloche.directive.ts index f2606f7..fe8853d 100644 --- a/projects/nls-guilloche/src/nls/directives/guilloche.directive.ts +++ b/projects/nls-guilloche/src/nls/directives/guilloche.directive.ts @@ -28,8 +28,6 @@ import { NlsCanvasService } from './../services/canvas.service'; import { NlsMathService } from './../services/math.service'; import { NlsGraphService } from '../services/graph.service'; -const ANIMATION_INTERVAL = 30; - @Directive({ selector: '[nlsGuilloche]' }) @@ -91,14 +89,12 @@ export class NlsGuillocheDirective implements OnChanges, OnDestroy { }); let i = 0; this.animationInterval = setInterval(() => { - // this.animateGraph(); this.animateGraph(i++ % 1000 / 10000); - }, ANIMATION_INTERVAL); + }, this.graph.interval); } else { if (this.animationInterval) { this.bounce = null; clearInterval(this.animationInterval); - // return; } } diff --git a/projects/nls-guilloche/src/nls/models/config.model.ts b/projects/nls-guilloche/src/nls/models/config.model.ts index 87b89cd..5998037 100644 --- a/projects/nls-guilloche/src/nls/models/config.model.ts +++ b/projects/nls-guilloche/src/nls/models/config.model.ts @@ -43,6 +43,7 @@ export interface Config { stroke: any; overlap: any; scale: any; + interval: number; date?: Date; autoHeight?: boolean; } diff --git a/projects/nls-guilloche/src/nls/models/graph.model.ts b/projects/nls-guilloche/src/nls/models/graph.model.ts index c10cb99..b403f99 100644 --- a/projects/nls-guilloche/src/nls/models/graph.model.ts +++ b/projects/nls-guilloche/src/nls/models/graph.model.ts @@ -1,3 +1,4 @@ +import { interval } from 'rxjs'; /** * Copyright (C) 2018 Michael Czechowski * This program is free software; you can redistribute it and/or modify it @@ -34,6 +35,7 @@ export interface Graph { amount: number; spacing: number }; + interval: number; stroke: number; // stroke width nodes?: Point[]; // orientation points } diff --git a/src/app/app.component.html b/src/app/app.component.html index df41501..af3b769 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -106,6 +106,14 @@ + +
+ + +
+