Css transform perspective compatibility - css

I recently came across this pen on codepen https://codepen.io/joshnh/pen/paxbE
I have been playing around with this animation but am unable to get it working on any other browser other than chrome. I have tried all prefixes with transform and transitions. when I remove the perspective(500) property the animation works in firefox but not with the desired results. From what I've read it is something to do with the way chrome applies the perspective property to child elements differently than other browsers. Is there any work around to getting this type of animation working across all browsers?
This is what I have changed the css to in order to get it working in other browsers but nothing seems to help.
html {
height: 100%;
}
body {
position: absolute;
width: 100%;
height: 100%;
-moz-animation: myfade 5s;
-webkit-animation: myfade 5s;
animation: myfade 5s;
background: url("../img/screenbackground.jpg");
}
button {
position: absolute;
top: 0.6%;
margin-left: 2%;;
border: none;
background: #3a7999;
color: #f2f2f2;
padding: 10px;
font-size: 14px;
border-radius: 5px;
opacity: 0;
box-sizing: border-box;
-webkit-transition: all 500ms ease;
-moz-transition: all 500ms ease;
transition: all 500ms ease;
}
button:hover {
background: #000000;
color: #3a7999;
box-shadow: inset 0 0 0 3px #3a7999;
}
.imageWrapper {
background-color:transparent;
font-family: sans-serif;
font-size: 100%;
line-height: 20%;
margin: 0 auto;
padding: 1em;
width: 80%;
height: 60%;
margin-top: 3%;
}
figure {
float: left;
height: 12em;
margin: 3em;
margin-top: 1em;
margin-bottom: 0.5em;
width: 24em;
-webkit-transform: perspective(500);
-webkit-transform-style: preserve-3d;
-webkit-transition: .5s;
-moz-transform: perspective(500);
-moz-transform-style: preserve-3d;
-moz-transition: .5s;
transform: perspective(500);
transform-style: preserve-3d;
transition: .5s;
border-radius: 5px;
-webkit-animation: myflip;
-moz-animation: myflip;
-ms-animation: myflip;
animation: myflip 5s;
}
figure:hover {
-webkit-transform: perspective(500) rotateX(90deg) translateY(-48px)
translateZ(60px);
-moz-transform: perspective(500) rotateX(90deg) translateY(-48px)
translateZ(60px);
-ms-transform: perspective(500) rotateX(90deg) translateY(-48px)
translateZ(60px);
transform: perspective(500) rotateX(90deg) translateY(-48px)
translateZ(60px);
}
img {
background-color: #222;
box-shadow: 0 40px 30px -20px hsla(0,0%,0%,.25);
display: block;
height: 100%;
-webkit-transition: .5s;
-moz-transition: .5s;
transition: .5s;
}
figure:hover img {
box-shadow: none;
}
figcaption {
background-color: #222;
color: #fff;
padding: 1.5em;
-webkit-transform: rotateX(-90deg);
-webkit-transform-origin: 100% 0;
-webkit-transition: .5s;
-moz-transform: rotateX(-90deg);
-moz-transform-origin: 100% 0;
-moz-transition: .5s;
transform: rotateX(-90deg);
transform-origin: 100% 0;
transition: .5s;
}
figure:hover figcaption {
box-shadow: 0 20px 15px -10px hsla(0,0%,0%,.25);
}
h3 {
font-weight: bold;
}
#-webkit-keyframes myflip {
0% {
-webkit-transform: perspective(500) rotateX(90deg) translateZ(60px);
-moz-transform: perspective(500) rotateX(90deg) translateZ(60px);
-ms-transform: perspective(500) rotateX(90deg) translateZ(60px);
transform: perspective(500) rotateX(90deg) translateZ(60px);
}
50% {
-webkit-transform: perspective(500) rotateX(90deg) translateZ(60px);
-moz-transform: perspective(500) rotateX(90deg) translateZ(60px);
-ms-transform: perspective(500) rotateX(90deg) translateZ(60px);
transform: perspective(500) rotateX(90deg) translateZ(60px);
}
80% {
-webkit-transform: perspective(500) rotateX(90deg)
translateZ(60px);
-moz-transform: perspective(500) rotateX(90deg) translateZ(60px);
-ms-transform: perspective(500) rotateX(90deg) translateZ(60px);
transform: perspective(500) rotateX(90deg) translateZ(60px);
}
100% {
}
}
#-moz-keyframes myflip {
0% {
-webkit-transform: perspective(500) rotateX(90deg) translateZ(60px);
-moz-transform: perspective(500) rotateX(90deg) translateZ(60px);
-ms-transform: perspective(500) rotateX(90deg) translateZ(60px);
transform: perspective(500) rotateX(90deg) translateZ(60px);
}
50% {
-webkit-transform: perspective(500) rotateX(90deg) translateZ(60px);
-moz-transform: perspective(500) rotateX(90deg) translateZ(60px);
-ms-transform: perspective(500) rotateX(90deg) translateZ(60px);
transform: perspective(500) rotateX(90deg) translateZ(60px);
}
80% {
-webkit-transform: perspective(500) rotateX(90deg)
translateZ(60px);
-moz-transform: perspective(500) rotateX(90deg) translateZ(60px);
-ms-transform: perspective(500) rotateX(90deg) translateZ(60px);
transform: perspective(500) rotateX(90deg) translateZ(60px);
}
100% {
}
}
#keyframes myflip {
0% {
-webkit-transform: perspective(500) rotateX(90deg) translateZ(60px);
-moz-transform: perspective(500) rotateX(90deg) translateZ(60px);
-ms-transform: perspective(500) rotateX(90deg) translateZ(60px);
transform: perspective(500) rotateX(90deg) translateZ(60px);
}
50% {
-webkit-transform: perspective(500) rotateX(90deg) translateZ(60px);
-moz-transform: perspective(500) rotateX(90deg) translateZ(60px);
-ms-transform: perspective(500) rotateX(90deg) translateZ(60px);
transform: perspective(500) rotateX(90deg) translateZ(60px);
}
80% {
-webkit-transform: perspective(500) rotateX(90deg)
translateZ(60px);
-moz-transform: perspective(500) rotateX(90deg) translateZ(60px);
-ms-transform: perspective(500) rotateX(90deg) translateZ(60px);
transform: perspective(500) rotateX(90deg) translateZ(60px);
}
100% {
}
}
#-ms-keyframes myflip {
0% {
-webkit-transform: perspective(500) rotateX(90deg) translateZ(60px);
-moz-transform: perspective(500) rotateX(90deg) translateZ(60px);
-ms-transform: perspective(500) rotateX(90deg) translateZ(60px);
transform: perspective(500) rotateX(90deg) translateZ(60px);
}
50% {
-webkit-transform: perspective(500) rotateX(90deg) translateZ(60px);
-moz-transform: perspective(500) rotateX(90deg) translateZ(60px);
-ms-transform: perspective(500) rotateX(90deg) translateZ(60px);
transform: perspective(500) rotateX(90deg) translateZ(60px);
}
80% {
-webkit-transform: perspective(500) rotateX(90deg)
translateZ(60px);
-moz-transform: perspective(500) rotateX(90deg) translateZ(60px);
-ms-transform: perspective(500) rotateX(90deg) translateZ(60px);
transform: perspective(500) rotateX(90deg) translateZ(60px);
}
100% {
}
}
#-webkit-keyframes myfade {
0% {
opacity: 0;
}
100% {
opacity 1;
}
}
#-moz-keyframes myfade {
0% {
opacity: 0;
}
100% {
opacity 1;
}
}
#keyframes myfade {
0% {
opacity: 0;
}
100% {
opacity 1;
}
}

