diff --git a/projects/nls-guilloche/package.json b/projects/nls-guilloche/package.json index 39065c2..f93a531 100644 --- a/projects/nls-guilloche/package.json +++ b/projects/nls-guilloche/package.json @@ -1,6 +1,6 @@ { "name": "nls-guilloche", - "version": "0.2.0", + "version": "0.3.0", "repository": { "type": "git", "url": "https://github.com/nextlevelshit/nls-ng6-d3js-guilloche" diff --git a/projects/nls-guilloche/src/lib/directives/guilloche.directive.ts b/projects/nls-guilloche/src/lib/directives/guilloche.directive.ts index 9b3f355..d3da917 100644 --- a/projects/nls-guilloche/src/lib/directives/guilloche.directive.ts +++ b/projects/nls-guilloche/src/lib/directives/guilloche.directive.ts @@ -22,10 +22,8 @@ import * as Drag from 'd3-drag'; import * as Ease from 'd3-ease'; import * as Timer from 'd3-timer'; -import { Config } from './../models/config.model'; import { Graph } from './../models/graph.model'; import { Point } from './../models/point.model'; -import { Param } from './../models/param.model'; import { NlsCanvasService } from './../services/canvas.service'; import { NlsMathService } from './../services/math.service'; import { NlsGraphService } from '../services/graph.service'; @@ -49,9 +47,7 @@ export class NlsGuillocheDirective implements OnChanges, OnDestroy { private pathElements: any; @Input() graph: Graph; - @Input() matrix: any; - @Input() config: any; - @Input() animate: boolean; + @Input() animation: boolean; constructor( private canvasService: NlsCanvasService, @@ -80,7 +76,7 @@ export class NlsGuillocheDirective implements OnChanges, OnDestroy { this.medianPoint = this.math.medianOfCurve(this.initialCurve); this.medianIndex = this.math.medianIndex(this.initialCurve); - if (this.graphService.isAnimated) { + if (this.animation) { this.graph.nodes = this.graph.nodes.slice().map((node, i) => { return { x: node.x, @@ -135,9 +131,9 @@ export class NlsGuillocheDirective implements OnChanges, OnDestroy { private spreadLines(points: Point[]) { const shiftedMedians = []; - const genshiftedMedians = this.graphService.spreadOrthogonal(this.medianPoint, this.config.spread.spacing); + const genshiftedMedians = this.graphService.spreadOrthogonal(this.medianPoint, this.graph.spread.spacing); - for (let i = 0; i < this.config.spread.amount; i++) { + for (let i = 0; i < this.graph.spread.amount; i++) { shiftedMedians.push(genshiftedMedians.next().value); } diff --git a/projects/nls-guilloche/src/lib/models/config.model.ts b/projects/nls-guilloche/src/lib/models/config.model.ts index 6729cb3..2afd1cf 100644 --- a/projects/nls-guilloche/src/lib/models/config.model.ts +++ b/projects/nls-guilloche/src/lib/models/config.model.ts @@ -20,18 +20,28 @@ export interface Config { start: { x: number; y: number; - color: string; }; end: { x: number; y: number; - color: string; }; vectors: { - spacing: number + spacing: number; + start: any; + end: any; + range: any; + }; + colors: { + primary: string; + secondary: string; }; spread: { amount: number; spacing: number }; + date?: Date; + nodes: any; + stroke: any; + overlap: any; + scale: any; } diff --git a/projects/nls-guilloche/src/lib/models/graph.model.ts b/projects/nls-guilloche/src/lib/models/graph.model.ts index b3f9f9d..c10cb99 100644 --- a/projects/nls-guilloche/src/lib/models/graph.model.ts +++ b/projects/nls-guilloche/src/lib/models/graph.model.ts @@ -15,6 +15,7 @@ */ import { Point } from './point.model'; +import { Config } from './config.model'; export interface Graph { id: string; @@ -29,6 +30,10 @@ export interface Graph { direction?: Point; vector: number; // degree between 0 and 360 }; + spread: { + amount: number; + spacing: number + }; stroke: number; // stroke width nodes?: Point[]; // orientation points } diff --git a/src/app/app.component.html b/src/app/app.component.html index 23ddeea..096420e 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,4 +1,4 @@ - +