2
0

added new interval parameter

This commit is contained in:
2018-10-26 10:51:25 +02:00
parent e2393990ee
commit af61a8868f
8 changed files with 25 additions and 10 deletions

View File

@@ -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);

View File

@@ -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;
}
}

View File

@@ -43,6 +43,7 @@ export interface Config {
stroke: any;
overlap: any;
scale: any;
interval: number;
date?: Date;
autoHeight?: boolean;
}

View File

@@ -1,3 +1,4 @@
import { interval } from 'rxjs';
/**
* Copyright (C) 2018 Michael Czechowski <mail@dailysh.it>
* 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
}