Skip to content

Commit 790305b

Browse files
committed
Fixed styles of the animatable-cube component by adding missing css variables as props.
1 parent 5c8b71b commit 790305b

File tree

6 files changed

+58
-35
lines changed

6 files changed

+58
-35
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [1.1.5] - 2020-04-23
10+
### Fixed
11+
- Fixed styles of the `animatable-cube` component by adding missing css variables as props.
12+
- Adding [Credits](https://github.com/proyecto26/animatable-component#credits-) and [Enterprise](https://github.com/proyecto26/animatable-component#enterprise-) sections from **README**.
13+
- Improved demo by waiting `animatable-component` to be loaded as a custom element.
14+
915
## [1.1.4] - 2020-04-22
1016
### Fixed
1117
- Cancel current animation before to play another one, it's required to avoid issues when `iterations` was equal to `Infinity`.

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@proyecto26/animatable-component",
3-
"version": "1.1.4",
3+
"version": "1.1.5",
44
"private": false,
55
"description": "Animate once, use Everywhere! 💫",
66
"author": "Proyecto 26",

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const easingOutCubic = EASING_FUNCTIONS[EASING.EASE_OUT_CUBIC];
9999

100100
### Script tag
101101

102-
- Put a script tag similar to this `<script src='https://unpkg.com/[email protected].4/dist/animatable-component.js'></script>` in the head of your index.html
102+
- Put a script tag similar to this `<script src='https://unpkg.com/[email protected].5/dist/animatable-component.js'></script>` in the head of your index.html
103103
- Then you can use the element anywhere in your template, JSX, html etc
104104

105105
### Node Modules

src/components/animatable-cube/animatable-cube.css

+43-32
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
:host {
55
/**
66
* @prop --animatable-cube-size: Size of the cube
7+
* @prop --animatable-cube-width: Width of the cube
8+
* @prop --animatable-cube-height: Height of the cube
79
* @prop --animatable-cube-perspective: Perspective of the cube
810
* @prop --animatable-cube-perspective-origin: Indicates the position of the abscissa and the ordinate of the vanishing point.
911
* @prop --animatable-cube-display: Display of the cube
@@ -15,6 +17,9 @@
1517
* @prop --animatable-cube-justify-content: Justify content of the cube
1618
* @prop --animatable-cube-margin: Margin of the cube
1719
* @prop --animatable-cube-padding: Padding of the cube
20+
* @prop --animatable-cube-transform: Transform of the cube
21+
* @prop --animatable-cube-transform-origin: Transform origin of the cube
22+
* @prop --animatable-cube-animation: Animation of the cube
1823
*
1924
* @prop --animatable-cube-face-border: Cube faces border
2025
* @prop --animatable-cube-face-background: Cube faces background
@@ -25,6 +30,7 @@
2530
* @prop --animatable-cube-face-animation-delay: Defines when the background animation will start
2631
* @prop --animatable-cube-face-animation-iteration-count: Defines the number of times the background animation cycle is played
2732
* @prop --animatable-cube-face-animation-direction: Defines the direction of the background animation
33+
* @prop --animatable-cube-face-transform-origin: Establishes the origin of transformation for the cube faces
2834
*
2935
* @prop --animatable-cube-front-face-background: Background of the front face
3036
* @prop --animatable-cube-front-face-animation: Animation of the front face
@@ -40,7 +46,7 @@
4046
* @prop --animatable-cube-bottom-face-animation: Animation of the bottom face
4147
*/
4248

43-
--size: var(--animatable-cube-size, 100px);
49+
--size: var(--animatable-cube-size, var(--animatable-cube-width, var(--animatable-cube-height, 100px)));
4450
--perspective: var(--animatable-cube-perspective, 1000px);
4551
--perspective-origin: var(--animatable-cube-perspective-origin, 50% 50%);
4652

@@ -54,10 +60,10 @@
5460
--margin: var(--animatable-cube-margin, 0);
5561
--padding: var(--animatable-cube-padding, 0);
5662

57-
--border: var(--animatable-cube-face-border, none);
58-
--background: var(--animatable-cube-face-background, white);
59-
--background-size: var(--animatable-cube-face-background-size, 100% 100%);
60-
--animation: var(
63+
--face-border: var(--animatable-cube-face-border, none);
64+
--face-background: var(--animatable-cube-face-background, white);
65+
--face-background-size: var(--animatable-cube-face-background-size, 100% 100%);
66+
--face-animation: var(
6167
--animatable-cube-face-animation,
6268
backgroundAnimation
6369
var(--animatable-cube-face-animation-duration, 0s)
@@ -67,6 +73,9 @@
6773
var(--animatable-cube-face-animation-direction, alternate)
6874
);
6975

76+
--face-size: calc(var(--size)/2);
77+
--face-transform-origin: var(--animatable-cube-face-transform-origin, center center);
78+
7079
perspective: var(--perspective);
7180
perspective-origin: var(--perspective-origin);
7281
padding: var(--padding);
@@ -90,70 +99,72 @@
9099
position: relative;
91100
background: transparent;
92101
transform-style: preserve-3d;
93-
transform: translateZ(-calc(var(--size)/2));
102+
transform: var(--animatable-cube-transform, translateZ(-var(--face-size)));
103+
transform-origin: var(--animatable-cube-transform-origin, initial);
94104
transition: transform var(--transition-duration);
95105
}
96106
.face {
97-
background: var(--animatable-cube-face-background, transparent);
107+
background: var(--animatable-cube-face-background, var(--face-background));
98108
position: absolute;
99109
height: 100%;
100110
width: 100%;
101-
border: var(--border);
111+
border: var(--face-border);
102112
transition: transform var(--transition-duration);
113+
transform-origin: var(--face-transform-origin);
103114
}
104115
.front {
105116
transform:
106117
rotateY(0deg)
107-
translateZ(calc(var(--size)/2));
118+
translateZ(var(--face-size));
108119
will-change: transform;
109-
background: var(--animatable-cube-front-face-background, var(--background));
110-
background-size: var(--animatable-cube-front-face-background-size, var(--background-size));
111-
animation: var(--animatable-cube-front-face-animation, var(--animation));
120+
background: var(--animatable-cube-front-face-background, var(--face-background));
121+
background-size: var(--animatable-cube-front-face-background-size, var(--face-background-size));
122+
animation: var(--animatable-cube-front-face-animation, var(--face-animation));
112123
}
113124
.back {
114125
transform:
115126
rotateY(180deg)
116-
translateZ(calc(var(--size)/2));
127+
translateZ(var(--face-size));
117128
will-change: transform;
118-
background: var(--animatable-cube-back-face-background, var(--background));
119-
background-size: var(--animatable-cube-back-face-background-size, var(--background-size));
120-
animation: var(--animatable-cube-back-face-animation, var(--animation));
129+
background: var(--animatable-cube-back-face-background, var(--face-background));
130+
background-size: var(--animatable-cube-back-face-background-size, var(--face-background-size));
131+
animation: var(--animatable-cube-back-face-animation, var(--face-animation));
121132
}
122133
.right {
123134
transform:
124135
rotateY(90deg)
125-
translateZ(calc(var(--size)/2));
136+
translateZ(var(--face-size));
126137
will-change: transform;
127-
background: var(--animatable-cube-right-face-background, var(--background));
128-
background-size: var(--animatable-cube-right-face-background-size, var(--background-size));
129-
animation: var(--animatable-cube-right-face-animation, var(--animation));
138+
background: var(--animatable-cube-right-face-background, var(--face-background));
139+
background-size: var(--animatable-cube-right-face-background-size, var(--face-background-size));
140+
animation: var(--animatable-cube-right-face-animation, var(--face-animation));
130141
}
131142
.left {
132143
transform:
133144
rotateY(-90deg)
134-
translateZ(calc(var(--size)/2));
145+
translateZ(var(--face-size));
135146
will-change: transform;
136-
background: var(--animatable-cube-left-face-background, var(--background));
137-
background-size: var(--animatable-cube-left-face-background-size, var(--background-size));
138-
animation: var(--animatable-cube-left-face-animation, var(--animation));
147+
background: var(--animatable-cube-left-face-background, var(--face-background));
148+
background-size: var(--animatable-cube-left-face-background-size, var(--face-background-size));
149+
animation: var(--animatable-cube-left-face-animation, var(--face-animation));
139150
}
140151
.top {
141152
transform:
142153
rotateX(90deg)
143-
translateZ(calc(var(--size)/2));
154+
translateZ(var(--face-size));
144155
will-change: transform;
145-
background: var(--animatable-cube-top-face-background, var(--background));
146-
background-size: var(--animatable-cube-top-face-background-size, var(--background-size));
147-
animation: var(--animatable-cube-top-face-animation, var(--animation));
156+
background: var(--animatable-cube-top-face-background, var(--face-background));
157+
background-size: var(--animatable-cube-top-face-background-size, var(--face-background-size));
158+
animation: var(--animatable-cube-top-face-animation, var(--face-animation));
148159
}
149160
.bottom {
150161
transform:
151162
rotateX(-90deg)
152-
translateZ(calc(var(--size)/2));
163+
translateZ(var(--face-size));
153164
will-change: transform;
154-
background: var(--animatable-cube-bottom-face-background, var(--background));
155-
background-size: var(--animatable-cube-bottom-face-background-size, var(--background-size));
156-
animation: var(--animatable-cube-bottom-face-animation, var(--animation));
165+
background: var(--animatable-cube-bottom-face-background, var(--face-background));
166+
background-size: var(--animatable-cube-bottom-face-background-size, var(--face-background-size));
167+
animation: var(--animatable-cube-bottom-face-animation, var(--face-animation));
157168
}
158169

159170
/* Animation Keyframes */

src/components/animatable-cube/readme.md

+6
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ Type: `Promise<void>`
186186
| Name | Description |
187187
| -------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
188188
| `--animatable-cube-align-items` | Align items of the cube |
189+
| `--animatable-cube-animation` | Animation of the cube |
189190
| `--animatable-cube-back-face-animation` | Animation of the back face |
190191
| `--animatable-cube-back-face-background` | Background of the back face |
191192
| `--animatable-cube-bottom-face-animation` | Animation of the bottom face |
@@ -200,8 +201,10 @@ Type: `Promise<void>`
200201
| `--animatable-cube-face-background` | Cube faces background |
201202
| `--animatable-cube-face-background-size` | Cube faces background size |
202203
| `--animatable-cube-face-border` | Cube faces border |
204+
| `--animatable-cube-face-transform-origin` | Establishes the origin of transformation for the cube faces |
203205
| `--animatable-cube-front-face-animation` | Animation of the front face |
204206
| `--animatable-cube-front-face-background` | Background of the front face |
207+
| `--animatable-cube-height` | Height of the cube |
205208
| `--animatable-cube-justify-content` | Justify content of the cube |
206209
| `--animatable-cube-left-face-animation` | Animation of the left face |
207210
| `--animatable-cube-left-face-background` | Background of the left face |
@@ -214,10 +217,13 @@ Type: `Promise<void>`
214217
| `--animatable-cube-size` | Size of the cube |
215218
| `--animatable-cube-top-face-animation` | Animation of the top face |
216219
| `--animatable-cube-top-face-background` | Background of the top face |
220+
| `--animatable-cube-transform` | Transform of the cube |
221+
| `--animatable-cube-transform-origin` | Transform origin of the cube |
217222
| `--animatable-cube-transition-delay` | Defines when the transition of the cube will start |
218223
| `--animatable-cube-transition-duration` | Specifies the duration of the transition to resize the cube |
219224
| `--animatable-cube-transition-property` | Specifies the name of the CSS property the cube's transition effect is for |
220225
| `--animatable-cube-transition-timing-function` | Describes how the intermediate values used during the transition of the cube will be calculated |
226+
| `--animatable-cube-width` | Width of the cube |
221227

222228

223229
----------------------------------------------

0 commit comments

Comments
 (0)