3d cube face rotation transform-origin misplaced - css

I have this 3d cube:
http://codepen.io/caemostajo/pen/yORNvx/
, the front and left faces open when click on the 2nd button.
As you can see the left face is misplaced, i can't place it where it belongs mantaining its open animation. it should look like this: http://www.f-lohmueller.de/pov_tut/backgrnd/im/CubeMappingWrapping_1d_64.gif
i have been trying with diferent translate3D and transform-origin values but no luck, think the problem is with the transform-origin of that face when the button is clicked.
I hope someone can help... best of bests!

To place the left face in the right position try to change the x-axis to -100% in .left-flip selector.
translate3d(-100%, 0, $cubeHeight / 2);

This will close the cube.
._3dface--left{
transform: rotateY(-270deg) translate3d(0%, 0, 75px);
}
To animate the other way do
._3dface--left{
transform: rotateY(90deg) translate3d(0%, 0, 75px);
}

I have changed:
.left-flip {
transition: all 0.85s cubic-bezier(0.175, 0.885, 0.32, 1.275);
transform-style: preserve-3d;
transform-origin: (0px) (0px) (-$cubeHeight / 2);
transform: rotateY(-90deg) translate3d(0%, 0, -$cubeHeight / 2);
}
and
#radio-rotate:checked ~ .space3d .left-flip {
transform: rotateY(-180deg) translate3d(0, 0, -$cubeHeight / 2);
}
The result is this

Related

Adding infinite translate and rotate (with different speeds) animations to one element

I'm trying to animate some shapes made with CSS-Doodle which will be a part of my background. Basically, I want them to always float around the screen and always rotate but I want the two animations at different speeds.
With the code below I can only get either one to work by switching around the order of chaining.
animation: spin #r(3s, 10s) infinite, flow #r(20s, 40s) infinite linear;
#keyframes flow {
0%, 100%{
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0)
}
50% {
-webkit-transform: translate3d(#r(-500%, 1000%), #r(-500%, 1000%), 0);
transform: translate3d(#r(-500%, 1000%), #r(-500%, 1000%), 0);
}
}
#keyframes spin {
from {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
I'm hoping there's a way for both of them to be applied at the same time even if it's not pure CSS.
There's probably a better way but the simplest solution would be to put a wrapper around the element so that the wrapper gets one animation and the actual element gets the other animation.

"full" transition behavior on Chrome when using rotate3d

.item {
transition: transform 1s linear;
transform: rotate3d(0, 0, 0, 0deg);
}
.item:hover {
transform: rotate3d(0, 0, 1, 450deg);
}
In the above example Chrome rotates .item a full 450 degrees. While Firefox, Edge, and Safari rotate between the beginning and end states resulting in a smaller 90 degree rotation.
This only seems to occur with rotate3d. Using rotateZ makes all browsers rotate the full 450.
Guessing this is a bug within Chrome? Does anyone know the spec well enough to confirm?
Demo on CodePen.

CSS animation Bug in Firefox

I have a CSS animation on a Website to make a hover effect on a button.
In Chrome and IE it lokes fine but in Firefox I got a ugly issue.
some White pieces still standing after hover.
Animation CSS:
.Hotel:hover{
animation-name: pulse;
animation-duration: 1s;
}
#-webkit-keyframes pulse {
from {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
50% {
-webkit-transform: scale3d(100.10, 10.10, 10.10);
transform: scale3d(100.10, 10.10, 10.10);
}
to {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
#keyframes pulse {
from {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
50% {
-webkit-transform: scale3d(1.80, 1.80, 1.80);
transform: scale3d(1.80, 1.80, 1.80);
}
to {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
Everything Looks fine it might be due to hardware acceleration settings not be on
Use hardware acceleration when available turned on .
Currently, browsers like Chrome, FireFox, Safari, IE9+ and the latest
version of Opera all ship with hardware acceleration; they only use it
when they have an indication that a DOM element would benefit from it.
With CSS, the strongest indication is that a 3D transformation is
being applied to an element.Since you have already that done your
then other than hardware acceleration turned on nothing seems to cause problem
its fine in my browser.
In Chrome and Safari we might see a flickering effect when using CSS transforms or animations. The following declarations can be used to fix the issue:
.className{
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-perspective: 1000;
-moz-perspective: 1000;
perspective: 1000;
/* Other transform properties here */
}
Another method that seems to work well in WebKit-powered desktop and mobile browsers is translate3d:
.className{
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
/* Other transform properties here */
}
Native mobile applications also make good use of the device GPU –– that’s why they’re known to perform slightly better than Web apps. Using hardware acceleration can be especially useful on mobile devices because it helps reduce resource consumption on the device.

Huge data IE, slow translate3d

Im using this plugin 'SidebarTransitions by codrops' for making a sidebar-menu..
For show/hiding the menu, its using this translate3d css
.st-effect-1.st-menu {
visibility: visible;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
.st-effect-1.st-menu-open .st-effect-1.st-menu {
visibility: visible;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
My problem is when i fill the site with alot of data, like 20000 rows in a table, the translate3d effect becomes really slow in IE (using 10 or 11 atm), takes like 5-10sec to do the effect and uses a 100% cpu core..
The same effect in Chrome appears instantly, why? what to tweek for IE to work?

CSS 3D animation not working correctly in IE11

This animation does not behave as I'd expect it to in IE11.
It should open like a book.
It was created in Google Web Designer (omitted large portions of the code for brevity).
JSFiddle (open in IE11)
However the following DOES work in Chrome (only difference is I've included the WebKit prefixes).
JSFiddle (open in Chrome)
Points of interest:
#keyframes mykeyframes {
0% { transform: translate3d(0px, 0px, 2px); }
100% { transform: matrix3d(-0.9998476952, 0, 0.0174524064, 0, 0, 1, 0, 0, -0.0174524064, 0, -0.9998476952, 0, 0, 0, 2, 1); }
}
Update
Just noticed that if you don't animate it "fully" (so it only swings open part way) then it works fine in IE11 - http://jsfiddle.net/e45q5/3/
Update2
I believe it's related to this bug: https://groups.google.com/forum/#!newtopic/gwdbeta/gwdbeta/EOKnHw5qXmk
I'm not able to debug a matrix3d value, but I can emulate the effect by editing your animation:
#keyframes mykeyframes {
0% { transform: rotateY(0deg); }
100% { transform: rotateY(-180deg); }
}
http://jsfiddle.net/e45q5/2/

Resources