The CSS perspective property accepts length as parameter, which means you should use a unit like px.
Also, in order to see your pen working in Firefox, you should add the vendor-prefix-free version of the -webkit properties you're using and add a unit to the perspective property, like in perspective(500px). See modified pen.

Related

Trying to make this Carousel responsive

I made this CSS carousel after following a tutorial online and realized it wasn't responsive. I have tried resizing the images how ever, it doesn't effect the actual carousel, I tried adding bootstrap to see if it would help but no luck. to clarify I am trying to make the size of the carousel responsive, I have already made the images responsive. I really like the look of this carousel and would like to use it for my porfolio. any suggestions?
#wrappercarousel {
perspective: 2500;
-webkit-perspective: 2500;
width: 1000px;
margin:60px 0 40 auto;
perspective-origin: 50% 150px;
-webkit-perspective-origin: 50% 150px;
-webkit-transition: 1s, -webkit-perspective;
transition: 1s, -webkit-perspective;
-o-transition: perspective, 1s;
transition: perspective, 1s;
transition: perspective, 1s, -webkit-perspective;
-o-transition: -o-perspective, 1s;
-moz-transition: -moz-perspective, 1s;
-webkit-transition: -webkit-perspective, 1s;
}
#-webkit-keyframes spin {
from {
transform: rotateY(0);
-o-transform: rotateY(0);
-ms-transform: rotateY(0);
-moz-transform: rotateY(0);
-webkit-transform: rotateY(0);
}
to {
transform: rotateY(-360deg);
-o-transform: rotateY(-360deg);
-ms-transform: rotateY(-360deg);
-moz-transform: rotateY(-360deg);
-webkit-transform: rotateY(-360deg);
}
}
#image {
margin: 0 auto;
height: 300px;
width: 400px;
transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
animation: spin 24s infinite linear;
-moz-animation: spin 24s infinite linear;
-o-animation: spin 24s infinite linear;
-webkit-animation: spin 24s infinite linear;
}
.image {
position: absolute;
height: 300px;
width: 400px;
border-radius: 25px;
background-color: rgba(0,0,0,0.6);
text-align: center;
font-size: 20em;
color: #fff;
}
#image > .i1 {
transform: translateZ(485px);
-moz-transform: translateZ(485px);
-o-transform: translateZ(485px);
-ms-transform: translateZ(485px);
-webkit-transform: translateZ(500px);
-webkit-perspective: 2500px;
perspective: 2500px;
}
#image > .i2 {
transform: rotateY(45deg) translateZ(485px);
-moz-transform: rotateY(45deg) translateZ(485px);
-o-transform: rotateY(45deg) translateZ(485px);
-ms-transform: rotateY(45deg) translateZ(485px);
-webkit-transform: rotateY(45deg) translateZ(500px);
}
#image > .i3 {
transform: rotateY(90deg) translateZ(485px);
-moz-transform: rotateY(90deg) translateZ(485px);
-o-transform: rotateY(90deg) translateZ(485px);
-ms-transform: rotateY(90deg) translateZ(485px);
-webkit-transform: rotateY(90deg) translateZ(500px);
}
#image > .i4 {
transform: rotateY(135deg) translateZ(485px);
-moz-transform: rotateY(135deg) translateZ(485px);
-o-transform: rotateY(135deg) translateZ(485px);
-ms-transform: rotateY(135deg) translateZ(485px);
-webkit-transform: rotateY(135deg) translateZ(500px);
}
#image > .i5 {
transform: rotateY(180deg) translateZ(485px);
-moz-transform: rotateY(180deg) translateZ(485px);
-o-transform: rotateY(180deg) translateZ(485px);
-ms-transform: rotateY(180deg) translateZ(485px);
-webkit-transform: rotateY(180deg) translateZ(500px);
}
#image > .i6 {
transform: rotateY(225deg) translateZ(485px);
-moz-transform: rotateY(225deg) translateZ(485px);
-o-transform: rotateY(225deg) translateZ(485px);
-ms-transform: rotateY(225deg) translateZ(485px);
-webkit-transform: rotateY(225deg) translateZ(500px);
}
#image > .i7 {
transform: rotateY(270deg) translateZ(485px);
-moz-transform: rotateY(270deg) translateZ(485px);
-o-transform: rotateY(270deg) translateZ(485px);
-ms-transform: rotateY(270deg) translateZ(485px);
-webkit-transform: rotateY(270deg) translateZ(500px);
}
#image > .i8 {
transform: rotateY(315deg) translateZ(485px);
-moz-transform: rotateY(315deg) translateZ(485px);
-o-transform: rotateY(315deg) translateZ(485px);
-ms-transform: rotateY(315deg) translateZ(485px);
-webkit-transform: rotateY(315deg) translateZ(500px);
}
#image > .i9 {
transform: rotateY(360deg) translateZ(485px);
-moz-transform: rotateY(360deg) translateZ(485px);
-o-transform: rotateY(360deg) translateZ(485px);
-ms-transform: rotateY(360deg) translateZ(485px);
-webkit-transform: rotateY(360deg) translateZ(500px);
}
#image img{
height: 300px;
width: 400px;
margin-bottom: 0px;
}
img {
border-radius: 1px;
}
<div class= "animated fadeIn " id="wrappercarousel">
<div id="image">
<div class="image i1"><img src="/images/carousel/oliver%20people.jpg"></div>
<div class="image i2"><img src="/images/carousel/newmaui.jpg"></div>
<div class="image i3"><img src="/images/carousel/Theo1.jpg"></div>
<div class="image i4"><img src="/images/carousel/Sunday%20Somewhere.jpg"></div>
<div class="image i5"><img src="images/carousel/oliver%20people.jpg"></div>
<div class="image i6"><img src="images/carousel/newmaui.jpg"></div>
<div class="image i7"><img src="images/carousel/Theo1.jpg"></div>
<div class="image i8"><img src="images/carousel/Sunday%20Somewhere.jpg"></div>
</div>
</div>
#wrappercarousel {
perspective: 2500;
-webkit-perspective: 2500;
max-width: 1000px;
width:80%;
margin:6% 0 4% auto;
perspective-origin: 50% 150px;
-webkit-perspective-origin: 50% 150px;
-webkit-transition: 1s, -webkit-perspective;
transition: 1s, -webkit-perspective;
-o-transition: perspective, 1s;
transition: perspective, 1s;
transition: perspective, 1s, -webkit-perspective;
-o-transition: -o-perspective, 1s;
-moz-transition: -moz-perspective, 1s;
-webkit-transition: -webkit-perspective, 1s;
}
#image img{
height: 300px;
max-width: 400px;
width:100%;
margin-bottom: 0px;
}
This should work
You made a common mistake applying width in pixel
Pixel in img's
Pixel will most of the time fail to add up responsive
Thanks for the fiddle
i have edited and fix , hope this one helps you
#wrappercarousel {
perspective: 2500px;
-webkit-perspective: 2500px;
width: 100%;
margin: 0 auto;
perspective-origin: 50% 150px;
-webkit-perspective-origin: 50% 150px;
-webkit-transition: 1s, -webkit-perspective;
transition: 1s, -webkit-perspective;
-o-transition: perspective, 1s;
transition: perspective, 1s;
transition: perspective, 1s, -webkit-perspective;
-o-transition: -o-perspective, 1s;
-moz-transition: -moz-perspective, 1s;
-webkit-transition: -webkit-perspective, 1s;
overflow-x: hidden;
}
#-webkit-keyframes spin {
from {
transform: rotateY(0);
-o-transform: rotateY(0);
-ms-transform: rotateY(0);
-moz-transform: rotateY(0);
-webkit-transform: rotateY(0);
}
to {
transform: rotateY(-360deg);
-o-transform: rotateY(-360deg);
-ms-transform: rotateY(-360deg);
-moz-transform: rotateY(-360deg);
-webkit-transform: rotateY(-360deg);
}
}
#image {
margin: 0 auto;
height: 300px;
width: 50%;
transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
animation: spin 24s infinite linear;
-moz-animation: spin 24s infinite linear;
-o-animation: spin 24s infinite linear;
-webkit-animation: spin 24s infinite linear;
}
.image {
position: absolute;
height: 100%;
width: 50%;
border-radius: 25px;
background-color: rgba(0, 0, 0, 0.6);
text-align: center;
font-size: 20em;
color: #fff;
overflow:hidden
}
#image>.i1 {
transform: translateZ(185px);
-moz-transform: translateZ(185px);
-o-transform: translateZ(185px);
-ms-transform: translateZ(185px);
-webkit-transform: translateZ(185px);
-webkit-perspective: 2500px;
perspective: 2500px;
}
#image>.i2 {
transform: rotateY(45deg) translateZ(185px);
-moz-transform: rotateY(45deg) translateZ(185px);
-o-transform: rotateY(45deg) translateZ(185px);
-ms-transform: rotateY(45deg) translateZ(185px);
-webkit-transform: rotateY(45deg) translateZ(185px);
}
#image>.i3 {
transform: rotateY(90deg) translateZ(185px);
-moz-transform: rotateY(90deg) translateZ(185px);
-o-transform: rotateY(90deg) translateZ(185px);
-ms-transform: rotateY(90deg) translateZ(185px);
-webkit-transform: rotateY(90deg) translateZ(185px);
}
#image>.i4 {
transform: rotateY(135deg) translateZ(185px);
-moz-transform: rotateY(135deg) translateZ(185px);
-o-transform: rotateY(135deg) translateZ(185px);
-ms-transform: rotateY(135deg) translateZ(185px);
-webkit-transform: rotateY(135deg) translateZ(185px);
}
#image>.i5 {
transform: rotateY(180deg) translateZ(185px);
-moz-transform: rotateY(180deg) translateZ(185px);
-o-transform: rotateY(180deg) translateZ(185px);
-ms-transform: rotateY(180deg) translateZ(185px);
-webkit-transform: rotateY(180deg) translateZ(185px);
}
#image>.i6 {
transform: rotateY(225deg) translateZ(185px);
-moz-transform: rotateY(225deg) translateZ(185px);
-o-transform: rotateY(225deg) translateZ(185px);
-ms-transform: rotateY(225deg) translateZ(185px);
-webkit-transform: rotateY(225deg) translateZ(185px);
}
#image>.i7 {
transform: rotateY(270deg) translateZ(185px);
-moz-transform: rotateY(270deg) translateZ(185px);
-o-transform: rotateY(270deg) translateZ(185px);
-ms-transform: rotateY(270deg) translateZ(185px);
-webkit-transform: rotateY(270deg) translateZ(185px);
}
#image>.i8 {
transform: rotateY(315deg) translateZ(185px);
-moz-transform: rotateY(315deg) translateZ(185px);
-o-transform: rotateY(315deg) translateZ(185px);
-ms-transform: rotateY(315deg) translateZ(185px);
-webkit-transform: rotateY(315deg) translateZ(185px);
}
#image>.i9 {
transform: rotateY(360deg) translateZ(185px);
-moz-transform: rotateY(360deg) translateZ(185px);
-o-transform: rotateY(360deg) translateZ(185px);
-ms-transform: rotateY(360deg) translateZ(185px);
-webkit-transform: rotateY(360deg) translateZ(185px);
}
#image img {
height: 100%;
width: 100%;
margin-bottom: 0px;
}
img {
border-radius: 1px;
}
<div class="animated fadeIn " id="wrappercarousel">
<div id="image">
<div class="image i1"><img src="/images/carousel/oliver%20people.jpg"></div>
<div class="image i2"><img src="/images/carousel/newmaui.jpg"></div>
<div class="image i3"><img src="/images/carousel/Theo1.jpg"></div>
<div class="image i4"><img src="/images/carousel/Sunday%20Somewhere.jpg"></div>
<div class="image i5"><img src="images/carousel/oliver%20people.jpg"></div>
<div class="image i6"><img src="images/carousel/newmaui.jpg"></div>
<div class="image i7"><img src="images/carousel/Theo1.jpg"></div>
<div class="image i8"><img src="images/carousel/Sunday%20Somewhere.jpg"></div>
</div>
</div>

