anim-3d-obj 1.1.73 → 1.1.224

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.
Files changed (39) hide show
  1. package/README.md +51 -74
  2. package/ang1.png +0 -0
  3. package/ang2.png +0 -0
  4. package/ang3.png +0 -0
  5. package/angl1.png +0 -0
  6. package/babel.config.json +18 -0
  7. package/jestconfig.json +8 -0
  8. package/package.json +62 -56
  9. package/public/favicon.ico +0 -0
  10. package/public/index.html +43 -0
  11. package/public/logo192.png +0 -0
  12. package/public/logo512.png +0 -0
  13. package/public/manifest.json +25 -0
  14. package/public/robots.txt +3 -0
  15. package/src/components/Face.tsx +95 -0
  16. package/src/components/Obj.tsx +52 -0
  17. package/src/components/index.ts +4 -0
  18. package/src/components/styles/Anim.d.ts +17 -0
  19. package/src/components/styles/AnimWrap.tsx +90 -0
  20. package/{dist/esm/components/styles/Anims.js → src/components/styles/Anims.ts} +82 -60
  21. package/src/components/styles/Global.tsx +28 -0
  22. package/src/components/styles/Scene.tsx +37 -0
  23. package/src/components/types.d.ts +42 -0
  24. package/tsconfig.json +20 -0
  25. package/dist/esm/components/Face.d.ts +0 -11
  26. package/dist/esm/components/Face.js +0 -108
  27. package/dist/esm/components/Obj.d.ts +0 -2
  28. package/dist/esm/components/Obj.js +0 -25
  29. package/dist/esm/components/index.d.ts +0 -2
  30. package/dist/esm/components/index.js +0 -2
  31. package/dist/esm/components/styles/AnimWrap.d.ts +0 -2
  32. package/dist/esm/components/styles/AnimWrap.js +0 -81
  33. package/dist/esm/components/styles/Anims.d.ts +0 -32
  34. package/dist/esm/components/styles/Global.d.ts +0 -6
  35. package/dist/esm/components/styles/Global.js +0 -20
  36. package/dist/esm/components/styles/Scene.d.ts +0 -10
  37. package/dist/esm/components/styles/Scene.js +0 -15
  38. package/dist/esm/index.js +0 -1
  39. /package/{dist/esm/index.d.ts → src/index.ts} +0 -0
@@ -1,7 +1,14 @@
1
1
  import { keyframes } from "styled-components";
