anim-3d-obj 1.1.16 → 1.1.18
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 +122 -75
- package/dist/cjs/components/Card.d.ts +2 -0
- package/dist/cjs/components/Cuboid.d.ts +2 -0
- package/dist/cjs/components/Faces/Face.d.ts +4 -0
- package/dist/cjs/components/Ribbon.d.ts +2 -0
- package/dist/cjs/components/styles/AnimWrap.d.ts +3 -0
- package/dist/cjs/components/styles/Anims.d.ts +30 -0
- package/dist/cjs/components/styles/Global.d.ts +1 -0
- package/dist/cjs/components/styles/Scene.d.ts +11 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +4374 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/components/Card.d.ts +2 -0
- package/dist/esm/components/Cuboid.d.ts +2 -0
- package/dist/esm/components/Faces/Face.d.ts +4 -0
- package/dist/esm/components/Ribbon.d.ts +2 -0
- package/dist/esm/components/styles/AnimWrap.d.ts +3 -0
- package/dist/esm/components/styles/Anims.d.ts +30 -0
- package/dist/esm/components/styles/Global.d.ts +1 -0
- package/dist/esm/components/styles/Scene.d.ts +11 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +4367 -0
- package/dist/esm/index.js.map +1 -0
- package/package.json +54 -32
- package/.eslintignore +0 -2
- package/.eslintrc +0 -32
- package/.prettierrc.json +0 -10
- package/babel.config.json +0 -18
- package/dist/components/Card.tsx +0 -55
- package/dist/components/Cuboid.tsx +0 -61
- package/dist/components/Faces/Face.tsx +0 -72
- package/dist/components/Faces/FaceInter.d.ts +0 -39
- package/dist/components/Ribbon.tsx +0 -57
- package/dist/components/styles/Anim.d.ts +0 -16
- package/dist/components/styles/AnimWrap.tsx +0 -92
- package/dist/components/styles/Anims.ts +0 -290
- package/dist/components/styles/Global.ts +0 -7
- package/dist/components/styles/Scene.tsx +0 -30
- package/dist/index.ts +0 -9
- package/jestconfig.json +0 -8
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -43
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/src/components/Card.tsx +0 -55
- package/src/components/Cuboid.tsx +0 -61
- package/src/components/Faces/Face.tsx +0 -72
- package/src/components/Faces/FaceInter.d.ts +0 -39
- package/src/components/Ribbon.tsx +0 -57
- package/src/components/styles/Anim.d.ts +0 -16
- package/src/components/styles/AnimWrap.tsx +0 -92
- package/src/components/styles/Anims.ts +0 -290
- package/src/components/styles/Global.ts +0 -7
- package/src/components/styles/Scene.tsx +0 -30
- package/src/index.ts +0 -9
- package/tests/common.test.tsx +0 -29
- package/tsconfig.json +0 -29
package/package.json
CHANGED
|
@@ -1,69 +1,91 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anim-3d-obj",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.18",
|
|
4
4
|
"private": false,
|
|
5
|
+
"npm": {
|
|
6
|
+
"publish": true
|
|
7
|
+
},
|
|
5
8
|
"dependencies": {
|
|
6
9
|
"@babel/polyfill": "^7.12.1",
|
|
7
10
|
"@reduxjs/toolkit": "^1.8.4",
|
|
8
11
|
"@testing-library/jest-dom": "^5.16.5",
|
|
9
12
|
"@testing-library/user-event": "^14.4.3",
|
|
10
|
-
"@types/node": "^18.7.
|
|
13
|
+
"@types/node": "^18.7.5",
|
|
11
14
|
"@types/react": "^18.0.17",
|
|
12
15
|
"@types/react-dom": "^18.0.6",
|
|
16
|
+
"jest-canvas-mock": "^2.4.0",
|
|
13
17
|
"react": "^18.2.0",
|
|
14
18
|
"react-dom": "^18.2.0",
|
|
15
19
|
"react-redux": "^8.0.2",
|
|
16
20
|
"react-scripts": "5.0.1",
|
|
17
21
|
"styled-components": "^5.3.5",
|
|
22
|
+
"ts-jest": "^28.0.8",
|
|
18
23
|
"typescript": "^4.7.4",
|
|
19
24
|
"web-vitals": "^2.1.4"
|
|
20
25
|
},
|
|
21
26
|
"scripts": {
|
|
22
27
|
"buildT": "tsc",
|
|
23
28
|
"build2": "npm run build:esm && npm run build:cjs",
|
|
24
|
-
"build": "rm -rf dist && NODE_ENV=production babel ./src --out-dir dist --copy-files",
|
|
29
|
+
"build-do-rollup": "rm -rf dist && NODE_ENV=production babel ./src --out-dir dist --copy-files",
|
|
25
30
|
"build:esm": "tsc -b",
|
|
26
31
|
"build:cjs": "tsc --module commonjs --outDir ./dist/cjs",
|
|
27
32
|
"lint": "eslint \"{**/*,*}.{js,ts,jsx,tsx}\"",
|
|
28
33
|
"prettier": "prettier --write \"{src,tests,example/src}/**/*.{js,ts,jsx,tsx}\"",
|
|
29
|
-
"test": "jest --config jestconfig.json"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
"react-app/jest"
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
"browserslist": {
|
|
38
|
-
"production": [
|
|
39
|
-
">0.2%",
|
|
40
|
-
"not dead",
|
|
41
|
-
"not op_mini all"
|
|
42
|
-
],
|
|
43
|
-
"development": [
|
|
44
|
-
"last 1 chrome version",
|
|
45
|
-
"last 1 firefox version",
|
|
46
|
-
"last 1 safari version"
|
|
47
|
-
]
|
|
34
|
+
"test": "jest --config jestconfig.json",
|
|
35
|
+
"rollup": "rollup -c",
|
|
36
|
+
"storybook": "start-storybook -p 6006",
|
|
37
|
+
"build-storybook": "build-storybook",
|
|
38
|
+
"release": "release-it"
|
|
48
39
|
},
|
|
40
|
+
"author": "mxnelles",
|
|
41
|
+
"license": "ISC",
|
|
49
42
|
"devDependencies": {
|
|
50
|
-
"@babel/cli": "^7.18.10",
|
|
51
43
|
"@babel/core": "^7.18.10",
|
|
52
44
|
"@babel/preset-env": "^7.18.10",
|
|
45
|
+
"@babel/preset-react": "^7.18.6",
|
|
46
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
47
|
+
"@rollup/plugin-commonjs": "^22.0.2",
|
|
48
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
49
|
+
"@rollup/plugin-typescript": "^8.3.4",
|
|
50
|
+
"@storybook/addon-actions": "^6.5.10",
|
|
51
|
+
"@storybook/addon-essentials": "^6.5.10",
|
|
52
|
+
"@storybook/addon-links": "^6.5.10",
|
|
53
|
+
"@storybook/builder-webpack5": "^6.5.10",
|
|
54
|
+
"@storybook/manager-webpack5": "^6.5.10",
|
|
55
|
+
"@storybook/preset-scss": "^1.0.3",
|
|
56
|
+
"@storybook/react": "^6.5.10",
|
|
53
57
|
"@testing-library/react": "^13.3.0",
|
|
54
|
-
"@types/jest": "^28.1.
|
|
58
|
+
"@types/jest": "^28.1.7",
|
|
59
|
+
"@types/react": "^18.0.17",
|
|
55
60
|
"@types/styled-components": "^5.1.26",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
61
|
+
"babel-jest": "^28.1.3",
|
|
62
|
+
"babel-loader": "^8.2.5",
|
|
63
|
+
"css-loader": "^6.7.1",
|
|
59
64
|
"eslint-config-prettier": "^8.5.0",
|
|
60
65
|
"eslint-plugin-prettier": "^4.2.1",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
66
|
+
"html-webpack-plugin": "^5.5.0",
|
|
67
|
+
"identity-obj-proxy": "^3.0.0",
|
|
63
68
|
"jest": "^28.1.3",
|
|
64
|
-
"jest-canvas-mock": "^2.4.0",
|
|
65
69
|
"jest-environment-jsdom": "^28.1.3",
|
|
66
|
-
"
|
|
67
|
-
"
|
|
70
|
+
"react": "^18.2.0",
|
|
71
|
+
"release-it": "^15.3.0",
|
|
72
|
+
"rollup": "^2.78.0",
|
|
73
|
+
"rollup-plugin-dts": "^4.2.2",
|
|
74
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
75
|
+
"sass": "^1.54.4",
|
|
76
|
+
"sass-loader": "^13.0.2",
|
|
77
|
+
"style-loader": "^3.3.1",
|
|
78
|
+
"typescript": "^4.7.4"
|
|
79
|
+
},
|
|
80
|
+
"main": "dist/cjs/index.js",
|
|
81
|
+
"module": "dist/esm/index.js",
|
|
82
|
+
"files": [
|
|
83
|
+
"dist"
|
|
84
|
+
],
|
|
85
|
+
"types": "dist/index.d.ts",
|
|
86
|
+
"release-it": {
|
|
87
|
+
"github": {
|
|
88
|
+
"release": true
|
|
89
|
+
}
|
|
68
90
|
}
|
|
69
91
|
}
|
package/.eslintignore
DELETED
package/.eslintrc
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
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
DELETED
package/babel.config.json
DELETED
package/dist/components/Card.tsx
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
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
|
|
@@ -1,39 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
2
|
-
//import React from 'react'
|
|
3
|
-
import { AnimStylesProps } from './Anim'
|
|
4
|
-
import { allAnims } from './Anims'
|
|
5
|
-
|
|
6
|
-
export const AnimWrap = (props: AnimStylesProps) => {
|
|
7
|
-
const { children, animSpecs } = props
|
|
8
|
-
const AS: any = animSpecs
|
|
9
|
-
|
|
10
|
-
const {
|
|
11
|
-
X360,
|
|
12
|
-
Y360,
|
|
13
|
-
fadeInkf,
|
|
14
|
-
wobY,
|
|
15
|
-
wobX,
|
|
16
|
-
fwdx018,
|
|
17
|
-
fwdx1836,
|
|
18
|
-
fwdx09,
|
|
19
|
-
fwdx918,
|
|
20
|
-
fwdx1827,
|
|
21
|
-
fwdx2736,
|
|
22
|
-
fwdy018,
|
|
23
|
-
fwdy1836,
|
|
24
|
-
fwdy09,
|
|
25
|
-
fwdy918,
|
|
26
|
-
fwdy1827,
|
|
27
|
-
fwdy2736,
|
|
28
|
-
floatX,
|
|
29
|
-
floatShadow,
|
|
30
|
-
pulseSM,
|
|
31
|
-
pulseMD,
|
|
32
|
-
pulseLG,
|
|
33
|
-
noAnim,
|
|
34
|
-
} = allAnims({
|
|
35
|
-
degreesHi: AS && AS.degreesHi ? AS.degreesHi : 0,
|
|
36
|
-
degreesLow: AS && AS.degreesLow ? AS.degreesLow : 0,
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
let theAnim: any = 'noAnim'
|
|
40
|
-
// need to iterate through all animation posibilities and not use eval() to satisfy TS
|
|
41
|
-
if (AS && AS.name) {
|
|
42
|
-
if (AS.name === 'X360') theAnim = X360
|
|
43
|
-
else if (AS.name === 'Y360') theAnim = Y360
|
|
44
|
-
else if (AS.name === 'fadeInkf') theAnim = fadeInkf
|
|
45
|
-
else if (AS.name === 'wobX') theAnim = wobX
|
|
46
|
-
else if (AS.name === 'wobY') theAnim = wobY
|
|
47
|
-
else if (AS.name === 'fwdx018') theAnim = fwdx018
|
|
48
|
-
else if (AS.name === 'fwdx1836') theAnim = fwdx1836
|
|
49
|
-
else if (AS.name === 'fwdx09') theAnim = fwdx09
|
|
50
|
-
else if (AS.name === 'fwdx918') theAnim = fwdx918
|
|
51
|
-
else if (AS.name === 'fwdx1827') theAnim = fwdx1827
|
|
52
|
-
else if (AS.name === 'fwdx2736') theAnim = fwdx2736
|
|
53
|
-
else if (AS.name === 'fwdy018') theAnim = fwdy018
|
|
54
|
-
else if (AS.name === 'fwdy1836') theAnim = fwdy1836
|
|
55
|
-
else if (AS.name === 'fwdy09') theAnim = fwdy09
|
|
56
|
-
else if (AS.name === 'fwdy918') theAnim = fwdy918
|
|
57
|
-
else if (AS.name === 'fwdy1827') theAnim = fwdy1827
|
|
58
|
-
else if (AS.name === 'fwdy2736') theAnim = fwdy2736
|
|
59
|
-
else if (AS.name === 'floatX') theAnim = floatX
|
|
60
|
-
else if (AS.name === 'floatShadow') theAnim = floatShadow
|
|
61
|
-
else if (AS.name === 'pulseSM') theAnim = pulseSM
|
|
62
|
-
else if (AS.name === 'pulseMD') theAnim = pulseMD
|
|
63
|
-
else if (AS.name === 'pulseLG') theAnim = pulseLG
|
|
64
|
-
} else theAnim = noAnim
|
|
65
|
-
|
|
66
|
-
let AnimWrapDiv: any = styled.div``
|
|
67
|
-
if (AS) {
|
|
68
|
-
AnimWrapDiv = styled.div`
|
|
69
|
-
width: 100%;
|
|
70
|
-
height: 100%;
|
|
71
|
-
position: relative;
|
|
72
|
-
transform-style: preserve-3d;
|
|
73
|
-
border: ${AS.border || ''};
|
|
74
|
-
-webkit-animation-duration: ${AS.duration || 1}s;
|
|
75
|
-
animation-duration: ${AS.duration || 1}s;
|
|
76
|
-
-webkit-animation-iteration-count: ${AS.iterationCount || 1};
|
|
77
|
-
animation-iteration-count: ${AS.iterationCount || 1};
|
|
78
|
-
-webkit-animation-name: ${theAnim || 'noAnim'};
|
|
79
|
-
animation-name: ${theAnim || 'noAnim'};
|
|
80
|
-
-webkit-animation-fill-mode: ${AS.fillMode || 'forwards'};
|
|
81
|
-
animation-fill-mode: ${AS.fillMode || 'forwards'};
|
|
82
|
-
animation-direction: ${AS.direction || 'normal'};
|
|
83
|
-
-webkit-animation-direction: ${AS.direction || 'normal'};
|
|
84
|
-
-webkit-animation-timing-function: ${AS.timing || 'linear'};
|
|
85
|
-
animation-timing-function: ${AS.timing || 'linear'};
|
|
86
|
-
-webkit-animation-delay: ${AS.delay || 0}s;
|
|
87
|
-
animation-delay: ${AS.delay || 0}s;
|
|
88
|
-
`
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return <AnimWrapDiv>{children}</AnimWrapDiv>
|
|
92
|
-
}
|