CSS animation not working in IE11 and Edge

I have tried putting my keyframes at the top of my CSS, not in the media query, http-equiv set to IE=Edge, etc.
It's a fairly basic .png image used during website load with simple rotate/y animation shown in this fiddle code below.
.loader-background {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 99999999;
background-color: #eef0eb;
}
.loader {
position: absolute;
height: 50px;
width: auto;
top: calc(50% - 25px);
left: calc(50% - 25px);
-webkit-animation-name: loader-animate;
-webkit-animation-duration: 5s;
-webkit-animation-iteration-count: infinite;
animation-name: loader-animate;
animation-duration: 5s;
animation-iteration-count: infinite;
}
#-webkit-keyframes loader-animate {
25% {
-webkit-transform: rotatey(360deg);
transform: rotatey(360deg);
}
50% {
-webkit-transform: rotatex(360deg);
transform: rotatex(360deg);
}
75% {
-webkit-transform: rotatey(0deg);
transform: rotatey(0deg);
}
100% {
-webkit-transform: rotatex(0deg);
transform: rotatex(0deg);
}
}
#keyframes loader-animate {
25% {
-webkit-transform: rotatey(360deg);
transform: rotatey(360deg);
}
50% {
-webkit-transform: rotatex(360deg);
transform: rotatex(360deg);
}
75% {
-webkit-transform: rotatey(0deg);
transform: rotatey(0deg);
}
100% {
-webkit-transform: rotatex(0deg);
transform: rotatex(0deg);
}
}
<div class="loader-background">
<img src="https://s30.postimg.org/7dct7bspd/GTG_FB_Logo.png" class="loader"/>
</div>
Works perfectly in Chrome and FF but not in Edge and IE11.
simply use rotate(..)
Animation will be a little different, but it will work
OK, so I figured it myself. You need to set the x and y rotation in every stage definition of the keyframe. Chrome obviously does better at filling in the blanks... revised fiddle
#-webkit-keyframes loader-animate {
0% {
-webkit-transform: rotatex(0deg) rotatey(0deg);
transform: rotatex(0deg) rotatey(0deg);
}
25% {
-webkit-transform: rotatex(0deg) rotatey(360deg);
transform: rotatex(0deg) rotatey(360deg);
}
50% {
-webkit-transform: rotatex(360deg) rotatey(360deg);
transform: rotatex(360deg) rotatey(360deg);
}
75% {
-webkit-transform: rotatex(360deg) rotatey(0deg);
transform: rotatex(360deg) rotatey(0deg);
}
100% {
-webkit-transform: rotatex(0deg) rotatey(0deg);
transform: rotatex(0deg) rotatey(0deg);
}
}
#keyframes loader-animate {
0% {
-webkit-transform: rotatex(0deg) rotatey(0deg);
transform: rotatex(0deg) rotatey(0deg);
}
25% {
-webkit-transform: rotatex(0deg) rotatey(360deg);
transform: rotatex(0deg) rotatey(360deg);
}
50% {
-webkit-transform: rotatex(360deg) rotatey(360deg);
transform: rotatex(360deg) rotatey(360deg);
}
75% {
-webkit-transform: rotatex(360deg) rotatey(0deg);
transform: rotatex(360deg) rotatey(0deg);
}
100% {
-webkit-transform: rotatex(0deg) rotatey(0deg);
transform: rotatex(0deg) rotatey(0deg);
}
}