2
- export const allAnims = (props) => {
3
- const { degreesLow = 0, degreesHi = 0 } = props;
4
- const swing = keyframes `
2
+
3
+ interface AllAnimsProps {
4
+ degreesLow?: number;
5
+ degreesHi?: number;
6
+ }
7
+
8
+ export const allAnims = (props: AllAnimsProps) => {
9
+ const { degreesLow = 0, degreesHi = 0 } = props;
10
+
11
+ const swing = keyframes`
5
12
  0% {
6
13
  -webkit-transform-origin: top;
7
14
  -ms-transform-origin: top;
@@ -21,7 +28,8 @@ export const allAnims = (props) => {
21
28
  transform: perspective(550px) rotateX(77deg);
22
29
  }
23
30
  `;
24
- const swingDecay = keyframes `
31
+
32
+ const swingDecay = keyframes`
25
33
  0% {
26
34
  -webkit-transform-origin: top;
27
35
  -ms-transform-origin: top;
@@ -55,7 +63,8 @@ export const allAnims = (props) => {
55
63
  transform: perspective(550px) rotateX(0);
56
64
  }
57
65
  `;
58
- const X360 = keyframes `
66
+
67
+ const X360 = keyframes`
59
68
  from {
60
69
  -webkit-transform: rotateX(360deg);
61
70
  transform: rotateX(360deg);
@@ -64,8 +73,9 @@ export const allAnims = (props) => {
64
73
  -webkit-transform: rotateX(0deg);
65
74
  transform: rotateX(0deg);
66
75
  }`;
67
- //////// Y360
68
- const Y360 = keyframes `
76
+
77
+ //////// Y360
78
+ const Y360 = keyframes`
69
79
  from {
70
80
  -webkit-transform: rotateY(360deg);
71
81
  transform: rotateY(360deg);
@@ -74,14 +84,16 @@ export const allAnims = (props) => {
74
84
  -webkit-transform: rotateY(0deg);
75
85
  transform: rotateY(0deg);
76
86
  }`;
77
- const fadeInkf = keyframes `
87
+
88
+ const fadeInkf = keyframes`
78
89
  from {
79
90
  opacity: 0;
80
91
  }
81
92
  to {
82
93
  opacity: 1;
83
94
  }`;
84
- const wobY = keyframes `
95
+
96
+ const wobY = keyframes`
85
97
  0% {
86
98
  -webkit-transform: rotateY(${degreesLow}deg);
87
99
  transform: rotateY(${degreesLow}deg);
@@ -94,7 +106,8 @@ export const allAnims = (props) => {
94
106
  -webkit-transform: rotateY(${degreesLow}deg);
95
107
  transform: rotateY(${degreesLow}deg);
96
108
  }`;
97
- const wobX = keyframes `
109
+
110
+ const wobX = keyframes`
98
111
  0% {
99
112
  -webkit-transform: rotateX(${degreesLow}deg);
100
113
  transform: rotateX(${degreesLow}deg);
@@ -107,8 +120,8 @@ export const allAnims = (props) => {
107
120
  -webkit-transform: rotateX(${degreesLow}deg);
108
121
  transform: rotateX(${degreesLow}deg);
109
122
  }`;
110
- /* ============================== x-axis 0-180 >180 - 360 */
111
- const fwdx018 = keyframes `
123
+ /* ============================== x-axis 0-180 >180 - 360 */
124
+ const fwdx018 = keyframes`
112
125
  from {
113
126
  -webkit-transform: rotateX(360deg);
114
127
  transform: rotateX(360deg);
@@ -117,7 +130,7 @@ export const allAnims = (props) => {
117
130
  -webkit-transform: rotateX(180deg);
118
131
  transform: rotateX(180deg);
119
132
  }`;
120
- const fwdx1836 = keyframes `
133
+ const fwdx1836 = keyframes`
121
134
  from {
122
135
  -webkit-transform: rotateX(180deg);
123
136
  transform: rotateX(180deg);
@@ -126,8 +139,8 @@ export const allAnims = (props) => {
126
139
  -webkit-transform: rotateX(0deg);
127
140
  transform: rotateX(0deg);
128
141
  }`;
129
- /* ============================= x-axis 0-90, 90-180, 180-270, 270-360 */
130
- const fwdx09 = keyframes `
142
+ /* ============================= x-axis 0-90, 90-180, 180-270, 270-360 */
143
+ const fwdx09 = keyframes`
131
144
  from {
132
145
  -webkit-transform: rotateX(0deg);
133
146
  transform: rotateX(0deg);
@@ -136,7 +149,7 @@ export const allAnims = (props) => {
136
149
  -webkit-transform: rotateX(90deg);
137
150
  transform: rotateX(90deg);
138
151
  }`;
139
- const fwdx918 = keyframes `
152
+ const fwdx918 = keyframes`
140
153
  from {
141
154
  -webkit-transform: rotateX(90deg);
142
155
  transform: rotateX(90deg);
@@ -145,7 +158,7 @@ export const allAnims = (props) => {
145
158
  -webkit-transform: rotateX(180deg);
146
159
  transform: rotateX(180deg);
147
160
  }`;
148
- const fwdx1827 = keyframes `
161
+ const fwdx1827 = keyframes`
149
162
  from {
150
163
  -webkit-transform: rotateX(180deg);
151
164
  transform: rotateX(180deg);
@@ -154,7 +167,7 @@ export const allAnims = (props) => {
154
167
  -webkit-transform: rotateX(270deg);
155
168
  transform: rotateX(270deg);
156
169
  }`;
157
- const fwdx2736 = keyframes `
170
+ const fwdx2736 = keyframes`
158
171
  from {
159
172
  -webkit-transform: rotateX(270deg);
160
173
  transform: rotateX(270deg);
@@ -163,8 +176,9 @@ export const allAnims = (props) => {
163
176
  -webkit-transform: rotateX(360deg);
164
177
  transform: rotateX(360deg);
165
178
  }`;
166
- /* ============================== y-axis 0-180 >180 - 360 */
167
- const fwdy018 = keyframes `
179
+
180
+ /* ============================== y-axis 0-180 >180 - 360 */
181
+ const fwdy018 = keyframes`
168
182
  from {
169
183
  -webkit-transform: rotateY(0deg);
170
184
  transform: rotateY(0deg);
@@ -173,7 +187,7 @@ export const allAnims = (props) => {
173
187
  -webkit-transform: rotateY(180deg);
174
188
  transform: rotateY(180deg);
175
189
  }`;
176
- const fwdy1836 = keyframes `
190
+ const fwdy1836 = keyframes`
177
191
  from {
178
192
  -webkit-transform: rotateY(180deg);
179
193
  transform: rotateY(180deg);
@@ -182,8 +196,9 @@ export const allAnims = (props) => {
182
196
  -webkit-transform: rotateY(0deg);
183
197
  transform: rotateY(0deg);
184
198
  }`;
185
- /* ============================= y-axis 0-90, 90-180, 180-270, 270-360 */
186
- const fwdy09 = keyframes `
199
+
200
+ /* ============================= y-axis 0-90, 90-180, 180-270, 270-360 */
201
+ const fwdy09 = keyframes`
187
202
  from {
188
203
  -webkit-transform: rotateY(0deg);
189
204
  transform: rotateY(0deg);
@@ -192,7 +207,7 @@ export const allAnims = (props) => {
192
207
  -webkit-transform: rotateY(90deg);
193
208
  transform: rotateY(90deg);
194
209
  }`;
195
- const fwdy918 = keyframes `
210
+ const fwdy918 = keyframes`
196
211
  from {
197
212
  -webkit-transform: rotateY(90deg);
198
213
  transform: rotateY(90deg);
@@ -201,7 +216,7 @@ export const allAnims = (props) => {
201
216
  -webkit-transform: rotateY(180deg);
202
217
  transform: rotateY(180deg);
203
218
  }`;
204
- const fwdy1827 = keyframes `
219
+ const fwdy1827 = keyframes`
205
220
  from {
206
221
  -webkit-transform: rotateY(180deg);
207
222
  transform: rotateY(180deg);
@@ -210,7 +225,7 @@ export const allAnims = (props) => {
210
225
  -webkit-transform: rotateY(270deg);
211
226
  transform: rotateY(270deg);
212
227
  }`;
213
- const fwdy2736 = keyframes `
228
+ const fwdy2736 = keyframes`
214
229
  from {
215
230
  -webkit-transform: rotateY(270deg);
216
231
  transform: rotateY(270deg);
@@ -219,12 +234,14 @@ export const allAnims = (props) => {
219
234
  -webkit-transform: rotateY(360deg);
220
235
  transform: rotateY(360deg);
221
236
  }`;
222
- /* ============================= floating */
223
- const floatX = keyframes `
237
+
238
+ /* ============================= floating */
239
+ const floatX = keyframes`
224
240
  0% { -webkit-transform: translate(0, 0px); -ms-transform: translate(0, 0px); transform: translate(0, 0px); }
225
241
  50% { -webkit-transform: translate(0, 15px); -ms-transform: translate(0, 15px); transform: translate(0, 15px); }
226
242
  100% { -webkit-transform: translate(0, -0px); -ms-transform: translate(0, -0px); transform: translate(0, -0px); }`;
227
- const floatShadow = keyframes `
243
+
244
+ const floatShadow = keyframes`
228
245
  0% {
229
246
  -webkit-box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
230
247
  box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
@@ -246,7 +263,8 @@ export const allAnims = (props) => {
246
263
  -ms-transform: translateY(0px);
247
264
  transform: translateY(0px);
248
265
  }`;
249
- const pulseSM = keyframes `
266
+
267
+ const pulseSM = keyframes`
250
268
  0% {
251
269
  -webkit-transform: scale(0.9);
252
270
  -ms-transform: scale(0.9);
@@ -262,7 +280,8 @@ export const allAnims = (props) => {
262
280
  -ms-transform: scale(0.9);
263
281
  transform: scale(0.9);
264
282
  }`;
265
- const pulseMD = keyframes `
283
+
284
+ const pulseMD = keyframes`
266
285
  0% {
267
286
  -webkit-transform: scale(0.7);
268
287
  -ms-transform: scale(0.7);
@@ -278,7 +297,8 @@ export const allAnims = (props) => {
278
297
  -ms-transform: scale(0.7);
279
298
  transform: scale(0.7);
280
299
  }`;
281
- const pulseLG = keyframes `
300
+
301
+ const pulseLG = keyframes`
282
302
  0% {
283
303
  -webkit-transform: scale(0.5);
284
304
  -ms-transform: scale(0.5);
@@ -294,32 +314,34 @@ export const allAnims = (props) => {
294
314
  -ms-transform: scale(0.5);
295
315
  transform: scale(0.5);
296
316
  }`;
297
- const noAnim = keyframes ``;
298
- return {
299
- X360,
300
- Y360,
301
- fadeInkf,
302
- wobY,
303
- wobX,
304
- fwdx018,
305
- fwdx1836,
306
- fwdx09,
307
- fwdx918,
308
- fwdx1827,
309
- fwdx2736,
310
- fwdy018,
311
- fwdy1836,
312
- fwdy09,
313
- fwdy918,
314
- fwdy1827,
315
- fwdy2736,
316
- floatX,
317
- floatShadow,
318
- pulseSM,
319
- pulseMD,
320
- pulseLG,
321
- swing,
322
- swingDecay,
323
- noAnim,
324
- };
317
+
318
+ const noAnim = keyframes``;
319
+
320
+ return {
321
+ X360,
322
+ Y360,
323
+ fadeInkf,
324
+ wobY,
325
+ wobX,
326
+ fwdx018,
327
+ fwdx1836,
328
+ fwdx09,
329
+ fwdx918,
330
+ fwdx1827,
331
+ fwdx2736,
332
+ fwdy018,
333
+ fwdy1836,
334
+ fwdy09,
335
+ fwdy918,
336
+ fwdy1827,
337
+ fwdy2736,
338
+ floatX,
339
+ floatShadow,
340
+ pulseSM,
341
+ pulseMD,
342
+ pulseLG,
343
+ swing,
344
+ swingDecay,
345
+ noAnim,
346
+ };
325
347
  };
@@ -0,0 +1,28 @@
1
+ import styled from "styled-components";
2
+ import React from "react";
3
+
4
+ interface ObjWrapperProps {
5
+ showCenterDiv?: boolean | string | number;
6
+ children?: any;
7
+ }
8
+
9
+ export const ObjWrapper = (props: ObjWrapperProps): any => {
10
+ const { showCenterDiv = false, children = "" } = props;
11
+
12
+ const Wrapper: any = showCenterDiv
13
+ ? styled.section`
14
+ width: 100%;
15
+ height: 100%;
16
+ position: relative;
17
+ transform-style: preserve-3d;
18
+ border: 1px solid #0f0;
19
+ `
20
+ : styled.section`
21
+ width: 100%;
22
+ height: 100%;
23
+ position: relative;
24
+ transform-style: preserve-3d;
25
+ `;
26
+
27
+ return <Wrapper>{children}</Wrapper>;
28
+ };
@@ -0,0 +1,37 @@
1
+ import styled from "styled-components";
2
+ import React from "react";
3
+
4
+ interface SceneStyleProps {
5
+ width?: number | string;
6
+ height?: number | string;
7
+ perspective?: number | string | undefined;
8
+ perspectiveOrigin?: string | undefined;
9
+ zIndex?: number | undefined;
10
+ children: any;
11
+ }
12
+
13
+ export const SceneStyle = (props: SceneStyleProps) => {
14
+ const {
15
+ width = 0,
16
+ height = 0,
17
+ perspective = 600,
18
+ perspectiveOrigin = "50% 50%",
19
+ zIndex = 10,
20
+ children = {},
21
+ } = props;
22
+
23
+ const SceneStyleDiv: any = styled.div`
24
+ width: ${width}px;
25
+ height: ${height}px;
26
+ -webkit-perspective: ${perspective}px;
27
+ perspective: ${perspective}px;
28
+ -webkit-perspective-origin: ${perspectiveOrigin};
29
+ perspective-origin: ${perspectiveOrigin};
30
+ `;
31
+
32
+ return (
33
+ <div style={{ zIndex }}>
34
+ <SceneStyleDiv>{children}</SceneStyleDiv>
35
+ </div>
36
+ );
37
+ };
@@ -0,0 +1,42 @@
1
+ export interface FaceType {
2
+ name?: string;
3
+ css?: string | undefined;
4
+ body?: any;
5
+ }
6
+
7
+ export interface ObjProps {
8
+ anim1?: object | undefined;
9
+ anim2?: object | undefined;
10
+ children?: any;
11
+ depth?: number;
12
+ global?: { border?: string; bgc?: string; opac?: number | string } | any;
13
+ height?: number | string;
14
+ faces?: FaceType[];
15
+ perspective?: string | number | undefined;
16
+ perspectiveOrigin?: string | undefined;
17
+ showCenterDiv?: string | number | boolean | undefined;
18
+ tranz?: number | undefined;
19
+ txt?: string | any;
20
+ width?: number;
21
+ zIndex?: number | undefined;
22
+ }
23
+
24
+ export interface GlobalType {
25
+ css?: string;
26
+ body?: string;
27
+ }
28
+
29
+ export interface FaceProps {
30
+ children?: any;
31
+ depth?: number | any;
32
+ face: FaceType;
33
+ global?: any;
34
+ height?: number | string;
35
+ width?: number | string;
36
+ }
37
+
38
+ export interface SpecsProps {
39
+ width: number;
40
+ height: number;
41
+ transform: string;
42
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowSyntheticDefaultImports": true,
4
+ "declaration": true,
5
+ "esModuleInterop": true,
6
+ "jsx": "react",
7
+ "lib": ["es5", "es2015", "es2016", "dom", "esnext"],
8
+ "types": ["node"],
9
+ "module": "es2015",
10
+ "moduleResolution": "node",
11
+ "noImplicitAny": true,
12
+ "outDir": "dist/esm",
13
+ "sourceMap": false,
14
+ "strict": true,
15
+ "target": "es6",
16
+ "noUnusedLocals": false,
17
+ "noUnusedParameters": false
18
+ },
19
+ "include": ["src/**/*.ts", "src/**/*.tsx"]
20
+ }
@@ -1,11 +0,0 @@
1
- import { FaceType } from "./types";
2
- interface FaceProps {
3
- children?: any;
4
- depth?: number | any;
5
- face: FaceType;
6
- global?: any;
7
- height?: number | string;
8
- width?: number | string;
9
- }
10
- export default function Face(props: FaceProps): JSX.Element;
11
- export {};
@@ -1,108 +0,0 @@
1
- import styled from "styled-components";
2
- export default function Face(props) {
3
- let { depth = 10, global = { css: "", body: "" }, height = 10, face, width = 100, } = props;
4
- console.log(face);
5
- let transform;
6
- let tranz = +height / 2;
7
- const body = face.body ? face.body : global.body;
8
- console.log("====props====" + face.name);
9
- console.log(props);
10
- ////////////////////////////////////////////////////////////////////////////// BOTTOM
11
- if (face.name === "bottom") {
12
- tranz = +height - +depth / 2;
13
- height = +depth;
14
- transform = `transform: rotateX(-90deg) translateZ(${tranz}px);`;
15
- }
16
- else if (face.name === "bottom_rear") {
17
- tranz = +height - +depth / 2;
18
- height = +depth;
19
- transform = `transform: rotateX(-90deg) translateZ(${tranz}px) translateY(${height}px) `;
20
- }
21
- else if (face.name === "bottom_front") {
22
- tranz = +height - +depth / 2;
23
- height = +depth;
24
- transform = `transform: rotateX(-90deg) translateZ(${tranz}px) translateY(${-height}px) `;
25
- ////////////////////////////////////////////////////////////////////////////// TOPS
26
- }
27
- else if (face.name === "top") {
28
- height = +depth;
29
- if (!!depth)
30
- tranz = +depth / 2;
31
- transform = `transform: rotateX(90deg) translateZ(${tranz}px);`;
32
- }
33
- else if (face.name === "top_rear") {
34
- height = +depth;
35
- if (!!depth)
36
- tranz = +depth / 2;
37
- let offset = depth / 2;
38
- //translate3d(tx, ty, tz)
39
- transform = `transform: rotateX(90deg) translateZ(${tranz}px) translateY(-${tranz * 2}px) `;
40
- }
41
- else if (face.name === "top_front") {
42
- height = +depth;
43
- if (!!depth)
44
- tranz = +depth / 2;
45
- let offset = depth / 2;
46
- //translate3d(tx, ty, tz)
47
- transform = `transform: rotateX(90deg) translateZ(${tranz}px) translateY(${tranz * 2}px) `;
48
- }
49
- else if (face.name === "front") {
50
- if (!!depth)
51
- tranz = +depth / 2;
52
- transform = `transform: rotateY(0deg) translateZ(${tranz}px);`;
53
- }
54
- else if (face.name === "back") {
55
- if (!!depth)
56
- tranz = +depth / 2;
57
- transform = `transform: rotateY(180deg) translateZ(${tranz}px);`;
58
- }
59
- else if (face.name === "right") {
60
- if (height > width && !depth) {
61
- tranz = -(+height / 2 - +width);
62
- width = +height;
63
- }
64
- else if (width > height && !depth) {
65
- tranz = +height / 2;
66
- height = +width;
67
- }
68
- else {
69
- tranz = +width - +depth / 2;
70
- width = +depth;
71
- }
72
- transform = `transform: rotateY(90deg) translateZ(${tranz}px);`;
73
- // topr is to of Ribbon which points back
74
- }
75
- else if (face.name === "left") {
76
- if (height > width && !depth) {
77
- tranz = -(+height / 2 - +width);
78
- width = +height;
79
- }
80
- else if (width > height && !depth) {
81
- tranz = +height / 2;
82
- height = +width;
83
- }
84
- else {
85
- tranz = +depth / 2;
86
- width = +depth;
87
- }
88
- transform = `transform: rotateY(-90deg) translateZ(${tranz}px);`;
89
- }
90
- else {
91
- console.log(face.name + " is not a recognized face.name");
92
- }
93
- console.log(".....css");
94
- console.log(`${face.css || global.css}
95
- width: ${width}px;
96
- position: absolute;
97
- height: ${height}px;
98
- ${transform}
99
- `);
100
- const Specs = styled.section `
101
- ${face.css || global.css}
102
- width: ${width}px;
103
- position: absolute;
104
- height: ${height}px;
105
- ${transform}
106
- `;
107
- return React.createElement(Specs, null, body);
108
- }
@@ -1,2 +0,0 @@
1
- import { ObjProps } from "./types";
2
- export default function (props: ObjProps): JSX.Element;
@@ -1,25 +0,0 @@
1
- import React from "react";
2
- import { ObjWrapper } from "./styles/Global";
3
- import { AnimWrap } from "./styles/AnimWrap";
4
- import { SceneStyle } from "./styles/Scene";
5
- import Face from "./Face";
6
- export default function (props) {
7
- let { anim1, anim2, width = 5, height = 5, depth = 5, global = {}, faces, perspective, perspectiveOrigin, zIndex, } = props;
8
- // process config
9
- const buildFace = (face) => {
10
- const details = {
11
- width,
12
- height,
13
- depth,
14
- face,
15
- global,
16
- };
17
- return React.createElement(Face, Object.assign({}, details, { key: face.name }));
18
- };
19
- return (React.createElement(SceneStyle, { width: width, height: height, perspective: perspective, perspectiveOrigin: perspectiveOrigin, zIndex: zIndex },
20
- React.createElement(AnimWrap, { animSpecs: anim1 },
21
- React.createElement(AnimWrap, { animSpecs: anim2 },
22
- React.createElement(ObjWrapper, null, faces && faces[0]
23
- ? faces.map((face) => (face.name ? buildFace(face) : null))
24
- : null)))));
25
- }
@@ -1,2 +0,0 @@
1
- export * from "./Obj";
2
- export * from "./Face";
@@ -1,2 +0,0 @@
1
- export * from "./Obj";
2
- export * from "./Face";
@@ -1,2 +0,0 @@
1
- import { AnimStylesProps } from "./Anim";
2
- export declare const AnimWrap: (props: AnimStylesProps) => JSX.Element;
@@ -1,81 +0,0 @@
1
- import styled from "styled-components";
2
- import React from "react";
3
- import { allAnims } from "./Anims";
4
- export const AnimWrap = (props) => {
5
- const { children, animSpecs } = props;
6
- const AS = animSpecs;
7
- const { X360, Y360, fadeInkf, wobY, wobX, fwdx018, fwdx1836, fwdx09, fwdx918, fwdx1827, fwdx2736, fwdy018, fwdy1836, fwdy09, fwdy918, fwdy1827, fwdy2736, floatX, floatShadow, pulseSM, pulseMD, pulseLG, swing, swingDecay, noAnim, } = allAnims({ degreesHi: AS.degreesHi, degreesLow: AS.degreesLow });
8
- let theAnim = "noAnim";
9
- if (AS.name === "X360")
10
- theAnim = X360;
11
- else if (AS.name === "Y360")
12
- theAnim = Y360;
13
- else if (AS.name === "fadeInkf")
14
- theAnim = fadeInkf;
15
- else if (AS.name === "wobX")
16
- theAnim = wobX;
17
- else if (AS.name === "wobY")
18
- theAnim = wobY;
19
- else if (AS.name === "fwdx018")
20
- theAnim = fwdx018;
21
- else if (AS.name === "fwdx1836")
22
- theAnim = fwdx1836;
23
- else if (AS.name === "fwdx09")
24
- theAnim = fwdx09;
25
- else if (AS.name === "fwdx918")
26
- theAnim = fwdx918;
27
- else if (AS.name === "fwdx1827")
28
- theAnim = fwdx1827;
29
- else if (AS.name === "fwdx2736")
30
- theAnim = fwdx2736;
31
- else if (AS.name === "fwdy018")
32
- theAnim = fwdy018;
33
- else if (AS.name === "fwdy1836")
34
- theAnim = fwdy1836;
35
- else if (AS.name === "fwdy09")
36
- theAnim = fwdy09;
37
- else if (AS.name === "fwdy918")
38
- theAnim = fwdy918;
39
- else if (AS.name === "fwdy1827")
40
- theAnim = fwdy1827;
41
- else if (AS.name === "fwdy2736")
42
- theAnim = fwdy2736;
43
- else if (AS.name === "floatX")
44
- theAnim = floatX;
45
- else if (AS.name === "floatShadow")
46
- theAnim = floatShadow;
47
- else if (AS.name === "pulseSM")
48
- theAnim = pulseSM;
49
- else if (AS.name === "pulseMD")
50
- theAnim = pulseMD;
51
- else if (AS.name === "pulseLG")
52
- theAnim = pulseLG;
53
- else if (AS.name === "swing")
54
- theAnim = swing;
55
- else if (AS.name === "swingDecay")
56
- theAnim = swingDecay;
57
- else
58
- theAnim = noAnim;
59
- const AnimWrapDiv = styled.div `
60
- width: 100%;
61
- height: 100%;
62
- position: relative;
63
- transform-style: preserve-3d;
64
- border: ${AS.border};
65
- -webkit-animation-duration: ${AS.duration}s;
66
- animation-duration: ${AS.duration}s;
67
- -webkit-animation-iteration-count: ${AS.iterationCount};
68
- animation-iteration-count: ${AS.iterationCount};
69
- -webkit-animation-name: ${theAnim};
70
- animation-name: ${theAnim};
71
- -webkit-animation-fill-mode: ${AS.fillMode};
72
- animation-fill-mode: ${AS.fillMode};
73
- animation-direction: ${AS.direction};
74
- -webkit-animation-direction: ${AS.direction};
75
- -webkit-animation-timing-function: ${AS.timing};
76
- animation-timing-function: ${AS.timing};
77
- -webkit-animation-delay: ${AS.delay}s;
78
- animation-delay: ${AS.delay}s;
79
- `;
80
- return React.createElement(AnimWrapDiv, null, children);
81
- };