added new interval parameter
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ViewChild, Component, Input, Output, SimpleChanges, OnChanges, EventEmitter, HostListener } from '@angular/core';
|
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 Selection from 'd3-selection';
|
||||||
import * as Shape from 'd3-shape';
|
import * as Shape from 'd3-shape';
|
||||||
import * as Random from 'd3-random';
|
import * as Random from 'd3-random';
|
||||||
@@ -125,7 +125,8 @@ export class NlsGraphsComponent implements OnChanges {
|
|||||||
this.graphs = curveList.map(curve => {
|
this.graphs = curveList.map(curve => {
|
||||||
return {
|
return {
|
||||||
...this.adjustGraph(curve),
|
...this.adjustGraph(curve),
|
||||||
spread: this.config.spread
|
spread: this.config.spread,
|
||||||
|
interval: this.config.interval
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
this.hash = this.historyService.hash(this.graphs);
|
this.hash = this.historyService.hash(this.graphs);
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ import { NlsCanvasService } from './../services/canvas.service';
|
|||||||
import { NlsMathService } from './../services/math.service';
|
import { NlsMathService } from './../services/math.service';
|
||||||
import { NlsGraphService } from '../services/graph.service';
|
import { NlsGraphService } from '../services/graph.service';
|
||||||
|
|
||||||
const ANIMATION_INTERVAL = 30;
|
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[nlsGuilloche]'
|
selector: '[nlsGuilloche]'
|
||||||
})
|
})
|
||||||
@@ -91,14 +89,12 @@ export class NlsGuillocheDirective implements OnChanges, OnDestroy {
|
|||||||
});
|
});
|
||||||
let i = 0;
|
let i = 0;
|
||||||
this.animationInterval = setInterval(() => {
|
this.animationInterval = setInterval(() => {
|
||||||
// this.animateGraph();
|
|
||||||
this.animateGraph(i++ % 1000 / 10000);
|
this.animateGraph(i++ % 1000 / 10000);
|
||||||
}, ANIMATION_INTERVAL);
|
}, this.graph.interval);
|
||||||
} else {
|
} else {
|
||||||
if (this.animationInterval) {
|
if (this.animationInterval) {
|
||||||
this.bounce = null;
|
this.bounce = null;
|
||||||
clearInterval(this.animationInterval);
|
clearInterval(this.animationInterval);
|
||||||
// return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ export interface Config {
|
|||||||
stroke: any;
|
stroke: any;
|
||||||
overlap: any;
|
overlap: any;
|
||||||
scale: any;
|
scale: any;
|
||||||
|
interval: number;
|
||||||
date?: Date;
|
date?: Date;
|
||||||
autoHeight?: boolean;
|
autoHeight?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { interval } from 'rxjs';
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Michael Czechowski <mail@dailysh.it>
|
* Copyright (C) 2018 Michael Czechowski <mail@dailysh.it>
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -34,6 +35,7 @@ export interface Graph {
|
|||||||
amount: number;
|
amount: number;
|
||||||
spacing: number
|
spacing: number
|
||||||
};
|
};
|
||||||
|
interval: number;
|
||||||
stroke: number; // stroke width
|
stroke: number; // stroke width
|
||||||
nodes?: Point[]; // orientation points
|
nodes?: Point[]; // orientation points
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,14 @@
|
|||||||
<input type="number" class="form-control" formControlName="spacing">
|
<input type="number" class="form-control" formControlName="spacing">
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-control-label">
|
||||||
|
Animationsinterval
|
||||||
|
</label>
|
||||||
|
<input type="number" class="form-control" formControlName="interval" min="0" max="1000" step="1">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group d-flex flex-colmn justify-content-between align-items-center mb-4">
|
<div class="form-group d-flex flex-colmn justify-content-between align-items-center mb-4">
|
||||||
<label class="form-control-label">
|
<label class="form-control-label">
|
||||||
Animation
|
Animation
|
||||||
|
|||||||
@@ -58,5 +58,9 @@ export let ConfigForm: FormGroup = fb.group({
|
|||||||
Validators.min(0),
|
Validators.min(0),
|
||||||
Validators.max(50)
|
Validators.max(50)
|
||||||
])),
|
])),
|
||||||
})
|
}),
|
||||||
|
interval: fb.control('', Validators.compose([
|
||||||
|
Validators.min(0),
|
||||||
|
Validators.max(1000)
|
||||||
|
])),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export const environment = {
|
|||||||
spread: {
|
spread: {
|
||||||
amount: 28,
|
amount: 28,
|
||||||
spacing: 16
|
spacing: 16
|
||||||
}
|
},
|
||||||
|
interval: 30
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export const environment = {
|
|||||||
production: false,
|
production: false,
|
||||||
debug: false,
|
debug: false,
|
||||||
animation: false,
|
animation: false,
|
||||||
|
animationInterval: 30,
|
||||||
config: {
|
config: {
|
||||||
colors: {
|
colors: {
|
||||||
primary: '#129490',
|
primary: '#129490',
|
||||||
@@ -41,6 +42,7 @@ export const environment = {
|
|||||||
spread: {
|
spread: {
|
||||||
amount: 30,
|
amount: 30,
|
||||||
spacing: 20
|
spacing: 20
|
||||||
}
|
},
|
||||||
|
interval: 30
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user