@flowmap.gl/layers 8.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +199 -0
- package/dist/AnimatedFlowLinesLayer/AnimatedFlowLinesLayer.d.ts +76 -0
- package/dist/AnimatedFlowLinesLayer/AnimatedFlowLinesLayer.d.ts.map +1 -0
- package/dist/AnimatedFlowLinesLayer/AnimatedFlowLinesLayer.js +139 -0
- package/dist/AnimatedFlowLinesLayer/AnimatedFlowLinesLayerFragment.glsl.d.ts +3 -0
- package/dist/AnimatedFlowLinesLayer/AnimatedFlowLinesLayerFragment.glsl.d.ts.map +1 -0
- package/dist/AnimatedFlowLinesLayer/AnimatedFlowLinesLayerFragment.glsl.js +37 -0
- package/dist/AnimatedFlowLinesLayer/AnimatedFlowLinesLayerVertex.glsl.d.ts +3 -0
- package/dist/AnimatedFlowLinesLayer/AnimatedFlowLinesLayerVertex.glsl.d.ts.map +1 -0
- package/dist/AnimatedFlowLinesLayer/AnimatedFlowLinesLayerVertex.glsl.js +91 -0
- package/dist/AnimatedFlowLinesLayer/index.d.ts +3 -0
- package/dist/AnimatedFlowLinesLayer/index.d.ts.map +1 -0
- package/dist/AnimatedFlowLinesLayer/index.js +3 -0
- package/dist/FlowCirclesLayer/FlowCirclesLayer.d.ts +59 -0
- package/dist/FlowCirclesLayer/FlowCirclesLayer.d.ts.map +1 -0
- package/dist/FlowCirclesLayer/FlowCirclesLayer.js +115 -0
- package/dist/FlowCirclesLayer/FlowCirclesLayerFragment.glsl.d.ts +3 -0
- package/dist/FlowCirclesLayer/FlowCirclesLayerFragment.glsl.d.ts.map +1 -0
- package/dist/FlowCirclesLayer/FlowCirclesLayerFragment.glsl.js +73 -0
- package/dist/FlowCirclesLayer/FlowCirclesLayerVertex.glsl.d.ts +3 -0
- package/dist/FlowCirclesLayer/FlowCirclesLayerVertex.glsl.d.ts.map +1 -0
- package/dist/FlowCirclesLayer/FlowCirclesLayerVertex.glsl.js +63 -0
- package/dist/FlowCirclesLayer/index.d.ts +3 -0
- package/dist/FlowCirclesLayer/index.d.ts.map +1 -0
- package/dist/FlowCirclesLayer/index.js +3 -0
- package/dist/FlowLinesLayer/FlowLinesLayer.d.ts +64 -0
- package/dist/FlowLinesLayer/FlowLinesLayer.d.ts.map +1 -0
- package/dist/FlowLinesLayer/FlowLinesLayer.js +182 -0
- package/dist/FlowLinesLayer/FlowLinesLayerFragment.glsl.d.ts +3 -0
- package/dist/FlowLinesLayer/FlowLinesLayerFragment.glsl.d.ts.map +1 -0
- package/dist/FlowLinesLayer/FlowLinesLayerFragment.glsl.js +36 -0
- package/dist/FlowLinesLayer/FlowLinesLayerVertex.glsl.d.ts +3 -0
- package/dist/FlowLinesLayer/FlowLinesLayerVertex.glsl.d.ts.map +1 -0
- package/dist/FlowLinesLayer/FlowLinesLayerVertex.glsl.js +102 -0
- package/dist/FlowLinesLayer/index.d.ts +3 -0
- package/dist/FlowLinesLayer/index.d.ts.map +1 -0
- package/dist/FlowLinesLayer/index.js +3 -0
- package/dist/FlowMapLayer.d.ts +70 -0
- package/dist/FlowMapLayer.d.ts.map +1 -0
- package/dist/FlowMapLayer.js +304 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/types.d.ts +31 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +20 -0
- package/package.json +24 -0
- package/src/AnimatedFlowLinesLayer/AnimatedFlowLinesLayer.ts +189 -0
- package/src/AnimatedFlowLinesLayer/AnimatedFlowLinesLayerFragment.glsl.ts +37 -0
- package/src/AnimatedFlowLinesLayer/AnimatedFlowLinesLayerVertex.glsl.ts +90 -0
- package/src/AnimatedFlowLinesLayer/index.ts +3 -0
- package/src/FlowCirclesLayer/FlowCirclesLayer.ts +150 -0
- package/src/FlowCirclesLayer/FlowCirclesLayerFragment.glsl.ts +72 -0
- package/src/FlowCirclesLayer/FlowCirclesLayerVertex.glsl.ts +62 -0
- package/src/FlowCirclesLayer/index.ts +3 -0
- package/src/FlowLinesLayer/FlowLinesLayer.ts +238 -0
- package/src/FlowLinesLayer/FlowLinesLayerFragment.glsl.ts +35 -0
- package/src/FlowLinesLayer/FlowLinesLayerVertex.glsl.ts +101 -0
- package/src/FlowLinesLayer/index.ts +3 -0
- package/src/FlowMapLayer.ts +448 -0
- package/src/index.ts +7 -0
- package/src/types.ts +67 -0
- package/tsconfig.json +11 -0
- package/typings.d.ts +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
Apache License
|
|
6
|
+
Version 2.0, January 2004
|
|
7
|
+
http://www.apache.org/licenses/
|
|
8
|
+
|
|
9
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
10
|
+
|
|
11
|
+
1. Definitions.
|
|
12
|
+
|
|
13
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
14
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
15
|
+
|
|
16
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
17
|
+
the copyright owner that is granting the License.
|
|
18
|
+
|
|
19
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
20
|
+
other entities that control, are controlled by, or are under common
|
|
21
|
+
control with that entity. For the purposes of this definition,
|
|
22
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
23
|
+
direction or management of such entity, whether by contract or
|
|
24
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
25
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
26
|
+
|
|
27
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
28
|
+
exercising permissions granted by this License.
|
|
29
|
+
|
|
30
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
31
|
+
including but not limited to software source code, documentation
|
|
32
|
+
source, and configuration files.
|
|
33
|
+
|
|
34
|
+
"Object" form shall mean any form resulting from mechanical
|
|
35
|
+
transformation or translation of a Source form, including but
|
|
36
|
+
not limited to compiled object code, generated documentation,
|
|
37
|
+
and conversions to other media types.
|
|
38
|
+
|
|
39
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
40
|
+
Object form, made available under the License, as indicated by a
|
|
41
|
+
copyright notice that is included in or attached to the work
|
|
42
|
+
(an example is provided in the Appendix below).
|
|
43
|
+
|
|
44
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
45
|
+
form, that is based on (or derived from) the Work and for which the
|
|
46
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
47
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
48
|
+
of this License, Derivative Works shall not include works that remain
|
|
49
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
50
|
+
the Work and Derivative Works thereof.
|
|
51
|
+
|
|
52
|
+
"Contribution" shall mean any work of authorship, including
|
|
53
|
+
the original version of the Work and any modifications or additions
|
|
54
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
55
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
56
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
57
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
58
|
+
means any form of electronic, verbal, or written communication sent
|
|
59
|
+
to the Licensor or its representatives, including but not limited to
|
|
60
|
+
communication on electronic mailing lists, source code control systems,
|
|
61
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
62
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
63
|
+
excluding communication that is conspicuously marked or otherwise
|
|
64
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
65
|
+
|
|
66
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
67
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
68
|
+
subsequently incorporated within the Work.
|
|
69
|
+
|
|
70
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
71
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
72
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
73
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
74
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
75
|
+
Work and such Derivative Works in Source or Object form.
|
|
76
|
+
|
|
77
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
78
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
79
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
80
|
+
(except as stated in this section) patent license to make, have made,
|
|
81
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
82
|
+
where such license applies only to those patent claims licensable
|
|
83
|
+
by such Contributor that are necessarily infringed by their
|
|
84
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
85
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
86
|
+
institute patent litigation against any entity (including a
|
|
87
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
88
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
89
|
+
or contributory patent infringement, then any patent licenses
|
|
90
|
+
granted to You under this License for that Work shall terminate
|
|
91
|
+
as of the date such litigation is filed.
|
|
92
|
+
|
|
93
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
94
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
95
|
+
modifications, and in Source or Object form, provided that You
|
|
96
|
+
meet the following conditions:
|
|
97
|
+
|
|
98
|
+
(a) You must give any other recipients of the Work or
|
|
99
|
+
Derivative Works a copy of this License; and
|
|
100
|
+
|
|
101
|
+
(b) You must cause any modified files to carry prominent notices
|
|
102
|
+
stating that You changed the files; and
|
|
103
|
+
|
|
104
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
105
|
+
that You distribute, all copyright, patent, trademark, and
|
|
106
|
+
attribution notices from the Source form of the Work,
|
|
107
|
+
excluding those notices that do not pertain to any part of
|
|
108
|
+
the Derivative Works; and
|
|
109
|
+
|
|
110
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
111
|
+
distribution, then any Derivative Works that You distribute must
|
|
112
|
+
include a readable copy of the attribution notices contained
|
|
113
|
+
within such NOTICE file, excluding those notices that do not
|
|
114
|
+
pertain to any part of the Derivative Works, in at least one
|
|
115
|
+
of the following places: within a NOTICE text file distributed
|
|
116
|
+
as part of the Derivative Works; within the Source form or
|
|
117
|
+
documentation, if provided along with the Derivative Works; or,
|
|
118
|
+
within a display generated by the Derivative Works, if and
|
|
119
|
+
wherever such third-party notices normally appear. The contents
|
|
120
|
+
of the NOTICE file are for informational purposes only and
|
|
121
|
+
do not modify the License. You may add Your own attribution
|
|
122
|
+
notices within Derivative Works that You distribute, alongside
|
|
123
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
124
|
+
that such additional attribution notices cannot be construed
|
|
125
|
+
as modifying the License.
|
|
126
|
+
|
|
127
|
+
You may add Your own copyright statement to Your modifications and
|
|
128
|
+
may provide additional or different license terms and conditions
|
|
129
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
130
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
131
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
132
|
+
the conditions stated in this License.
|
|
133
|
+
|
|
134
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
135
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
136
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
137
|
+
this License, without any additional terms or conditions.
|
|
138
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
139
|
+
the terms of any separate license agreement you may have executed
|
|
140
|
+
with Licensor regarding such Contributions.
|
|
141
|
+
|
|
142
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
143
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
144
|
+
except as required for reasonable and customary use in describing the
|
|
145
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
146
|
+
|
|
147
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
148
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
149
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
150
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
151
|
+
implied, including, without limitation, any warranties or conditions
|
|
152
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
153
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
154
|
+
appropriateness of using or redistributing the Work and assume any
|
|
155
|
+
risks associated with Your exercise of permissions under this License.
|
|
156
|
+
|
|
157
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
158
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
159
|
+
unless required by applicable law (such as deliberate and grossly
|
|
160
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
161
|
+
liable to You for damages, including any direct, indirect, special,
|
|
162
|
+
incidental, or consequential damages of any character arising as a
|
|
163
|
+
result of this License or out of the use or inability to use the
|
|
164
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
165
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
166
|
+
other commercial damages or losses), even if such Contributor
|
|
167
|
+
has been advised of the possibility of such damages.
|
|
168
|
+
|
|
169
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
170
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
171
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
172
|
+
or other liability obligations and/or rights consistent with this
|
|
173
|
+
License. However, in accepting such obligations, You may act only
|
|
174
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
175
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
176
|
+
defend, and hold each Contributor harmless for any liability
|
|
177
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
178
|
+
of your accepting any such warranty or additional liability.
|
|
179
|
+
|
|
180
|
+
END OF TERMS AND CONDITIONS
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
Copyright 2022 FlowmapBlue
|
|
187
|
+
Copyright 2018-2020 Teralytics
|
|
188
|
+
|
|
189
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
190
|
+
you may not use this file except in compliance with the License.
|
|
191
|
+
You may obtain a copy of the License at
|
|
192
|
+
|
|
193
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
194
|
+
|
|
195
|
+
Unless required by applicable law or agreed to in writing, software
|
|
196
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
197
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
198
|
+
See the License for the specific language governing permissions and
|
|
199
|
+
limitations under the License.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Layer } from '@deck.gl/core';
|
|
2
|
+
import { FlowLinesLayerAttributes, RGBA } from '@flowmap.gl/data';
|
|
3
|
+
import { LayerProps } from '../types';
|
|
4
|
+
export interface Props<F> extends LayerProps {
|
|
5
|
+
id: string;
|
|
6
|
+
opacity?: number;
|
|
7
|
+
pickable?: boolean;
|
|
8
|
+
updateTriggers?: {
|
|
9
|
+
[key: string]: Record<string, unknown>;
|
|
10
|
+
};
|
|
11
|
+
data: F[] | FlowLinesLayerAttributes;
|
|
12
|
+
drawOutline: boolean;
|
|
13
|
+
outlineColor?: RGBA;
|
|
14
|
+
outlineThickness?: number;
|
|
15
|
+
currentTime?: number;
|
|
16
|
+
thicknessUnit?: number;
|
|
17
|
+
animationTailLength?: number;
|
|
18
|
+
getSourcePosition?: (d: F) => [number, number];
|
|
19
|
+
getTargetPosition?: (d: F) => [number, number];
|
|
20
|
+
getStaggering?: (d: F, info: AccessorObjectInfo) => number;
|
|
21
|
+
getPickable?: (d: F, { index }: {
|
|
22
|
+
index: number;
|
|
23
|
+
}) => number;
|
|
24
|
+
getColor?: (d: F) => RGBA;
|
|
25
|
+
getThickness?: (d: F) => number;
|
|
26
|
+
getEndpointOffsets?: (d: F) => [number, number];
|
|
27
|
+
}
|
|
28
|
+
export interface AccessorObjectInfo {
|
|
29
|
+
index: number;
|
|
30
|
+
data: any;
|
|
31
|
+
target: any;
|
|
32
|
+
}
|
|
33
|
+
export default class AnimatedFlowLinesLayer<F> extends Layer {
|
|
34
|
+
static defaultProps: {
|
|
35
|
+
currentTime: number;
|
|
36
|
+
animationTailLength: number;
|
|
37
|
+
getSourcePosition: {
|
|
38
|
+
type: string;
|
|
39
|
+
value: (d: any) => number[];
|
|
40
|
+
};
|
|
41
|
+
getTargetPosition: {
|
|
42
|
+
type: string;
|
|
43
|
+
value: (d: any) => number[];
|
|
44
|
+
};
|
|
45
|
+
getPickable: {
|
|
46
|
+
type: string;
|
|
47
|
+
value: (d: any) => number;
|
|
48
|
+
};
|
|
49
|
+
getStaggering: {
|
|
50
|
+
type: string;
|
|
51
|
+
value: (d: any, { index }: {
|
|
52
|
+
index: number;
|
|
53
|
+
}) => number;
|
|
54
|
+
};
|
|
55
|
+
getColor: {
|
|
56
|
+
type: string;
|
|
57
|
+
value: RGBA;
|
|
58
|
+
};
|
|
59
|
+
getThickness: {
|
|
60
|
+
type: string;
|
|
61
|
+
value: number;
|
|
62
|
+
};
|
|
63
|
+
thicknessUnit: number;
|
|
64
|
+
parameters: {
|
|
65
|
+
depthTest: boolean;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
constructor(props: Props<F>);
|
|
69
|
+
getShaders(): Record<string, unknown>;
|
|
70
|
+
initializeState(): void;
|
|
71
|
+
getNeedsRedraw(): boolean;
|
|
72
|
+
updateState({ props, oldProps, changeFlags }: Record<string, any>): void;
|
|
73
|
+
draw({ uniforms }: Record<string, any>): void;
|
|
74
|
+
_getModel(gl: WebGLRenderingContext): Record<string, unknown>;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=AnimatedFlowLinesLayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimatedFlowLinesLayer.d.ts","sourceRoot":"","sources":["../../src/AnimatedFlowLinesLayer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,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC;IAChC,kBAAkB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjD;AAGD,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;IACV,MAAM,EAAE,GAAG,CAAC;CACb;AAOD,MAAM,CAAC,OAAO,OAAO,sBAAsB,CAAC,CAAC,CAAE,SAAQ,KAAK;IAC1D,MAAM,CAAC,YAAY;;;;;uBAGgC,GAAG;;;;uBACH,GAAG;;;;uBACT,GAAG;;;;uBAGjC,GAAG;uBAAmB,MAAM;;;;;;;;;;;;;;;MAQzC;gBAEU,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAI3B,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IASrC,eAAe,IAAI,IAAI;IA0CvB,cAAc,IAAI,OAAO;IAIzB,WAAW,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAatE,IAAI,CAAC,EAAC,QAAQ,EAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAe3C,SAAS,CAAC,EAAE,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAwB9D"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 FlowmapBlue
|
|
3
|
+
* Copyright 2018-2020 Teralytics, modified by FlowmapBlue
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
import { Layer, picking, project32 } from '@deck.gl/core';
|
|
19
|
+
import GL from '@luma.gl/constants';
|
|
20
|
+
import { Geometry, Model } from '@luma.gl/core';
|
|
21
|
+
import FragmentShader from './AnimatedFlowLinesLayerFragment.glsl';
|
|
22
|
+
import VertexShader from './AnimatedFlowLinesLayerVertex.glsl';
|
|
23
|
+
const DEFAULT_COLOR = [0, 132, 193, 255];
|
|
24
|
+
const loopLength = 1800;
|
|
25
|
+
const animationSpeed = 20;
|
|
26
|
+
const loopTime = loopLength / animationSpeed;
|
|
27
|
+
export default class AnimatedFlowLinesLayer extends Layer {
|
|
28
|
+
constructor(props) {
|
|
29
|
+
super(props);
|
|
30
|
+
}
|
|
31
|
+
getShaders() {
|
|
32
|
+
return super.getShaders({
|
|
33
|
+
vs: VertexShader,
|
|
34
|
+
fs: FragmentShader,
|
|
35
|
+
modules: [project32, picking],
|
|
36
|
+
shaderCache: this.context.shaderCache,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
initializeState() {
|
|
40
|
+
const attributeManager = this.getAttributeManager();
|
|
41
|
+
/* eslint-disable max-len */
|
|
42
|
+
attributeManager.addInstanced({
|
|
43
|
+
instanceSourcePositions: {
|
|
44
|
+
size: 3,
|
|
45
|
+
transition: true,
|
|
46
|
+
accessor: 'getSourcePosition',
|
|
47
|
+
},
|
|
48
|
+
instanceTargetPositions: {
|
|
49
|
+
size: 3,
|
|
50
|
+
transition: true,
|
|
51
|
+
accessor: 'getTargetPosition',
|
|
52
|
+
},
|
|
53
|
+
instanceColors: {
|
|
54
|
+
size: 4,
|
|
55
|
+
type: GL.UNSIGNED_BYTE,
|
|
56
|
+
transition: true,
|
|
57
|
+
accessor: 'getColor',
|
|
58
|
+
defaultValue: [0, 0, 0, 255],
|
|
59
|
+
},
|
|
60
|
+
instanceWidths: {
|
|
61
|
+
size: 1,
|
|
62
|
+
transition: true,
|
|
63
|
+
accessor: 'getThickness',
|
|
64
|
+
defaultValue: 1,
|
|
65
|
+
},
|
|
66
|
+
instanceStaggering: {
|
|
67
|
+
accessor: 'getStaggering',
|
|
68
|
+
size: 1,
|
|
69
|
+
transition: false,
|
|
70
|
+
},
|
|
71
|
+
instancePickable: {
|
|
72
|
+
accessor: 'getPickable',
|
|
73
|
+
size: 1,
|
|
74
|
+
transition: false,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
/* eslint-enable max-len */
|
|
78
|
+
}
|
|
79
|
+
getNeedsRedraw() {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
updateState({ props, oldProps, changeFlags }) {
|
|
83
|
+
super.updateState({ props, oldProps, changeFlags });
|
|
84
|
+
if (changeFlags.extensionsChanged) {
|
|
85
|
+
const { gl } = this.context;
|
|
86
|
+
if (this.state.model) {
|
|
87
|
+
this.state.model.delete();
|
|
88
|
+
}
|
|
89
|
+
this.setState({ model: this._getModel(gl) });
|
|
90
|
+
this.getAttributeManager().invalidateAll();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
draw({ uniforms }) {
|
|
94
|
+
const { thicknessUnit, animationTailLength } = this.props;
|
|
95
|
+
const timestamp = Date.now() / 1000;
|
|
96
|
+
const animationTime = ((timestamp % loopTime) / loopTime) * loopLength;
|
|
97
|
+
this.state.model
|
|
98
|
+
.setUniforms(Object.assign(Object.assign({}, uniforms), { thicknessUnit: thicknessUnit * 4, animationTailLength, currentTime: animationTime }))
|
|
99
|
+
.draw();
|
|
100
|
+
}
|
|
101
|
+
_getModel(gl) {
|
|
102
|
+
/*
|
|
103
|
+
* (0, -1)-------------_(1, -1)
|
|
104
|
+
* | _,-" |
|
|
105
|
+
* o _,-" o
|
|
106
|
+
* | _,-" |
|
|
107
|
+
* (0, 1)"-------------(1, 1)
|
|
108
|
+
*/
|
|
109
|
+
const positions = [0, -1, 0, 0, 1, 0, 1, -1, 0, 1, 1, 0];
|
|
110
|
+
return new Model(gl, Object.assign({}, this.getShaders(), {
|
|
111
|
+
id: this.props.id,
|
|
112
|
+
geometry: new Geometry({
|
|
113
|
+
drawMode: GL.TRIANGLE_STRIP,
|
|
114
|
+
attributes: {
|
|
115
|
+
positions: new Float32Array(positions),
|
|
116
|
+
},
|
|
117
|
+
}),
|
|
118
|
+
isInstanced: true,
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
AnimatedFlowLinesLayer.defaultProps = {
|
|
123
|
+
currentTime: 0,
|
|
124
|
+
animationTailLength: 0.7,
|
|
125
|
+
getSourcePosition: { type: 'accessor', value: (d) => [0, 0] },
|
|
126
|
+
getTargetPosition: { type: 'accessor', value: (d) => [0, 0] },
|
|
127
|
+
getPickable: { type: 'accessor', value: (d) => 1.0 },
|
|
128
|
+
getStaggering: {
|
|
129
|
+
type: 'accessor',
|
|
130
|
+
value: (d, { index }) => Math.random(),
|
|
131
|
+
},
|
|
132
|
+
getColor: { type: 'accessor', value: DEFAULT_COLOR },
|
|
133
|
+
getThickness: { type: 'accessor', value: 1 },
|
|
134
|
+
thicknessUnit: 15 * 2,
|
|
135
|
+
parameters: {
|
|
136
|
+
depthTest: false,
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQW5pbWF0ZWRGbG93TGluZXNMYXllci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9BbmltYXRlZEZsb3dMaW5lc0xheWVyL0FuaW1hdGVkRmxvd0xpbmVzTGF5ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ik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gICAgICogICAgICAgfCAgXywtXCIgICAgICAgICAgfFxuICAgICAqICAgKDAsIDEpXCItLS0tLS0tLS0tLS0tKDEsIDEpXG4gICAgICovXG4gICAgY29uc3QgcG9zaXRpb25zID0gWzAsIC0xLCAwLCAwLCAxLCAwLCAxLCAtMSwgMCwgMSwgMSwgMF07XG5cbiAgICByZXR1cm4gbmV3IE1vZGVsKFxuICAgICAgZ2wsXG4gICAgICBPYmplY3QuYXNzaWduKHt9LCB0aGlzLmdldFNoYWRlcnMoKSwge1xuICAgICAgICBpZDogdGhpcy5wcm9wcy5pZCxcbiAgICAgICAgZ2VvbWV0cnk6IG5ldyBHZW9tZXRyeSh7XG4gICAgICAgICAgZHJhd01vZGU6IEdMLlRSSUFOR0xFX1NUUklQLFxuICAgICAgICAgIGF0dHJpYnV0ZXM6IHtcbiAgICAgICAgICAgIHBvc2l0aW9uczogbmV3IEZsb2F0MzJBcnJheShwb3NpdGlvbnMpLFxuICAgICAgICAgIH0sXG4gICAgICAgIH0pLFxuICAgICAgICBpc0luc3RhbmNlZDogdHJ1ZSxcbiAgICAgIH0pLFxuICAgICk7XG4gIH1cbn1cbiJdfQ==
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default: "#define SHADER_NAME animated-flow-lines-layer-fragment-shader\n\nprecision highp float;\n\nuniform float animationTailLength;\n\nvarying vec4 vColor;\nvarying float sourceToTarget;\nvarying vec2 uv;\n \nvoid main(void) {\n geometry.uv = uv;\n\n gl_FragColor = vec4(vColor.xyz, vColor.w * smoothstep(1.0 - animationTailLength, 1.0, fract(sourceToTarget)));\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=AnimatedFlowLinesLayerFragment.glsl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimatedFlowLinesLayerFragment.glsl.d.ts","sourceRoot":"","sources":["../../src/AnimatedFlowLinesLayer/AnimatedFlowLinesLayerFragment.glsl.ts"],"names":[],"mappings":";AAkBA,wBAkBE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 FlowmapBlue
|
|
3
|
+
* Copyright 2018-2020 Teralytics, modified by FlowmapBlue
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export default `\
|
|
19
|
+
#define SHADER_NAME animated-flow-lines-layer-fragment-shader
|
|
20
|
+
|
|
21
|
+
precision highp float;
|
|
22
|
+
|
|
23
|
+
uniform float animationTailLength;
|
|
24
|
+
|
|
25
|
+
varying vec4 vColor;
|
|
26
|
+
varying float sourceToTarget;
|
|
27
|
+
varying vec2 uv;
|
|
28
|
+
|
|
29
|
+
void main(void) {
|
|
30
|
+
geometry.uv = uv;
|
|
31
|
+
|
|
32
|
+
gl_FragColor = vec4(vColor.xyz, vColor.w * smoothstep(1.0 - animationTailLength, 1.0, fract(sourceToTarget)));
|
|
33
|
+
|
|
34
|
+
DECKGL_FILTER_COLOR(gl_FragColor, geometry);
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQW5pbWF0ZWRGbG93TGluZXNMYXllckZyYWdtZW50Lmdsc2wuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI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XJuaW5nIHBlcm1pc3Npb25zIGFuZFxuICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuXG4gKlxuICovXG5cbmV4cG9ydCBkZWZhdWx0IGBcXFxuI2RlZmluZSBTSEFERVJfTkFNRSBhbmltYXRlZC1mbG93LWxpbmVzLWxheWVyLWZyYWdtZW50LXNoYWRlclxuXG5wcmVjaXNpb24gaGlnaHAgZmxvYXQ7XG5cbnVuaWZvcm0gZmxvYXQgYW5pbWF0aW9uVGFpbExlbmd0aDtcblxudmFyeWluZyB2ZWM0IHZDb2xvcjtcbnZhcnlpbmcgZmxvYXQgc291cmNlVG9UYXJnZXQ7XG52YXJ5aW5nIHZlYzIgdXY7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxudm9pZCBtYWluKHZvaWQpIHtcbiAgZ2VvbWV0cnkudXYgPSB1djtcblxuICBnbF9GcmFnQ29sb3IgPSB2ZWM0KHZDb2xvci54eXosIHZDb2xvci53ICogc21vb3Roc3RlcCgxLjAgLSBhbmltYXRpb25UYWlsTGVuZ3RoLCAxLjAsIGZyYWN0KHNvdXJjZVRvVGFyZ2V0KSkpO1xuXG4gIERFQ0tHTF9GSUxURVJfQ09MT1IoZ2xfRnJhZ0NvbG9yLCBnZW9tZXRyeSk7XG59XG5gO1xuIl19
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default: "#define SHADER_NAME animated-flow-lines-layer-vertex-shader\n#define SPEED 0.015\n#define NUM_PARTS 5.0\n\nattribute vec3 positions;\nattribute vec3 instanceSourcePositions;\nattribute vec3 instanceTargetPositions;\nattribute vec3 instanceSourcePositions64Low;\nattribute vec3 instanceTargetPositions64Low;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute float instanceWidths;\nattribute float instancePickable;\nattribute float instanceStaggering;\n\nuniform float opacity;\nuniform float currentTime;\nuniform float thicknessUnit;\n \nvarying vec4 vColor;\nvarying float sourceToTarget;\nvarying vec2 uv;\n\n// offset vector by strokeWidth pixels\n// offset_direction is -1 (left) or 1 (right)\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n return dir_screenspace * offset_direction * width / 2.0;\n}\n\nvoid main(void) {\n geometry.worldPosition = instanceSourcePositions;\n geometry.worldPositionAlt = instanceTargetPositions;\n\n // Position\n vec4 source_commonspace;\n vec4 target_commonspace;\n vec4 source = project_position_to_clipspace(instanceSourcePositions, instanceSourcePositions64Low, vec3(0.), source_commonspace);\n vec4 target = project_position_to_clipspace(instanceTargetPositions, instanceTargetPositions64Low, vec3(0.), target_commonspace);\n\n float widthPixels = instanceWidths * thicknessUnit;\n \n \n // linear interpolation of source & target to pick right coord\n float segmentIndex = positions.x;\n vec4 p = mix(source, target, segmentIndex);\n geometry.position = mix(source_commonspace, target_commonspace, segmentIndex);\n uv = positions.xy;\n geometry.uv = uv;\n if (instancePickable > 0.5) {\n geometry.pickingColor = instancePickingColors;\n }\n \n // extrude\n vec3 offset = vec3(\n getExtrusionOffset(target.xy - source.xy, positions.y, widthPixels),\n 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position = p + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n // Color\n vColor = vec4(instanceColors.rgb, instanceColors.a * opacity) / 255.;\n DECKGL_FILTER_COLOR(vColor, geometry);\n\n sourceToTarget = positions.x * length(source - target) * NUM_PARTS - currentTime * SPEED + instanceStaggering; \n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=AnimatedFlowLinesLayerVertex.glsl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimatedFlowLinesLayerVertex.glsl.d.ts","sourceRoot":"","sources":["../../src/AnimatedFlowLinesLayer/AnimatedFlowLinesLayerVertex.glsl.ts"],"names":[],"mappings":";AAiBA,wBAwEE"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 FlowmapBlue
|
|
3
|
+
* Copyright 2018-2020 Teralytics, modified by FlowmapBlue
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export default `\
|
|
19
|
+
#define SHADER_NAME animated-flow-lines-layer-vertex-shader
|
|
20
|
+
#define SPEED 0.015
|
|
21
|
+
#define NUM_PARTS 5.0
|
|
22
|
+
|
|
23
|
+
attribute vec3 positions;
|
|
24
|
+
attribute vec3 instanceSourcePositions;
|
|
25
|
+
attribute vec3 instanceTargetPositions;
|
|
26
|
+
attribute vec3 instanceSourcePositions64Low;
|
|
27
|
+
attribute vec3 instanceTargetPositions64Low;
|
|
28
|
+
attribute vec4 instanceColors;
|
|
29
|
+
attribute vec3 instancePickingColors;
|
|
30
|
+
attribute float instanceWidths;
|
|
31
|
+
attribute float instancePickable;
|
|
32
|
+
attribute float instanceStaggering;
|
|
33
|
+
|
|
34
|
+
uniform float opacity;
|
|
35
|
+
uniform float currentTime;
|
|
36
|
+
uniform float thicknessUnit;
|
|
37
|
+
|
|
38
|
+
varying vec4 vColor;
|
|
39
|
+
varying float sourceToTarget;
|
|
40
|
+
varying vec2 uv;
|
|
41
|
+
|
|
42
|
+
// offset vector by strokeWidth pixels
|
|
43
|
+
// offset_direction is -1 (left) or 1 (right)
|
|
44
|
+
vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {
|
|
45
|
+
// normalized direction of the line
|
|
46
|
+
vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);
|
|
47
|
+
// rotate by 90 degrees
|
|
48
|
+
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
|
|
49
|
+
|
|
50
|
+
return dir_screenspace * offset_direction * width / 2.0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
void main(void) {
|
|
54
|
+
geometry.worldPosition = instanceSourcePositions;
|
|
55
|
+
geometry.worldPositionAlt = instanceTargetPositions;
|
|
56
|
+
|
|
57
|
+
// Position
|
|
58
|
+
vec4 source_commonspace;
|
|
59
|
+
vec4 target_commonspace;
|
|
60
|
+
vec4 source = project_position_to_clipspace(instanceSourcePositions, instanceSourcePositions64Low, vec3(0.), source_commonspace);
|
|
61
|
+
vec4 target = project_position_to_clipspace(instanceTargetPositions, instanceTargetPositions64Low, vec3(0.), target_commonspace);
|
|
62
|
+
|
|
63
|
+
float widthPixels = instanceWidths * thicknessUnit;
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
// linear interpolation of source & target to pick right coord
|
|
67
|
+
float segmentIndex = positions.x;
|
|
68
|
+
vec4 p = mix(source, target, segmentIndex);
|
|
69
|
+
geometry.position = mix(source_commonspace, target_commonspace, segmentIndex);
|
|
70
|
+
uv = positions.xy;
|
|
71
|
+
geometry.uv = uv;
|
|
72
|
+
if (instancePickable > 0.5) {
|
|
73
|
+
geometry.pickingColor = instancePickingColors;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// extrude
|
|
77
|
+
vec3 offset = vec3(
|
|
78
|
+
getExtrusionOffset(target.xy - source.xy, positions.y, widthPixels),
|
|
79
|
+
0.0);
|
|
80
|
+
DECKGL_FILTER_SIZE(offset, geometry);
|
|
81
|
+
gl_Position = p + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);
|
|
82
|
+
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
83
|
+
|
|
84
|
+
// Color
|
|
85
|
+
vColor = vec4(instanceColors.rgb, instanceColors.a * opacity) / 255.;
|
|
86
|
+
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
87
|
+
|
|
88
|
+
sourceToTarget = positions.x * length(source - target) * NUM_PARTS - currentTime * SPEED + instanceStaggering;
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
91
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQW5pbWF0ZWRGbG93TGluZXNMYXllclZlcnRleC5nbHNsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL0FuaW1hdGVkRmxvd0xpbmVzTGF5ZXIvQW5pbWF0ZWRGbG93TGluZXNMYXllclZlcnRleC5nbHNsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7O0dBZ0JHO0FBQ0gsZUFBZTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0NBd0VkLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuICogQ29weXJpZ2h0IDIwMjIgRmxvd21hcEJsdWVcbiAqIENvcHlyaWdodCAyMDE4LTIwMjAgVGVyYWx5dGljcywgbW9kaWZpZWQgYnkgRmxvd21hcEJsdWVcbiAqXG4gKiBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wICh0aGUgXCJMaWNlbnNlXCIpO1xuICogeW91IG1heSBub3QgdXNlIHRoaXMgZmlsZSBleGNlcHQgaW4gY29tcGx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xuICBpZiAoaW5zdGFuY2VQaWNrYWJsZSA+IDAuNSkge1xuICAgIGdlb21ldHJ5LnBpY2tpbmdDb2xvciA9IGluc3RhbmNlUGlja2luZ0NvbG9ycztcbiAgfVxuICBcbiAgLy8gZXh0cnVkZVxuICB2ZWMzIG9mZnNldCA9IHZlYzMoXG4gICAgZ2V0RXh0cnVzaW9uT2Zmc2V0KHRhcmdldC54eSAtIHNvdXJjZS54eSwgcG9zaXRpb25zLnksIHdpZHRoUGl4ZWxzKSxcbiAgICAwLjApO1xuICBERUNLR0xfRklMVEVSX1NJWkUob2Zmc2V0LCBnZW9tZXRyeSk7XG4gIGdsX1Bvc2l0aW9uID0gcCArIHZlYzQocHJvamVjdF9waXhlbF9zaXplX3RvX2NsaXBzcGFjZShvZmZzZXQueHkpLCAwLjAsIDAuMCk7XG4gIERFQ0tHTF9GSUxURVJfR0xfUE9TSVRJT04oZ2xfUG9zaXRpb24sIGdlb21ldHJ5KTtcblxuICAvLyBDb2xvclxuICB2Q29sb3IgPSB2ZWM0KGluc3RhbmNlQ29sb3JzLnJnYiwgaW5zdGFuY2VDb2xvcnMuYSAqIG9wYWNpdHkpIC8gMjU1LjtcbiAgREVDS0dMX0ZJTFRFUl9DT0xPUih2Q29sb3IsIGdlb21ldHJ5KTtcblxuICBzb3VyY2VUb1RhcmdldCA9IHBvc2l0aW9ucy54ICogbGVuZ3RoKHNvdXJjZSAtIHRhcmdldCkgKiBOVU1fUEFSVFMgLSBjdXJyZW50VGltZSAqIFNQRUVEICsgaW5zdGFuY2VTdGFnZ2VyaW5nOyBcbn1cbmA7XG4iXX0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/AnimatedFlowLinesLayer/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAE9D,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import AnimatedFlowLinesLayer from './AnimatedFlowLinesLayer';
|
|
2
|
+
export default AnimatedFlowLinesLayer;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvQW5pbWF0ZWRGbG93TGluZXNMYXllci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLHNCQUFzQixNQUFNLDBCQUEwQixDQUFDO0FBRTlELGVBQWUsc0JBQXNCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgQW5pbWF0ZWRGbG93TGluZXNMYXllciBmcm9tICcuL0FuaW1hdGVkRmxvd0xpbmVzTGF5ZXInO1xuXG5leHBvcnQgZGVmYXVsdCBBbmltYXRlZEZsb3dMaW5lc0xheWVyO1xuIl19
|