CSS animation not working when directly copied from demo

I am trying to use a CSS (buzz out) animation as can be seen here.
Works perfectly in the demo, I have copied the relevant CSS and can't get it to work on a website so I even made a simple jsFiddle and it still doesn't work.
Please can someone point out what I am evidently missing as this is all the CSS seems to contain and I am a bit baffled to how it is working with the same style declaration on the demo but not in the jsFiddle.
Code snippet included below as well as at jsFiddle.
[class^="hvr-"] {
/* display: inline-block; */
/* vertical-align: middle; */
margin: .4em;
padding: 1em;
cursor: pointer;
background: #e1e1e1;
text-decoration: none;
color: #666;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
.hvr-buzz-out {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
}
.hvr-buzz-out:hover, .hvr-buzz-out:focus, .hvr-buzz-out:active {
-webkit-animation-name: hvr-buzz-out;
animation-name: hvr-buzz-out;
-webkit-animation-duration: 0.75s;
animation-duration: 0.75s;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-iteration-count: 1;
animation-iteration-count: 1;
}
Buzz Out
You also need the #keyframes that define the animation:
#-webkit-keyframes hvr-buzz-out {
10% {
-webkit-transform: translateX(3px) rotate(2deg);
transform: translateX(3px) rotate(2deg);
}
20% {
-webkit-transform: translateX(-3px) rotate(-2deg);
transform: translateX(-3px) rotate(-2deg);
}
30% {
-webkit-transform: translateX(3px) rotate(2deg);
transform: translateX(3px) rotate(2deg);
}
40% {
-webkit-transform: translateX(-3px) rotate(-2deg);
transform: translateX(-3px) rotate(-2deg);
}
50% {
-webkit-transform: translateX(2px) rotate(1deg);
transform: translateX(2px) rotate(1deg);
}
60% {
-webkit-transform: translateX(-2px) rotate(-1deg);
transform: translateX(-2px) rotate(-1deg);
}
70% {
-webkit-transform: translateX(2px) rotate(1deg);
transform: translateX(2px) rotate(1deg);
}
80% {
-webkit-transform: translateX(-2px) rotate(-1deg);
transform: translateX(-2px) rotate(-1deg);
}
90% {
-webkit-transform: translateX(1px) rotate(0);
transform: translateX(1px) rotate(0);
}
100% {
-webkit-transform: translateX(-1px) rotate(0);
transform: translateX(-1px) rotate(0);
}
}
#keyframes hvr-buzz-out {
10% {
-webkit-transform: translateX(3px) rotate(2deg);
transform: translateX(3px) rotate(2deg);
}
20% {
-webkit-transform: translateX(-3px) rotate(-2deg);
transform: translateX(-3px) rotate(-2deg);
}
30% {
-webkit-transform: translateX(3px) rotate(2deg);
transform: translateX(3px) rotate(2deg);
}
40% {
-webkit-transform: translateX(-3px) rotate(-2deg);
transform: translateX(-3px) rotate(-2deg);
}
50% {
-webkit-transform: translateX(2px) rotate(1deg);
transform: translateX(2px) rotate(1deg);
}
60% {
-webkit-transform: translateX(-2px) rotate(-1deg);
transform: translateX(-2px) rotate(-1deg);
}
70% {
-webkit-transform: translateX(2px) rotate(1deg);
transform: translateX(2px) rotate(1deg);
}
80% {
-webkit-transform: translateX(-2px) rotate(-1deg);
transform: translateX(-2px) rotate(-1deg);
}
90% {
-webkit-transform: translateX(1px) rotate(0);
transform: translateX(1px) rotate(0);
}
100% {
-webkit-transform: translateX(-1px) rotate(0);
transform: translateX(-1px) rotate(0);
}
}
[class^="hvr-"] {
/* display: inline-block; */
/* vertical-align: middle; */
margin: .4em;
padding: 1em;
cursor: pointer;
background: #e1e1e1;
text-decoration: none;
color: #666;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
.hvr-buzz-out {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
}
.hvr-buzz-out:hover, .hvr-buzz-out:focus, .hvr-buzz-out:active {
-webkit-animation-name: hvr-buzz-out;
animation-name: hvr-buzz-out;
-webkit-animation-duration: 0.75s;
animation-duration: 0.75s;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-iteration-count: 1;
animation-iteration-count: 1;
}
Buzz Out
They were also in the CSS file above the code you already had.

CSS3 Animations cutting to the end on webkit

I'm here again with another webkit css3 animation problem. I've tried absolutely everything, even over-defining CSS properties.
The problem I'm having is the hover animations are cutting to the end when hovering in and out on webkit. It also has some strangeness when activating and deactivating where it seems to remember old values and try to animate to them.
I'm wondering whether I'm just missing something here, or Chrome is just incredibly buggy recently. Here is an example:
$(".offcanvas").click(function() {
$('body').toggleClass('uk-offcanvas-page');
});
html,
body {
padding: 0;
margin: 0;
background: #de1b4a;
}
.center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
/* Bar */
header .offcanvas .bar {
display: inline-block;
position: relative;
width: 20px;
height: 2px;
margin: 8px 0 !important;
background: #fff;
-webkit-transform: rotateZ(0deg) translateX(0px);
-moz-transform: rotateZ(0deg) translateX(0px);
-ms-transform: rotateZ(0deg) translateX(0px);
-o-transform: rotateZ(0deg) translateX(0px);
transform: rotateZ(0deg) translateX(0px);
-webkit-transition: transform 500ms ease-in-out;
-moz-transition: transform 500ms ease-in-out;
-o-transition: transform 500ms ease-in-out;
transition: transform 500ms ease-in-out;
}
header .offcanvas .bar:before {
content: '';
display: block;
position: absolute;
top: 8px;
left: 0;
background: inherit;
width: inherit;
height: inherit;
-webkit-transform: rotateZ(0deg) translateX(0px);
-moz-transform: rotateZ(0deg) translateX(0px);
-ms-transform: rotateZ(0deg) translateX(0px);
-o-transform: rotateZ(0deg) translateX(0px);
transform: rotateZ(0deg) translateX(0px);
-webkit-transition: transform 500ms ease-in-out;
-moz-transition: transform 500ms ease-in-out;
-o-transition: transform 500ms ease-in-out;
transition: transform 500ms ease-in-out;
}
header .offcanvas .bar:after {
content: '';
display: block;
position: absolute;
bottom: 8px;
left: 0;
background: inherit;
width: inherit;
height: inherit;
-webkit-transform: rotateZ(0deg) translateX(0px);
-moz-transform: rotateZ(0deg) translateX(0px);
-ms-transform: rotateZ(0deg) translateX(0px);
-o-transform: rotateZ(0deg) translateX(0px);
transform: rotateZ(0deg) translateX(0px);
-webkit-transition: transform 500ms ease-in-out;
-moz-transition: transform 500ms ease-in-out;
-o-transition: transform 500ms ease-in-out;
transition: transform 500ms ease-in-out;
}
/* Bar Hover */
header .offcanvas:hover .bar {
-webkit-transform: rotateZ(0deg) translateX(-3px);
-moz-transform: rotateZ(0deg) translateX(-3px);
-ms-transform: rotateZ(0deg) translateX(-3px);
-o-transform: rotateZ(0deg) translateX(-3px);
transform: rotateZ(0deg) translateX(-3px);
}
header .offcanvas:hover .bar:before {
-webkit-transform: rotateZ(0deg) translateX(6px);
-moz-transform: rotateZ(0deg) translateX(6px);
-ms-transform: rotateZ(0deg) translateX(6px);
-o-transform: rotateZ(0deg) translateX(6px);
transform: rotateZ(0deg) translateX(6px);
}
header .offcanvas:hover .bar:after {
-webkit-transform: rotateZ(0deg) translateX(6px);
-moz-transform: rotateZ(0deg) translateX(6px);
-ms-transform: rotateZ(0deg) translateX(6px);
-o-transform: rotateZ(0deg) translateX(6px);
transform: rotateZ(0deg) translateX(6px);
}
/* Bar Close */
.uk-offcanvas-page header .offcanvas .bar,
.uk-offcanvas-page header.uk-active .offcanvas .bar {
background: rgba(0, 0, 0, 0);
}
.uk-offcanvas-page header .offcanvas:hover .bar {
-webkit-transform: rotateZ(0deg) translateX(0px);
-moz-transform: rotateZ(0deg) translateX(0px);
-ms-transform: rotateZ(0deg) translateX(0px);
-o-transform: rotateZ(0deg) translateX(0px);
transform: rotateZ(0deg) translateX(0px);
}
.uk-offcanvas-page header .offcanvas .bar:before {
-webkit-transform: rotateZ(45deg) translateX(-11px);
-moz-transform: rotateZ(45deg) translateX(-11px);
-ms-transform: rotateZ(45deg) translateX(-11px);
-o-transform: rotateZ(45deg) translateX(-11px);
transform: rotateZ(45deg) translateX(-11px);
background: #fff;
}
.uk-offcanvas-page header .offcanvas .bar:after {
-webkit-transform: rotateZ(-45deg) translateX(-11px);
-moz-transform: rotateZ(-45deg) translateX(-11px);
-ms-transform: rotateZ(-45deg) translateX(-11px);
-o-transform: rotateZ(-45deg) translateX(-11px);
transform: rotateZ(-45deg) translateX(-11px);
background: #fff;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="center">
<header>
<div class="offcanvas"><i class="bar"></i>
</div>
</header>
</div>
I've slowed down the animations so you can see it skipping, but hover in and out to see it.
I was wondering if anyone more advanced could help me on this one?
Thanks,
Tom

Create a rotating cube with ONLY CSS

I am working on a contest but I am having some difficulties. I need to create a cube (rotating) using only CSS. The only HTML code that I have to use is:
<div id="container">
<div id="imasters-cube">
<div class="front"></div>
<div class="back"></div>
<div class="top"></div>
<div class="right"></div>
<div class="bottom"></div>
<div class="left"></div>
</div>
</div>
I pasted an image so you can see the result that I need:
http://www.sitepor500.com.br/index.php?q=criacao-site-seo&a
So far I am using absoluted positioned elements to create the 6 faces but I have no idea how to make it rotate using only CSS. No JS, please!
Thank you so much
There are tons of tutorials/examples show how to do this: Example 1 Example 2 Example 3 Example 4 etc.
Pulled from Example 2:
.spinner div {
position: absolute;
width: 120px;
height: 120px;
border: 1px solid #ccc;
background: rgba(255,255,255,0.8);
box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
text-align: center;
line-height: 120px;
font-size: 100px;
}
.spinner .face1 {
-webkit-transform: translateZ(60px);
-ms-transform: translateZ(60px);
transform: translateZ(60px);
}
.spinner .face2 {
-webkit-transform: rotateY(90deg) translateZ(60px);
-ms-transform: rotateY(90deg) translateZ(60px);
transform: rotateY(90deg) translateZ(60px);
}
.spinner .face3 {
-webkit-transform: rotateY(90deg) rotateX(90deg) translateZ(60px);
-ms-transform: rotateY(90deg) rotateX(90deg) translateZ(60px);
transform: rotateY(90deg) rotateX(90deg) translateZ(60px);
}
.spinner .face4 {
-webkit-transform: rotateY(180deg) rotateZ(90deg) translateZ(60px);
-ms-transform: rotateY(180deg) rotateZ(90deg) translateZ(60px);
transform: rotateY(180deg) rotateZ(90deg) translateZ(60px);
}
.spinner .face5 {
-webkit-transform: rotateY(-90deg) rotateZ(90deg) translateZ(60px);
-ms-transform: rotateY(-90deg) rotateZ(90deg) translateZ(60px);
transform: rotateY(-90deg) rotateZ(90deg) translateZ(60px);
}
.spinner .face6 {
-webkit-transform: rotateX(-90deg) translateZ(60px);
-ms-transform: rotateX(-90deg) translateZ(60px);
transform: rotateX(-90deg) translateZ(60px);
}
.spinner {
-webkit-animation: spincube 12s ease-in-out infinite;
animation: spincube 12s ease-in-out infinite;
-webkit-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-transform-origin: 60px 60px 0;
-ms-transform-origin: 60px 60px 0;
transform-origin: 60px 60px 0;
}
#-webkit-keyframes spincube {
16% { -webkit-transform: rotateY(-90deg); }
33% { -webkit-transform: rotateY(-90deg) rotateZ(90deg); }
50% { -webkit-transform: rotateY(180deg) rotateZ(90deg); }
66% { -webkit-transform: rotateY(90deg) rotateX(90deg); }
83% { -webkit-transform: rotateX(90deg); }
}
#keyframes spincube {
16% { -ms-transform: rotateY(-90deg); transform: rotateY(-90deg); }
33% { -ms-transform: rotateY(-90deg) rotateZ(90deg); transform: rotateY(-90deg) rotateZ(90deg); }
50% { -ms-transform: rotateY(180deg) rotateZ(90deg); transform: rotateY(180deg) rotateZ(90deg); }
66% { -ms-transform: rotateY(90deg) rotateX(90deg); transform: rotateY(90deg) rotateX(90deg); }
83% { -ms-transform: rotateX(90deg); transform: rotateX(90deg); }
}
<div id="stage" style="width: 120px; height: 120px;">
<div class="spinner">
<div class="face1">1</div>
<div class="face2">2</div>
<div class="face3">3</div>
<div class="face4">4</div>
<div class="face5">5</div>
<div class="face6">6</div>
</div>
</div>

Resources