anim-3d-obj 1.1.73 → 1.2.2

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/README.md CHANGED
@@ -12,25 +12,6 @@ The program does the leg work with regard to calculating translationZ depth and
12
12
  - [Parallel divs animated x and y axis in tandem](https://codesandbox.io/s/anim-3d-obj-2-sides-simple-4057y7)
13
13
  - [Obj Skeleton](https://codesandbox.io/s/anim-3d-obj-skeleton-5dlk70)
14
14
 
15
- ## Config
16
-
17
- Animations are optional. Either or both of `anim1` or `anim2` can be applied to the component.
18
-
19
- ```typescript
20
- const anim1 = {
21
- border: "", // while testing reveal the animation wrapper
22
- degreesHi: -45, // degrees if spin
23
- degreesLow: 45, // degrees if spin
24
- delay: 0, // start delay in seconds
25
- direction: "normal", //normal alternating reverse
26
- duration: 8, // seconds
27
- fillMode: "forwards", // none forwards backwards both
28
- iterationCount: "infinite", // number or infinte
29
- name: "Y360", // ** ANIMATIONS
30
- timing: "ease-in-out", // linear ease ease-in-out
31
- };
32
- ```
33
-
34
15
  `** ANIMATIONS`
35
16
 
36
17
  - `fadeInkf`: fade object in from 0 to 1 Opacity: [demo](https://codesandbox.io/s/anim-3d-obj-fadeinkf-1fozww)
@@ -43,7 +24,6 @@ const anim1 = {
43
24
  - `swingDecay`: Swing component with decay: [demo](https://codesandbox.io/s/anim-3d-obj-swingdecay-cku0e1)
44
25
  - `noAnim`: no animation place holder
45
26
 
46
-
47
27
  `X-AXIS Animations`
48
28
  - `X360`: rotate 360 degrees on the x-axis: [demo](https://codesandbox.io/s/anim-3d-obj-x360-7kiuhw)
49
29
  - `wobX`: wobble on x-axis (degreesHi <-> degreesLow): [demo](https://codesandbox.io/s/anim-3d-obj-wobx-ldwek7)
@@ -63,68 +43,65 @@ const anim1 = {
63
43
  - `fwdy918`: spin object on y-axis from 90 degrees to 180 degrees: [demo](https://codesandbox.io/s/anim-3d-obj-fwdy918-gnym88)
64
44
  - `fwdy1827`: spin object on y-axis from 180 degrees to 270 degrees: [demo](https://codesandbox.io/s/anim-3d-obj-fwdy1827-osskgx)
65
45
  - `fwdy2736`: spin object on y-axis from 270 degrees to 360 degrees: [demo](https://codesandbox.io/s/anim-3d-obj-fwdy2736-rnbs2q)
66
- -
67
46
 
68
47
 
69
- <>
48
+ ## Config
49
+ ### Animations:
70
50
 
71
- GLOBAL CONFIG
51
+ Animations are optional. Either or both of `anim1` or `anim2` can be applied to the component. Animations are applied to 2 wrapping divs respectively.
72
52
 
73
53
  ```typescript
74
- // EXAMPLE GLOBAL FACE CONFIG
75
- // This will be applied to all Faces that do not have their own custom config
76
- const global: object = {
77
- // // face individual styles (over rides global)
78
- css: `
79
- border: 1px solid #fff;
80
- background: rgb(2,0,36);
81
- background: linear-gradient(180deg, rgba(255,255,255,.1) 0%, rgba(141,191,249,.7) 100%);
82
- color:white;
83
- text-align:center;
84
- line-height:10;
85
- backface-visibility: visible;
86
- font-family: Arial, Helvetica, sans-serif;
87
- border-radius:5px;
88
- `,
89
- body: " ",
54
+ const anim1 = {
55
+ border: "", // while testing reveal the animation wrapper
56
+ degreesHi: -45, // degrees if spin
57
+ degreesLow: 45, // degrees if spin
58
+ delay: 0, // start delay in seconds
59
+ direction: "normal", //normal alternating reverse
60
+ duration: 8, // seconds
61
+ fillMode: "forwards", // none forwards backwards both
62
+ iterationCount: "infinite", // number or infinte
63
+ name: "Y360", // ** ANIMATIONS (above)
64
+ timing: "ease-in-out", // linear ease ease-in-out
90
65
  };
91
66
  ```
92
67
 
93
- <>
94
-
95
- CUSTOM CONFIG FOR INDIVIDUAL FACES
96
-
97
- ```typescript
98
- const custom: object = {
99
- // // face individual styles (over rides global)
100
- front: {
101
- css: ``,
102
- body: <Login />,
103
- },
104
- left: {
105
- css: `
106
- border: 1px solid #fff;
107
- background: rgb(2,0,36);
108
- color:white;
109
- text-align: center;
110
- line-height:8;`
111
- body: " ",
112
- },
113
- right: {
114
- css: ``,
115
- body: " ",
116
- },
117
- back: {
118
- css: ``,
119
- body: <Logout />,
68
+ ### Faces:
69
+ This is an array of objects containing the face used for a given component
70
+ ```javascript
71
+ export interface FaceType {
72
+ name?: string; // front,back,left,right,top,top_rear,top_front,bottom,bottom_rear,bottom_front
73
+ css?: string | undefined;
74
+ body?: any; // can be JSX Component | string | number
75
+ }
76
+
77
+ const faces: FaceType[] = [
78
+ {
79
+ name: "back",
80
+ body: "BACK",
81
+ css: `background:rgba(22,22,22,.5)`,
120
82
  },
121
- bottom: {
122
- css: `
123
- background-color:rgba(141,191,249,1);
124
- -webkit-box-shadow: 0px 0px 23px 18px #858585;
125
- box-shadow: 0px 0px 23px 18px #858585;
126
- `,
83
+ {
84
+ name: "right",
85
+ body: "RIGHT",
86
+ css: `background:rgba(220,220,220,.5);
87
+ border:1px solid #ddd`,
127
88
  },
89
+ ];
128
90
  ```
129
- ## NPM Location
91
+
92
+ ### Global (face):
93
+ If the name parameter in the faces array is indicated (ie: "front") but `css` and / or `body` are not. The `global default`(below) will satisfy those parameters.
94
+ ```javascript
95
+ interface GlobalType {
96
+ css?: string;
97
+ body?: string;
98
+ }
99
+ const global: GlobalType = {
100
+ body: "BODY FOR FACE WHICH DOES NOT CONTAIN BODY",
101
+ css: 'color:red'
102
+ };
103
+ ```
104
+
105
+ ![all sides](https://github.com/mdnelles/anim-3d-obj-npm-publisher/blob/4a9769a6386a3b5425ede9a04b346d5461051ae0/ang1.png?raw=true)
106
+
130
107
  - https://www.npmjs.com/package/anim-3d-obj
@@ -0,0 +1,11 @@
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 {};
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const styled_components_1 = __importDefault(require("styled-components"));
8
+ function Face(props) {
9
+ let { depth = 10, global = { css: "", body: "" }, height = 10, face, width = 100, } = props;
10
+ console.log(face);
11
+ let transform;
12
+ let tranz = +height / 2;
13
+ const body = face.body ? face.body : global.body;
14
+ ////////////////////////////////////////////////////////////////////////////// BOTTOM
15
+ if (face.name === "bottom") {
16
+ tranz = +height - +depth / 2;
17
+ height = +depth;
18
+ transform = `transform: rotateX(-90deg) translateZ(${tranz}px);`;
19
+ }
20
+ else if (face.name === "bottom_rear") {
21
+ tranz = +height - +depth / 2;
22
+ height = +depth;
23
+ transform = `transform: rotateX(-90deg) translateZ(${tranz}px) translateY(${height}px) `;
24
+ }
25
+ else if (face.name === "bottom_front") {
26
+ tranz = +height - +depth / 2;
27
+ height = +depth;
28
+ transform = `transform: rotateX(-90deg) translateZ(${tranz}px) translateY(${-height}px) `;
29
+ ////////////////////////////////////////////////////////////////////////////// TOPS
30
+ }
31
+ else if (face.name === "top") {
32
+ height = +depth;
33
+ if (!!depth)
34
+ tranz = +depth / 2;
35
+ transform = `transform: rotateX(90deg) translateZ(${tranz}px);`;
36
+ }
37
+ else if (face.name === "top_rear") {
38
+ height = +depth;
39
+ if (!!depth)
40
+ tranz = +depth / 2;
41
+ let offset = depth / 2;
42
+ //translate3d(tx, ty, tz)
43
+ transform = `transform: rotateX(90deg) translateZ(${tranz}px) translateY(-${tranz * 2}px) `;
44
+ }
45
+ else if (face.name === "top_front") {
46
+ height = +depth;
47
+ if (!!depth)
48
+ tranz = +depth / 2;
49
+ let offset = depth / 2;
50
+ //translate3d(tx, ty, tz)
51
+ transform = `transform: rotateX(90deg) translateZ(${tranz}px) translateY(${tranz * 2}px) `;
52
+ }
53
+ else if (face.name === "front") {
54
+ if (!!depth)
55
+ tranz = +depth / 2;
56
+ transform = `transform: rotateY(0deg) translateZ(${tranz}px);`;
57
+ }
58
+ else if (face.name === "back") {
59
+ if (!!depth)
60
+ tranz = +depth / 2;
61
+ transform = `transform: rotateY(180deg) translateZ(${tranz}px);`;
62
+ }
63
+ else if (face.name === "right") {
64
+ if (height > width && !depth) {
65
+ tranz = -(+height / 2 - +width);
66
+ width = +height;
67
+ }
68
+ else if (width > height && !depth) {
69
+ tranz = +height / 2;
70
+ height = +width;
71
+ }
72
+ else {
73
+ tranz = +width - +depth / 2;
74
+ width = +depth;
75
+ }
76
+ transform = `transform: rotateY(90deg) translateZ(${tranz}px);`;
77
+ // topr is to of Ribbon which points back
78
+ }
79
+ else if (face.name === "left") {
80
+ if (height > width && !depth) {
81
+ tranz = -(+height / 2 - +width);
82
+ width = +height;
83
+ }
84
+ else if (width > height && !depth) {
85
+ tranz = +height / 2;
86
+ height = +width;
87
+ }
88
+ else {
89
+ tranz = +depth / 2;
90
+ width = +depth;
91
+ }
92
+ transform = `transform: rotateY(-90deg) translateZ(${tranz}px);`;
93
+ }
94
+ else {
95
+ console.log(face.name + " is not a recognized face.name");
96
+ }
97
+ const Specs = styled_components_1.default.section `
98
+ ${face.css || global.css}
99
+ width: ${width}px;
100
+ position: absolute;
101
+ height: ${height}px;
102
+ ${transform}
103
+ `;
104
+ return react_1.default.createElement(Specs, null, body);
105
+ }
106
+ exports.default = Face;
@@ -0,0 +1,2 @@
1
+ import { ObjProps } from "./types";
2
+ export default function (props: ObjProps): JSX.Element;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const Global_1 = require("./styles/Global");
8
+ const AnimWrap_1 = require("./styles/AnimWrap");
9
+ const Scene_1 = require("./styles/Scene");
10
+ const Face_1 = __importDefault(require("./Face"));
11
+ function default_1(props) {
12
+ let { anim1, anim2, width = 5, height = 5, depth = 5, global = {}, faces, perspective, perspectiveOrigin, zIndex, } = props;
13
+ // process config
14
+ const buildFace = (face) => {
15
+ const details = {
16
+ width,
17
+ height,
18
+ depth,
19
+ face,
20
+ global,
21
+ };
22
+ return react_1.default.createElement(Face_1.default, Object.assign({}, details, { key: face.name }));
23
+ };
24
+ return (react_1.default.createElement(Scene_1.SceneStyle, { width: width, height: height, perspective: perspective, perspectiveOrigin: perspectiveOrigin, zIndex: zIndex },
25
+ react_1.default.createElement(AnimWrap_1.AnimWrap, { animSpecs: anim1 },
26
+ react_1.default.createElement(AnimWrap_1.AnimWrap, { animSpecs: anim2 },
27
+ react_1.default.createElement(Global_1.ObjWrapper, null, faces && faces[0]
28
+ ? faces.map((face) => (face.name ? buildFace(face) : null))
29
+ : null)))));
30
+ }
31
+ exports.default = default_1;
@@ -0,0 +1,2 @@
1
+ export * from "./Obj";
2
+ export * from "./Face";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Obj"), exports);
18
+ __exportStar(require("./Face"), exports);
@@ -0,0 +1,2 @@
1
+ import { AnimStylesProps } from "./Anim";
2
+ export declare const AnimWrap: (props: AnimStylesProps) => JSX.Element;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AnimWrap = void 0;
7
+ const styled_components_1 = __importDefault(require("styled-components"));
8
+ const react_1 = __importDefault(require("react"));
9
+ const Anims_1 = require("./Anims");
10
+ const AnimWrap = (props) => {
11
+ const { children, animSpecs } = props;
12
+ const AS = animSpecs;
13
+ 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, } = (0, Anims_1.allAnims)({ degreesHi: AS.degreesHi, degreesLow: AS.degreesLow });
14
+ let theAnim = "noAnim";
15
+ if (AS.name === "X360")
16
+ theAnim = X360;
17
+ else if (AS.name === "Y360")
18
+ theAnim = Y360;
19
+ else if (AS.name === "fadeInkf")
20
+ theAnim = fadeInkf;
21
+ else if (AS.name === "wobX")
22
+ theAnim = wobX;
23
+ else if (AS.name === "wobY")
24
+ theAnim = wobY;
25
+ else if (AS.name === "fwdx018")
26
+ theAnim = fwdx018;
27
+ else if (AS.name === "fwdx1836")
28
+ theAnim = fwdx1836;
29
+ else if (AS.name === "fwdx09")
30
+ theAnim = fwdx09;
31
+ else if (AS.name === "fwdx918")
32
+ theAnim = fwdx918;
33
+ else if (AS.name === "fwdx1827")
34
+ theAnim = fwdx1827;
35
+ else if (AS.name === "fwdx2736")
36
+ theAnim = fwdx2736;
37
+ else if (AS.name === "fwdy018")
38
+ theAnim = fwdy018;
39
+ else if (AS.name === "fwdy1836")
40
+ theAnim = fwdy1836;
41
+ else if (AS.name === "fwdy09")
42
+ theAnim = fwdy09;
43
+ else if (AS.name === "fwdy918")
44
+ theAnim = fwdy918;
45
+ else if (AS.name === "fwdy1827")
46
+ theAnim = fwdy1827;
47
+ else if (AS.name === "fwdy2736")
48
+ theAnim = fwdy2736;
49
+ else if (AS.name === "floatX")
50
+ theAnim = floatX;
51
+ else if (AS.name === "floatShadow")
52
+ theAnim = floatShadow;
53
+ else if (AS.name === "pulseSM")
54
+ theAnim = pulseSM;
55
+ else if (AS.name === "pulseMD")
56
+ theAnim = pulseMD;
57
+ else if (AS.name === "pulseLG")
58
+ theAnim = pulseLG;
59
+ else if (AS.name === "swing")
60
+ theAnim = swing;
61
+ else if (AS.name === "swingDecay")
62
+ theAnim = swingDecay;
63
+ else
64
+ theAnim = noAnim;
65
+ const AnimWrapDiv = styled_components_1.default.div `
66
+ width: 100%;
67
+ height: 100%;
68
+ position: relative;
69
+ transform-style: preserve-3d;
70
+ border: ${AS.border};
71
+ -webkit-animation-duration: ${AS.duration}s;
72
+ animation-duration: ${AS.duration}s;
73
+ -webkit-animation-iteration-count: ${AS.iterationCount};
74
+ animation-iteration-count: ${AS.iterationCount};
75
+ -webkit-animation-name: ${theAnim};
76
+ animation-name: ${theAnim};
77
+ -webkit-animation-fill-mode: ${AS.fillMode};
78
+ animation-fill-mode: ${AS.fillMode};
79
+ animation-direction: ${AS.direction};
80
+ -webkit-animation-direction: ${AS.direction};
81
+ -webkit-animation-timing-function: ${AS.timing};
82
+ animation-timing-function: ${AS.timing};
83
+ -webkit-animation-delay: ${AS.delay}s;
84
+ animation-delay: ${AS.delay}s;
85
+ `;
86
+ return react_1.default.createElement(AnimWrapDiv, null, children);
87
+ };
88
+ exports.AnimWrap = AnimWrap;
@@ -0,0 +1,32 @@
1
+ interface AllAnimsProps {
2
+ degreesLow?: number;
3
+ degreesHi?: number;
4
+ }
5
+ export declare const allAnims: (props: AllAnimsProps) => {
6
+ X360: import("styled-components").Keyframes;
7
+ Y360: import("styled-components").Keyframes;
8
+ fadeInkf: import("styled-components").Keyframes;
9
+ wobY: import("styled-components").Keyframes;
10
+ wobX: import("styled-components").Keyframes;
11
+ fwdx018: import("styled-components").Keyframes;
12
+ fwdx1836: import("styled-components").Keyframes;
13
+ fwdx09: import("styled-components").Keyframes;
14
+ fwdx918: import("styled-components").Keyframes;
15
+ fwdx1827: import("styled-components").Keyframes;
16
+ fwdx2736: import("styled-components").Keyframes;
17
+ fwdy018: import("styled-components").Keyframes;
18
+ fwdy1836: import("styled-components").Keyframes;
19
+ fwdy09: import("styled-components").Keyframes;
20
+ fwdy918: import("styled-components").Keyframes;
21
+ fwdy1827: import("styled-components").Keyframes;
22
+ fwdy2736: import("styled-components").Keyframes;
23
+ floatX: import("styled-components").Keyframes;
24
+ floatShadow: import("styled-components").Keyframes;
25
+ pulseSM: import("styled-components").Keyframes;
26
+ pulseMD: import("styled-components").Keyframes;
27
+ pulseLG: import("styled-components").Keyframes;
28
+ swing: import("styled-components").Keyframes;
29
+ swingDecay: import("styled-components").Keyframes;
30
+ noAnim: import("styled-components").Keyframes;
31
+ };
32
+ export {};
@@ -0,0 +1,329 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.allAnims = void 0;
4
+ const styled_components_1 = require("styled-components");
5
+ const allAnims = (props) => {
6
+ const { degreesLow = 0, degreesHi = 0 } = props;
7
+ const swing = (0, styled_components_1.keyframes) `
8
+ 0% {
9
+ -webkit-transform-origin: top;
10
+ -ms-transform-origin: top;
11
+ transform-origin: top;
12
+ -webkit-transform: perspective(550px) rotateX(77deg);
13
+ transform: perspective(550px) rotateX(77deg);
14
+ }
15
+ 50% {
16
+ -webkit-transform: perspective(550px) rotateX(-77deg);
17
+ transform: perspective(550px) rotateX(-77deg);
18
+ }
19
+ 100% {
20
+ -webkit-transform-origin: top;
21
+ -ms-transform-origin: top;
22
+ transform-origin: top;
23
+ -webkit-transform: perspective(550px) rotateX(77deg);
24
+ transform: perspective(550px) rotateX(77deg);
25
+ }
26
+ `;
27
+ const swingDecay = (0, styled_components_1.keyframes) `
28
+ 0% {
29
+ -webkit-transform-origin: top;
30
+ -ms-transform-origin: top;
31
+ transform-origin: top;
32
+ -webkit-transform: perspective(550px) rotateX(77deg);
33
+ transform: perspective(550px) rotateX(77deg);
34
+ }
35
+ 20% {
36
+ -webkit-transform: perspective(550px) rotateX(-55deg);
37
+ transform: perspective(550px) rotateX(-55deg);
38
+ }
39
+ 40% {
40
+ -webkit-transform: perspective(550px) rotateX(44deg);
41
+ transform: perspective(550px) rotateX(44deg);
42
+ }
43
+
44
+ 60% {
45
+ -webkit-transform: perspective(550px) rotateX(-22deg);
46
+ transform: perspective(550px) rotateX(-22deg);
47
+ }
48
+
49
+ 80% {
50
+ -webkit-transform: perspective(550px) rotateX(11deg);
51
+ transform: perspective(550px) rotateX(11deg);
52
+ }
53
+ 100% {
54
+ -webkit-transform-origin: top;
55
+ -ms-transform-origin: top;
56
+ transform-origin: top;
57
+ -webkit-transform: perspective(550px) rotateX(0);
58
+ transform: perspective(550px) rotateX(0);
59
+ }
60
+ `;
61
+ const X360 = (0, styled_components_1.keyframes) `
62
+ from {
63
+ -webkit-transform: rotateX(360deg);
64
+ transform: rotateX(360deg);
65
+ }
66
+ to {
67
+ -webkit-transform: rotateX(0deg);
68
+ transform: rotateX(0deg);
69
+ }`;
70
+ //////// Y360
71
+ const Y360 = (0, styled_components_1.keyframes) `
72
+ from {
73
+ -webkit-transform: rotateY(360deg);
74
+ transform: rotateY(360deg);
75
+ }
76
+ to {
77
+ -webkit-transform: rotateY(0deg);
78
+ transform: rotateY(0deg);
79
+ }`;
80
+ const fadeInkf = (0, styled_components_1.keyframes) `
81
+ from {
82
+ opacity: 0;
83
+ }
84
+ to {
85
+ opacity: 1;
86
+ }`;
87
+ const wobY = (0, styled_components_1.keyframes) `
88
+ 0% {
89
+ -webkit-transform: rotateY(${degreesLow}deg);
90
+ transform: rotateY(${degreesLow}deg);
91
+ }
92
+ 50% {
93
+ -webkit-transform: rotateY(${degreesHi}deg);
94
+ transform: rotateY(${degreesHi}deg);
95
+ }
96
+ 100% {
97
+ -webkit-transform: rotateY(${degreesLow}deg);
98
+ transform: rotateY(${degreesLow}deg);
99
+ }`;
100
+ const wobX = (0, styled_components_1.keyframes) `
101
+ 0% {
102
+ -webkit-transform: rotateX(${degreesLow}deg);
103
+ transform: rotateX(${degreesLow}deg);
104
+ }
105
+ 50% {
106
+ -webkit-transform: rotateX(${degreesHi}deg);
107
+ transform: rotateX(${degreesHi}deg);
108
+ }
109
+ 100% {
110
+ -webkit-transform: rotateX(${degreesLow}deg);
111
+ transform: rotateX(${degreesLow}deg);
112
+ }`;
113
+ /* ============================== x-axis 0-180 >180 - 360 */
114
+ const fwdx018 = (0, styled_components_1.keyframes) `
115
+ from {
116
+ -webkit-transform: rotateX(360deg);
117
+ transform: rotateX(360deg);
118
+ }
119
+ to {
120
+ -webkit-transform: rotateX(180deg);
121
+ transform: rotateX(180deg);
122
+ }`;
123
+ const fwdx1836 = (0, styled_components_1.keyframes) `
124
+ from {
125
+ -webkit-transform: rotateX(180deg);
126
+ transform: rotateX(180deg);
127
+ }
128
+ to {
129
+ -webkit-transform: rotateX(0deg);
130
+ transform: rotateX(0deg);
131
+ }`;
132
+ /* ============================= x-axis 0-90, 90-180, 180-270, 270-360 */
133
+ const fwdx09 = (0, styled_components_1.keyframes) `
134
+ from {
135
+ -webkit-transform: rotateX(0deg);
136
+ transform: rotateX(0deg);
137
+ }
138
+ to {
139
+ -webkit-transform: rotateX(90deg);
140
+ transform: rotateX(90deg);
141
+ }`;
142
+ const fwdx918 = (0, styled_components_1.keyframes) `
143
+ from {
144
+ -webkit-transform: rotateX(90deg);
145
+ transform: rotateX(90deg);
146
+ }
147
+ to {
148
+ -webkit-transform: rotateX(180deg);
149
+ transform: rotateX(180deg);
150
+ }`;
151
+ const fwdx1827 = (0, styled_components_1.keyframes) `
152
+ from {
153
+ -webkit-transform: rotateX(180deg);
154
+ transform: rotateX(180deg);
155
+ }
156
+ to {
157
+ -webkit-transform: rotateX(270deg);
158
+ transform: rotateX(270deg);
159
+ }`;
160
+ const fwdx2736 = (0, styled_components_1.keyframes) `
161
+ from {
162
+ -webkit-transform: rotateX(270deg);
163
+ transform: rotateX(270deg);
164
+ }
165
+ to {
166
+ -webkit-transform: rotateX(360deg);
167
+ transform: rotateX(360deg);
168
+ }`;
169
+ /* ============================== y-axis 0-180 >180 - 360 */
170
+ const fwdy018 = (0, styled_components_1.keyframes) `
171
+ from {
172
+ -webkit-transform: rotateY(0deg);
173
+ transform: rotateY(0deg);
174
+ }
175
+ to {
176
+ -webkit-transform: rotateY(180deg);
177
+ transform: rotateY(180deg);
178
+ }`;
179
+ const fwdy1836 = (0, styled_components_1.keyframes) `
180
+ from {
181
+ -webkit-transform: rotateY(180deg);
182
+ transform: rotateY(180deg);
183
+ }
184
+ to {
185
+ -webkit-transform: rotateY(0deg);
186
+ transform: rotateY(0deg);
187
+ }`;
188
+ /* ============================= y-axis 0-90, 90-180, 180-270, 270-360 */
189
+ const fwdy09 = (0, styled_components_1.keyframes) `
190
+ from {
191
+ -webkit-transform: rotateY(0deg);
192
+ transform: rotateY(0deg);
193
+ }
194
+ to {
195
+ -webkit-transform: rotateY(90deg);
196
+ transform: rotateY(90deg);
197
+ }`;
198
+ const fwdy918 = (0, styled_components_1.keyframes) `
199
+ from {
200
+ -webkit-transform: rotateY(90deg);
201
+ transform: rotateY(90deg);
202
+ }
203
+ to {
204
+ -webkit-transform: rotateY(180deg);
205
+ transform: rotateY(180deg);
206
+ }`;
207
+ const fwdy1827 = (0, styled_components_1.keyframes) `
208
+ from {
209
+ -webkit-transform: rotateY(180deg);
210
+ transform: rotateY(180deg);
211
+ }
212
+ to {
213
+ -webkit-transform: rotateY(270deg);
214
+ transform: rotateY(270deg);
215
+ }`;
216
+ const fwdy2736 = (0, styled_components_1.keyframes) `
217
+ from {
218
+ -webkit-transform: rotateY(270deg);
219
+ transform: rotateY(270deg);
220
+ }
221
+ to {
222
+ -webkit-transform: rotateY(360deg);
223
+ transform: rotateY(360deg);
224
+ }`;
225
+ /* ============================= floating */
226
+ const floatX = (0, styled_components_1.keyframes) `
227
+ 0% { -webkit-transform: translate(0, 0px); -ms-transform: translate(0, 0px); transform: translate(0, 0px); }
228
+ 50% { -webkit-transform: translate(0, 15px); -ms-transform: translate(0, 15px); transform: translate(0, 15px); }
229
+ 100% { -webkit-transform: translate(0, -0px); -ms-transform: translate(0, -0px); transform: translate(0, -0px); }`;
230
+ const floatShadow = (0, styled_components_1.keyframes) `
231
+ 0% {
232
+ -webkit-box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
233
+ box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
234
+ -webkit-transform: translateY(0px);
235
+ -ms-transform: translateY(0px);
236
+ transform: translateY(0px);
237
+ }
238
+ 50% {
239
+ -webkit-box-shadow: 0 25px 15px 0px rgba(0,0,0,0.2);
240
+ box-shadow: 0 25px 15px 0px rgba(0,0,0,0.2);
241
+ -webkit-transform: translateY(-20px);
242
+ -ms-transform: translateY(-20px);
243
+ transform: translateY(-20px);
244
+ }
245
+ 100% {
246
+ -webkit-box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
247
+ box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
248
+ -webkit-transform: translateY(0px);
249
+ -ms-transform: translateY(0px);
250
+ transform: translateY(0px);
251
+ }`;
252
+ const pulseSM = (0, styled_components_1.keyframes) `
253
+ 0% {
254
+ -webkit-transform: scale(0.9);
255
+ -ms-transform: scale(0.9);
256
+ transform: scale(0.9);
257
+ }
258
+ 70% {
259
+ -webkit-transform: scale(1);
260
+ -ms-transform: scale(1);
261
+ transform: scale(1);
262
+ }
263
+ 100% {
264
+ -webkit-transform: scale(0.9);
265
+ -ms-transform: scale(0.9);
266
+ transform: scale(0.9);
267
+ }`;
268
+ const pulseMD = (0, styled_components_1.keyframes) `
269
+ 0% {
270
+ -webkit-transform: scale(0.7);
271
+ -ms-transform: scale(0.7);
272
+ transform: scale(0.7);
273
+ }
274
+ 70% {
275
+ -webkit-transform: scale(1);
276
+ -ms-transform: scale(1);
277
+ transform: scale(1);
278
+ }
279
+ 100% {
280
+ -webkit-transform: scale(0.7);
281
+ -ms-transform: scale(0.7);
282
+ transform: scale(0.7);
283
+ }`;
284
+ const pulseLG = (0, styled_components_1.keyframes) `
285
+ 0% {
286
+ -webkit-transform: scale(0.5);
287
+ -ms-transform: scale(0.5);
288
+ transform: scale(0.5);
289
+ }
290
+ 70% {
291
+ -webkit-transform: scale(1);
292
+ -ms-transform: scale(1);
293
+ transform: scale(1);
294
+ }
295
+ 100% {
296
+ -webkit-transform: scale(0.5);
297
+ -ms-transform: scale(0.5);
298
+ transform: scale(0.5);
299
+ }`;
300
+ const noAnim = (0, styled_components_1.keyframes) ``;
301
+ return {
302
+ X360,
303
+ Y360,
304
+ fadeInkf,
305
+ wobY,
306
+ wobX,
307
+ fwdx018,
308
+ fwdx1836,
309
+ fwdx09,
310
+ fwdx918,
311
+ fwdx1827,
312
+ fwdx2736,
313
+ fwdy018,
314
+ fwdy1836,
315
+ fwdy09,
316
+ fwdy918,
317
+ fwdy1827,
318
+ fwdy2736,
319
+ floatX,
320
+ floatShadow,
321
+ pulseSM,
322
+ pulseMD,
323
+ pulseLG,
324
+ swing,
325
+ swingDecay,
326
+ noAnim,
327
+ };
328
+ };
329
+ exports.allAnims = allAnims;
@@ -0,0 +1,6 @@
1
+ interface ObjWrapperProps {
2
+ showCenterDiv?: boolean | string | number;
3
+ children?: any;
4
+ }
5
+ export declare const ObjWrapper: (props: ObjWrapperProps) => any;
6
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ObjWrapper = void 0;
7
+ const styled_components_1 = __importDefault(require("styled-components"));
8
+ const react_1 = __importDefault(require("react"));
9
+ const ObjWrapper = (props) => {
10
+ const { showCenterDiv = false, children = "" } = props;
11
+ const Wrapper = showCenterDiv
12
+ ? styled_components_1.default.section `
13
+ width: 100%;
14
+ height: 100%;
15
+ position: relative;
16
+ transform-style: preserve-3d;
17
+ border: 1px solid #0f0;
18
+ `
19
+ : styled_components_1.default.section `
20
+ width: 100%;
21
+ height: 100%;
22
+ position: relative;
23
+ transform-style: preserve-3d;
24
+ `;
25
+ return react_1.default.createElement(Wrapper, null, children);
26
+ };
27
+ exports.ObjWrapper = ObjWrapper;
@@ -0,0 +1,10 @@
1
+ interface SceneStyleProps {
2
+ width?: number | string;
3
+ height?: number | string;
4
+ perspective?: number | string | undefined;
5
+ perspectiveOrigin?: string | undefined;
6
+ zIndex?: number | undefined;
7
+ children: any;
8
+ }
9
+ export declare const SceneStyle: (props: SceneStyleProps) => JSX.Element;
10
+ export {};
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SceneStyle = void 0;
7
+ const styled_components_1 = __importDefault(require("styled-components"));
8
+ const react_1 = __importDefault(require("react"));
9
+ const SceneStyle = (props) => {
10
+ const { width = 0, height = 0, perspective = 600, perspectiveOrigin = "50% 50%", zIndex = 10, children = {}, } = props;
11
+ const SceneStyleDiv = styled_components_1.default.div `
12
+ width: ${width}px;
13
+ height: ${height}px;
14
+ -webkit-perspective: ${perspective}px;
15
+ perspective: ${perspective}px;
16
+ -webkit-perspective-origin: ${perspectiveOrigin};
17
+ perspective-origin: ${perspectiveOrigin};
18
+ `;
19
+ return (react_1.default.createElement("div", { style: { zIndex } },
20
+ react_1.default.createElement(SceneStyleDiv, null, children)));
21
+ };
22
+ exports.SceneStyle = SceneStyle;
@@ -0,0 +1 @@
1
+ export * from "./components";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./components"), exports);
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import styled from "styled-components";
2
3
  export default function Face(props) {
3
4
  let { depth = 10, global = { css: "", body: "" }, height = 10, face, width = 100, } = props;
@@ -5,8 +6,6 @@ export default function Face(props) {
5
6
  let transform;
6
7
  let tranz = +height / 2;
7
8
  const body = face.body ? face.body : global.body;
8
- console.log("====props====" + face.name);
9
- console.log(props);
10
9
  ////////////////////////////////////////////////////////////////////////////// BOTTOM
11
10
  if (face.name === "bottom") {
12
11
  tranz = +height - +depth / 2;
@@ -90,13 +89,6 @@ export default function Face(props) {
90
89
  else {
91
90
  console.log(face.name + " is not a recognized face.name");
92
91
  }
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
92
  const Specs = styled.section `
101
93
  ${face.css || global.css}
102
94
  width: ${width}px;
package/package.json CHANGED
@@ -1,12 +1,4 @@
1
1
 
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
2
  {
11
3
  "name": "anim-3d-obj",
12
4
  "repository": {
@@ -14,7 +6,7 @@
14
6
  "url": "https://github.com/mdnelles/anim-3d-obj-npm-publisher.git"
15
7
  },
16
8
  "homepage": "https://github.com/mdnelles/anim-3d-obj-npm-publisher.git",
17
- "version": "1.1.73",
9
+ "version": "1.2.2",
18
10
  "description": "React library for creating 3D objects quickly. Also these objects can be animated",
19
11
  "main": "dist/cjs/index.js",
20
12
  "module": "dist/esm/index.js",