anim-3d-obj 1.1.12 → 1.1.16
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/.eslintignore +2 -0
- package/.eslintrc +32 -0
- package/.prettierrc.json +10 -0
- package/README.md +107 -154
- package/babel.config.json +18 -0
- package/dist/components/Card.tsx +55 -0
- package/dist/components/Cuboid.tsx +61 -0
- package/dist/components/Faces/Face.tsx +72 -0
- package/dist/components/Faces/FaceInter.d.ts +39 -0
- package/dist/components/Ribbon.tsx +57 -0
- package/dist/components/styles/Anim.d.ts +16 -0
- package/dist/components/styles/AnimWrap.tsx +92 -0
- package/dist/components/styles/Anims.ts +290 -0
- package/dist/components/styles/Global.ts +7 -0
- package/dist/components/styles/Scene.tsx +30 -0
- package/dist/index.ts +9 -0
- package/jestconfig.json +8 -0
- package/package.json +65 -44
- package/public/favicon.ico +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/src/components/Card.tsx +55 -0
- package/src/components/Cuboid.tsx +61 -0
- package/src/components/Faces/Face.tsx +72 -0
- package/src/components/Faces/FaceInter.d.ts +39 -0
- package/src/components/Ribbon.tsx +57 -0
- package/src/components/styles/Anim.d.ts +16 -0
- package/src/components/styles/AnimWrap.tsx +92 -0
- package/src/components/styles/Anims.ts +290 -0
- package/src/components/styles/Global.ts +7 -0
- package/src/components/styles/Scene.tsx +30 -0
- package/src/index.ts +9 -0
- package/tests/common.test.tsx +29 -0
- package/tsconfig.json +29 -0
- package/LICENSE +0 -21
package/.eslintignore
ADDED
package/.eslintrc
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"extends": [
|
|
4
|
+
"prettier",
|
|
5
|
+
"plugin:prettier/recommended",
|
|
6
|
+
"eslint:recommended",
|
|
7
|
+
"plugin:react/recommended",
|
|
8
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
9
|
+
"plugin:@typescript-eslint/recommended"
|
|
10
|
+
],
|
|
11
|
+
"parser": "@typescript-eslint/parser",
|
|
12
|
+
"plugins": ["@typescript-eslint", "prettier", "react", "react-hooks"],
|
|
13
|
+
"rules": {
|
|
14
|
+
"react-hooks/rules-of-hooks": "error",
|
|
15
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
16
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
17
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
18
|
+
"@typescript-eslint/no-explicit-any": "off"
|
|
19
|
+
},
|
|
20
|
+
"settings": {
|
|
21
|
+
"react": {
|
|
22
|
+
"version": "detect"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"env": {
|
|
26
|
+
"browser": true,
|
|
27
|
+
"node": true
|
|
28
|
+
},
|
|
29
|
+
"globals": {
|
|
30
|
+
"JSX": true
|
|
31
|
+
}
|
|
32
|
+
}
|
package/.prettierrc.json
ADDED
package/README.md
CHANGED
|
@@ -1,154 +1,107 @@
|
|
|
1
|
-
# React Typescript Cuboid Builder
|
|
2
|
-
|
|
3
|
-
This project allows a user to create Cuboids of any size simply by entering a set of parameters.
|
|
4
|
-
The program does the leg work with regard to calculating translationZ depth and config on the fly.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
css: ``,
|
|
109
|
-
body: " ",
|
|
110
|
-
},
|
|
111
|
-
back: {
|
|
112
|
-
css: ``,
|
|
113
|
-
body: <Logout />,
|
|
114
|
-
},
|
|
115
|
-
bottom: {
|
|
116
|
-
css: `
|
|
117
|
-
background-color:rgba(141,191,249,1);
|
|
118
|
-
-webkit-box-shadow: 0px 0px 23px 18px #858585;
|
|
119
|
-
box-shadow: 0px 0px 23px 18px #858585;
|
|
120
|
-
`,
|
|
121
|
-
},
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
## Render
|
|
125
|
-
|
|
126
|
-
and
|
|
127
|
-
|
|
128
|
-
```typescript
|
|
129
|
-
<Cuboid
|
|
130
|
-
width={250}
|
|
131
|
-
height={300}
|
|
132
|
-
depth={250}
|
|
133
|
-
perspective={800}
|
|
134
|
-
perspectiveOrigin="50% 50%"
|
|
135
|
-
zIndex={10}
|
|
136
|
-
anim1Specs={anim1Specs}
|
|
137
|
-
anim2Specs={anim2Specs}
|
|
138
|
-
custom={custom}
|
|
139
|
-
faces={faceprops}
|
|
140
|
-
global={global}
|
|
141
|
-
/>
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
will produce the following
|
|
145
|
-
|
|
146
|
-

|
|
147
|
-
|
|
148
|
-
## Authors
|
|
149
|
-
|
|
150
|
-
- [@mdnelles](https://github.com/mdnelles)
|
|
151
|
-
|
|
152
|
-
## License
|
|
153
|
-
|
|
154
|
-
[MIT](https://choosealicense.com/licenses/mit/)
|
|
1
|
+
# React Typescript Cuboid Builder
|
|
2
|
+
|
|
3
|
+
This project allows a user to create Cuboids of any size simply by entering a set of parameters.
|
|
4
|
+
The program does the leg work with regard to calculating translationZ depth and config on the fly.
|
|
5
|
+
|
|
6
|
+
## Deployment
|
|
7
|
+
|
|
8
|
+
Install sequence
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
git clone https://github.com/mdnelles/anim-3d-objs.git
|
|
12
|
+
npm i
|
|
13
|
+
npm run start
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Examples
|
|
17
|
+
|
|
18
|
+
All sided simple https://codesandbox.io/s/anim-3d-obj-all-sides-simple-sdy1q0
|
|
19
|
+
|
|
20
|
+
Two sided simple https://codesandbox.io/s/anim-3d-obj-2-sides-simple-9wognm
|
|
21
|
+
|
|
22
|
+
90 degree wobble on X axis https://codesandbox.io/s/anim-3d-obj-wobblex-08mxqe
|
|
23
|
+
|
|
24
|
+
speed wobble(y) 3 sides https://codesandbox.io/s/anim-3d-obj-3-sides-wobble-y-axis-dceqdp
|
|
25
|
+
|
|
26
|
+
## Authors
|
|
27
|
+
|
|
28
|
+
- [@mdnelles](https://github.com/mdnelles)
|
|
29
|
+
|
|
30
|
+
## Demo
|
|
31
|
+
|
|
32
|
+
The following code
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
const indivStyles: object = {
|
|
36
|
+
// // face individual styles (over rides global)
|
|
37
|
+
bottom: {
|
|
38
|
+
bfv: "visible",
|
|
39
|
+
fontFamily: "Helvetica",
|
|
40
|
+
},
|
|
41
|
+
front: {
|
|
42
|
+
border: "1px solid #f00",
|
|
43
|
+
bgc: "#f00",
|
|
44
|
+
bfv: "visible",
|
|
45
|
+
fontFamily: "Arial, Sans",
|
|
46
|
+
},
|
|
47
|
+
left: {
|
|
48
|
+
bgc: "yellow",
|
|
49
|
+
},
|
|
50
|
+
top: {
|
|
51
|
+
bgc: "pink",
|
|
52
|
+
},
|
|
53
|
+
right: {
|
|
54
|
+
bgc: "purple",
|
|
55
|
+
},
|
|
56
|
+
back: {
|
|
57
|
+
border: "1px solid #f00",
|
|
58
|
+
bgc: "#0f0",
|
|
59
|
+
bfv: "visible",
|
|
60
|
+
fontFamily: "Arial, Sans",
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
and
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
<Cuboid
|
|
69
|
+
width={260}
|
|
70
|
+
depth={260}
|
|
71
|
+
height={92}
|
|
72
|
+
perspectiveOrigin='50% 50%'
|
|
73
|
+
zIndex={10}
|
|
74
|
+
animSpecs={animSpecs}
|
|
75
|
+
indivStyles={indivStyles}
|
|
76
|
+
faces={faceprops}
|
|
77
|
+
globalStyles={globalStyles}
|
|
78
|
+
>
|
|
79
|
+
{}
|
|
80
|
+
</Cuboid>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
will produce the following
|
|
84
|
+
|
|
85
|
+

|
|
86
|
+
|
|
87
|
+
##Face Format
|
|
88
|
+
for things like `background-image: url("myImg.png");` they can be done in `moreStyles` argument.
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
const Specs: any = styled.div`
|
|
92
|
+
opacity: ${opac ? opac : globalStyles.opac};
|
|
93
|
+
position: ${position};
|
|
94
|
+
left: ${left};
|
|
95
|
+
margin: ${margin};
|
|
96
|
+
padding: ${padding};
|
|
97
|
+
width: ${width}px;
|
|
98
|
+
font-family: ${fontFamily};
|
|
99
|
+
height: ${height}px;
|
|
100
|
+
background-color: ${bgc ? bgc : globalStyles.bgc};
|
|
101
|
+
border: ${border ? border : globalStyles.border};
|
|
102
|
+
backface-visibility: ${bfv ? bfv : globalStyles.bfv};
|
|
103
|
+
${transform}
|
|
104
|
+
top: ${top};
|
|
105
|
+
${moreStyles}
|
|
106
|
+
`;
|
|
107
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AnimWrap } from './styles/AnimWrap'
|
|
2
|
+
import { SceneStyle } from './styles/Scene'
|
|
3
|
+
import { ObjProps } from './Faces/FaceInter'
|
|
4
|
+
import Face from './Faces/Face'
|
|
5
|
+
import { ObjWrapper } from './styles/Global'
|
|
6
|
+
|
|
7
|
+
export const Card = (props: ObjProps): any => {
|
|
8
|
+
const {
|
|
9
|
+
anim1Specs,
|
|
10
|
+
anim2Specs,
|
|
11
|
+
width = 5,
|
|
12
|
+
height = 5,
|
|
13
|
+
faces,
|
|
14
|
+
global = {},
|
|
15
|
+
custom = {},
|
|
16
|
+
tranz = (+height / 2) | 0,
|
|
17
|
+
perspective,
|
|
18
|
+
perspectiveOrigin,
|
|
19
|
+
zIndex,
|
|
20
|
+
} = props
|
|
21
|
+
|
|
22
|
+
const buildFace = (faceType: any): any => {
|
|
23
|
+
return (
|
|
24
|
+
<Face
|
|
25
|
+
width={width}
|
|
26
|
+
height={height}
|
|
27
|
+
depth={0.1}
|
|
28
|
+
faceType={faceType}
|
|
29
|
+
id={faceType}
|
|
30
|
+
tranz={tranz}
|
|
31
|
+
global={global}
|
|
32
|
+
custom={custom}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<SceneStyle
|
|
39
|
+
width={width}
|
|
40
|
+
height={height}
|
|
41
|
+
perspective={perspective}
|
|
42
|
+
perspectiveOrigin={perspectiveOrigin}
|
|
43
|
+
zIndex={zIndex}
|
|
44
|
+
>
|
|
45
|
+
<AnimWrap animSpecs={anim1Specs}>
|
|
46
|
+
<AnimWrap animSpecs={anim2Specs}>
|
|
47
|
+
<ObjWrapper>
|
|
48
|
+
{faces && faces.front ? buildFace('front') : null}
|
|
49
|
+
{faces && faces.back ? buildFace('back') : null}
|
|
50
|
+
</ObjWrapper>
|
|
51
|
+
</AnimWrap>
|
|
52
|
+
</AnimWrap>
|
|
53
|
+
</SceneStyle>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//import React from 'react'
|
|
2
|
+
import { AnimWrap } from './styles/AnimWrap'
|
|
3
|
+
import { SceneStyle } from './styles/Scene'
|
|
4
|
+
import { ObjProps } from './Faces/FaceInter'
|
|
5
|
+
import Face from './Faces/Face'
|
|
6
|
+
import { ObjWrapper } from './styles/Global'
|
|
7
|
+
|
|
8
|
+
export const Cuboid = (props: ObjProps): any => {
|
|
9
|
+
const {
|
|
10
|
+
anim1Specs,
|
|
11
|
+
anim2Specs,
|
|
12
|
+
width = 5,
|
|
13
|
+
height = 5,
|
|
14
|
+
depth = 5,
|
|
15
|
+
faces,
|
|
16
|
+
global = {},
|
|
17
|
+
custom = {},
|
|
18
|
+
tranz = (+height / 2) | 0,
|
|
19
|
+
perspective,
|
|
20
|
+
perspectiveOrigin,
|
|
21
|
+
zIndex,
|
|
22
|
+
} = props
|
|
23
|
+
|
|
24
|
+
const buildFace = (faceType: any): any => {
|
|
25
|
+
return (
|
|
26
|
+
<Face
|
|
27
|
+
width={width}
|
|
28
|
+
height={height}
|
|
29
|
+
depth={depth}
|
|
30
|
+
faceType={faceType}
|
|
31
|
+
id={faceType}
|
|
32
|
+
tranz={tranz}
|
|
33
|
+
global={global}
|
|
34
|
+
custom={custom}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<SceneStyle
|
|
41
|
+
width={width}
|
|
42
|
+
height={height}
|
|
43
|
+
perspective={perspective}
|
|
44
|
+
perspectiveOrigin={perspectiveOrigin}
|
|
45
|
+
zIndex={zIndex}
|
|
46
|
+
>
|
|
47
|
+
<AnimWrap animSpecs={anim1Specs}>
|
|
48
|
+
<AnimWrap animSpecs={anim2Specs}>
|
|
49
|
+
<ObjWrapper>
|
|
50
|
+
{faces && faces.front ? buildFace('front') : null}
|
|
51
|
+
{faces && faces.right ? buildFace('right') : null}
|
|
52
|
+
{faces && faces.back ? buildFace('back') : null}
|
|
53
|
+
{faces && faces.left ? buildFace('left') : null}
|
|
54
|
+
{faces && faces.top ? buildFace('top') : null}
|
|
55
|
+
{faces && faces.bottom ? buildFace('bottom') : null}
|
|
56
|
+
</ObjWrapper>
|
|
57
|
+
</AnimWrap>
|
|
58
|
+
</AnimWrap>
|
|
59
|
+
</SceneStyle>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
import { FaceProps } from './FaceInter'
|
|
3
|
+
|
|
4
|
+
const Face = (props: FaceProps): JSX.Element => {
|
|
5
|
+
let { height = 10, tranz = 80, width = 100 } = props
|
|
6
|
+
|
|
7
|
+
const { depth = 10, faceType, global = {}, custom = false } = props
|
|
8
|
+
|
|
9
|
+
let transform
|
|
10
|
+
const styles = custom[faceType] && custom[faceType].css ? custom[faceType].css : global.css
|
|
11
|
+
const body = custom[faceType] && custom[faceType].body ? custom[faceType].body : global.body
|
|
12
|
+
if (faceType === 'bottom') {
|
|
13
|
+
tranz = +height - +depth / 2
|
|
14
|
+
height = +depth
|
|
15
|
+
transform = `transform: rotateX(-90deg) translateZ(${tranz}px);`
|
|
16
|
+
//styles = custom["top"] ? custom : global;
|
|
17
|
+
} else if (faceType === 'top') {
|
|
18
|
+
height = +depth
|
|
19
|
+
if (depth) tranz = +depth / 2
|
|
20
|
+
transform = `transform: rotateX(90deg) translateZ(${tranz}px);`
|
|
21
|
+
} else if (faceType === 'front') {
|
|
22
|
+
if (depth) tranz = +depth / 2
|
|
23
|
+
transform = `transform: rotateY(0deg) translateZ(${tranz}px);`
|
|
24
|
+
} else if (faceType === 'back') {
|
|
25
|
+
if (depth) tranz = +depth / 2
|
|
26
|
+
transform = `transform: rotateY(180deg) translateZ(${tranz}px);`
|
|
27
|
+
} else if (faceType === 'right') {
|
|
28
|
+
if (height > width && !depth) {
|
|
29
|
+
tranz = -(+height / 2 - +width)
|
|
30
|
+
width = +height
|
|
31
|
+
} else if (width > height && !depth) {
|
|
32
|
+
tranz = +height / 2
|
|
33
|
+
height = +width
|
|
34
|
+
} else {
|
|
35
|
+
tranz = +width - +depth / 2
|
|
36
|
+
width = +depth
|
|
37
|
+
}
|
|
38
|
+
transform = `transform: rotateY(90deg) translateZ(${tranz}px);`
|
|
39
|
+
// topr is to of Ribbon which points back
|
|
40
|
+
} else if (faceType === 'topr') {
|
|
41
|
+
height = +depth
|
|
42
|
+
if (depth) tranz = +depth / 2
|
|
43
|
+
//let offset = depth / 2;
|
|
44
|
+
transform = `transform: rotateX(90deg) translateZ(${tranz}px ); `
|
|
45
|
+
} else {
|
|
46
|
+
if (height > width && !depth) {
|
|
47
|
+
tranz = -(+height / 2 - +width)
|
|
48
|
+
width = +height
|
|
49
|
+
} else if (width > height && !depth) {
|
|
50
|
+
tranz = +height / 2
|
|
51
|
+
height = +width
|
|
52
|
+
} else {
|
|
53
|
+
tranz = +depth / 2
|
|
54
|
+
width = +depth
|
|
55
|
+
}
|
|
56
|
+
transform = `transform: rotateY(-90deg) translateZ(${tranz}px);`
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//const BackFlip: any = styled.section``;
|
|
60
|
+
|
|
61
|
+
const Specs: any = styled.section`
|
|
62
|
+
${styles}
|
|
63
|
+
width: ${width}px;
|
|
64
|
+
position: absolute;
|
|
65
|
+
height: ${height}px;
|
|
66
|
+
${transform};
|
|
67
|
+
`
|
|
68
|
+
|
|
69
|
+
return <Specs>{body}</Specs>
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default Face
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface FaceProps {
|
|
2
|
+
children?: any
|
|
3
|
+
depth?: number | any
|
|
4
|
+
faceType?: any
|
|
5
|
+
custom?: any
|
|
6
|
+
global?: any
|
|
7
|
+
height?: number | string
|
|
8
|
+
id?: string | number | boolean
|
|
9
|
+
styles?: object | any
|
|
10
|
+
tranz?: any
|
|
11
|
+
width?: number | string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ObjProps {
|
|
15
|
+
anim1Specs?: object | undefined
|
|
16
|
+
anim2Specs?: object | undefined
|
|
17
|
+
children?: any
|
|
18
|
+
depth?: number
|
|
19
|
+
global?: { border?: string; bgc?: string; opac?: number | string } | any
|
|
20
|
+
faces?:
|
|
21
|
+
| {
|
|
22
|
+
front: boolean
|
|
23
|
+
back: boolean
|
|
24
|
+
left: boolean
|
|
25
|
+
right: boolean
|
|
26
|
+
top: boolean
|
|
27
|
+
bottom: boolean
|
|
28
|
+
}
|
|
29
|
+
| undefined
|
|
30
|
+
|
|
31
|
+
height?: number | string
|
|
32
|
+
custom?: object | string | undefined
|
|
33
|
+
perspective?: string | number | undefined
|
|
34
|
+
perspectiveOrigin?: string | undefined
|
|
35
|
+
tranz?: number | undefined
|
|
36
|
+
txt?: string | any
|
|
37
|
+
width?: number
|
|
38
|
+
zIndex?: number | undefined
|
|
39
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AnimWrap } from './styles/AnimWrap'
|
|
2
|
+
import { SceneStyle } from './styles/Scene'
|
|
3
|
+
import { ObjProps } from './Faces/FaceInter'
|
|
4
|
+
import Face from './Faces/Face'
|
|
5
|
+
import { ObjWrapper } from './styles/Global'
|
|
6
|
+
|
|
7
|
+
export const Ribbon = (props: ObjProps): any => {
|
|
8
|
+
const {
|
|
9
|
+
anim1Specs,
|
|
10
|
+
anim2Specs,
|
|
11
|
+
width = 5,
|
|
12
|
+
height = 5,
|
|
13
|
+
depth = 5,
|
|
14
|
+
faces,
|
|
15
|
+
global = {},
|
|
16
|
+
custom = {},
|
|
17
|
+
tranz = (+height / 2) | 0,
|
|
18
|
+
perspective,
|
|
19
|
+
perspectiveOrigin,
|
|
20
|
+
zIndex,
|
|
21
|
+
} = props
|
|
22
|
+
|
|
23
|
+
const buildFace = (faceType: any): any => {
|
|
24
|
+
return (
|
|
25
|
+
<Face
|
|
26
|
+
width={width}
|
|
27
|
+
height={height}
|
|
28
|
+
depth={depth}
|
|
29
|
+
faceType={faceType}
|
|
30
|
+
id={faceType}
|
|
31
|
+
tranz={tranz}
|
|
32
|
+
global={global}
|
|
33
|
+
custom={custom}
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<SceneStyle
|
|
40
|
+
width={width}
|
|
41
|
+
height={height}
|
|
42
|
+
perspective={perspective}
|
|
43
|
+
perspectiveOrigin={perspectiveOrigin}
|
|
44
|
+
zIndex={zIndex}
|
|
45
|
+
>
|
|
46
|
+
<AnimWrap animSpecs={anim1Specs}>
|
|
47
|
+
<AnimWrap animSpecs={anim2Specs}>
|
|
48
|
+
<ObjWrapper>
|
|
49
|
+
{faces && faces.bottom ? buildFace('bottom') : null}
|
|
50
|
+
{faces && faces.back ? buildFace('back') : null}
|
|
51
|
+
{faces && faces.top ? buildFace('topr') : null}
|
|
52
|
+
</ObjWrapper>
|
|
53
|
+
</AnimWrap>
|
|
54
|
+
</AnimWrap>
|
|
55
|
+
</SceneStyle>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface AnimStylesProps {
|
|
2
|
+
children?: any
|
|
3
|
+
animSpecs?: any
|
|
4
|
+
}
|
|
5
|
+
export interface AnimSpecsProps {
|
|
6
|
+
border?: string | undefined
|
|
7
|
+
degreesHi?: number | undefined
|
|
8
|
+
degreesLow?: number | undefined
|
|
9
|
+
delay: any
|
|
10
|
+
direction?: string | undefined
|
|
11
|
+
duration?: number | string | undefined
|
|
12
|
+
fillMode?: string | undefined
|
|
13
|
+
iterationCount?: number | string | undefined
|
|
14
|
+
name?: string | undefined
|
|
15
|
+
timing?: string | undefined
|
|
16
|
+
}
|