CSS animation doesn't work as expected - css

I have this code: jsfiddle
The animation of the circle works fine in Firefox but fails to work smoothly in Chrome.
If I remove animation delay and duration from span element, like here, the circle is animated like it should.
What I'm doing wrong?
HTML:
<div class="box">
<div class="circle first">
<span>Lorem Ipsum</span>
</div>
</div>
CSS:
.circle {
position: absolute;
top: 50px;
left: 150px;
display: block;
border-radius: 50%;
-webkit-transition: box-shadow .25s;
transition: box-shadow .25s;
-webkit-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
// animation
-webkit-clip-path: circle(0 at 50% 50%);
clip-path: circle(0 at 50% 50%);
-webkit-animation-name: scale-up;
animation-name: scale-up;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-transition-timing-function: cubic-bezier(0, 0, .2, 1);
transition-timing-function: cubic-bezier(0, 0, .2, 1);
-webkit-animation-duration: 1s;
animation-duration: 1s;
background-color: #323232;
}
.circle span {
position: absolute;
top: 20px;
right: 50%;
display: block;
background-color: green;
padding: .4em .6em .3em;
webkit-transform: translateX(100%);
transform: translateX(100%);
-webkit-animation-name: slide-left;
animation-name: slide-left;
-webkit-animation-duration: 1.5s;
animation-duration: 1.5s;
-webkit-animation-delay: 1.5s;
animation-delay: 1.5s;
}
.first {
width: 17em;
height: 17em;
-webkit-animation-delay: .5s;
animation-delay: .5s;
box-shadow: 0 0 0 1.6em rgba(32, 32, 32, .1);
}
// Scale up
#-webkit-keyframes scale-up {
0% {
-webkit-clip-path: circle(0 at 50% 50%);
clip-path: circle(0 at 50% 50%);
}
99% {
-webkit-clip-path: circle(60% at 50% 50%);
clip-path: circle(60% at 50% 50%);
}
100% {
-webkit-clip-path: none;
clip-path: none;
}
}
#keyframes scale-up {
0% {
-webkit-clip-path: circle(0 at 50% 50%);
clip-path: circle(0 at 50% 50%);
}
99% {
-webkit-clip-path: circle(60% at 50% 50%);
clip-path: circle(60% at 50% 50%);
}
100% {
-webkit-clip-path: none;
clip-path: none;
}
}
#-webkit-keyframes slide-left {
0% {
-webkit-transform: translateX(100%);
transform: translateX(100%);
}
100% {
-webkit-transform: translateX(0);
transform: translateX(0);
}
}
#keyframes slide-left {
0% {
-webkit-transform: translateX(100%);
transform: translateX(100%);
}
100% {
-webkit-transform: translateX(0);
transform: translateX(0);
}
}

Hope I can help you with this solution: Actually, clip-path animation fails because of span that deforms the circle shape. A solution may be to extract span from its parent (circle) and move it directly into .box container. So, span become sibling of circle. Now, the circle clip-path recovered its regular shape. Then, by defining style to .box element, we also define a new container for the span that is able move following previous locations. here is the code: https://jsfiddle.net/nesquimo/jn3dnuhm/13/
.box{
position: relative;
top: 50px;
left: 150px;
width: 17em;
height: 17em;
}
.circle {
position: absolute;
display: block;
border-radius: 50%;
-webkit-transition: box-shadow .25s;
transition: box-shadow .25s;
-webkit-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
// animation
-webkit-clip-path: circle(0 at 50% 50%);
clip-path: circle(0 at 50% 50%);
-webkit-animation-name: scale-up;
animation-name: scale-up;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-transition-timing-function: cubic-bezier(0, 0, .2, 1);
transition-timing-function: cubic-bezier(0, 0, .2, 1);
-webkit-animation-duration: 1s;
animation-duration: 1s;
background-color: #323232;
}
.circle__band {
position: absolute;
top: 20px;
right: 50%;
opacity: 0;
display: block;
background-color: green;
padding: .4em .6em .3em;
transform: translate3D(100%, 0, 0);
animation-name: slide-left;
animation-fill-mode: forwards;
animation-duration: 1s;
animation-delay: 1.5s;
}
.first {
width: 17em;
height: 17em;
-webkit-animation-delay: .5s;
animation-delay: .5s;
box-shadow: 0 0 0 1.6em rgba(32, 32, 32, .1);
}
// Scale up
#-webkit-keyframes scale-up {
0% {
-webkit-clip-path: circle(0 at 50% 50%);
clip-path: circle(0 at 50% 50%);
}
99% {
-webkit-clip-path: circle(60% at 50% 50%);
clip-path: circle(60% at 50% 50%);
}
100% {
-webkit-clip-path: none;
clip-path: none;
}
}
#keyframes scale-up {
0% {
-webkit-clip-path: circle(0 at 50% 50%);
clip-path: circle(0 at 50% 50%);
}
99% {
-webkit-clip-path: circle(60% at 50% 50%);
clip-path: circle(60% at 50% 50%);
}
100% {
-webkit-clip-path: none;
clip-path: none;
}
}
// Slide left
#-webkit-keyframes slide-left {
0% {
opacity: 1;
transform: translate3D(100%,0,0);
}
100% {
opacity: 1;
transform: translate3D(0,0,0);
}
}
#keyframes slide-left {
0% {
opacity: 1;
transform: translate3D(100%,0,0);
}
100% {
opacity: 1;
transform: translate3D(0,0,0);
}
}
<div class="box">
<div class="circle first">
</div>
<span class="circle__band">Lorem Ipsum</span>
</div>

Related

CSS animation 'origin' for each <g>

Using CSS animation, I am adding a 'wobble' effect to each letter in a word. Each letter is made up of an SVG group <g>. However, as you can see in the example, the effect gets more extreme with each letter, whereas I want a consistent 'wobble' per letter (the same effect on each letter). How can this be acheived?
Note: I have not included the SVG source code, to keep the question tidy. It can be seen in the example if needed.
Thanks.
SCSS
// Logo
.logo {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
z-index: 1;
width: 260px;
display: block;
// SVG
svg {
display: block;
width: 100%;
overflow: visible;
g {
fill: transparent;
transition: all 300ms ease-in-out;
#keyframes wobble {
0% { transform: rotate(0) translate3d(0, 0, 0) }
25% { transform: rotate(2deg) translate3d(1px, 0, 0) }
50% { transform: rotate(-1deg) translate3d(0, -1px, 0) }
75% { transform: rotate(1deg) translate3d(-1px, 0, 0) }
100% { transform: rotate(-2deg) translate3d(-1px, -1px, 0) }
}
animation-duration: 400ms;
animation-iteration-count: infinite;
animation-fill-mode: none;
animation-name: wobble;
animation-timing-function: ease-in-out;
path {
fill: red;
}
}
}
}
Example
I could not figure out how to do it with SVGs - I did manage to come up with something similar to your requirement.
Part of the solution involved using a center point for the rotation:
transform-origin: center;
See demo below
#my-logo div {
display: inline-block;
color: red;
font-size: 60px;
font-family: arial;
font-weight: bolder;
text-transform: uppercase;
fill: transparent;
transition: all 300ms ease-in-out;
transform-origin: center;
animation-duration: 400ms;
animation-iteration-count: infinite;
animation-fill-mode: none;
animation-name: wobble;
animation-timing-function: ease-in-out;
}
#keyframes wobble {
0% {
transform: rotate(0) translate3d(0, 0, 0);
}
25% {
transform: rotate(2deg) translate3d(1px, 0, 0);
}
50% {
transform: rotate(-1deg) translate3d(0, -1px, 0);
}
75% {
transform: rotate(1deg) translate3d(-1px, 0, 0);
}
100% {
transform: rotate(-2deg) translate3d(-1px, -1px, 0);
}
}
<div id="my-logo">
<div>o</div>
<div>u</div>
<div>t</div>
<div>r</div>
<div>a</div>
<div>g</div>
<div>e</div>
<div>
<!-- also works with images -->
<img src="http://placekitten.com/100/100" />
</div>
</div>

How to animate a rolling rectangle

I'd like to animate a rectangle to roll from the left of the screen to the right of the screen. Please notice that the transform-origin point should not be in the center of the rectangle, but in the bottom-right corner, so that it doesn't overpass the "hr" line or bounce in any way.
This is what I have achieved untill now, but I'd like it to move continuously untill it gets to the right edge of the screen:
hr {
margin: 0;
}
div {
width: 135px;
height: 135px;
box-shadow: inset 0 0 10px #000000;
transform-origin: right bottom;
animation-name: move;
animation-duration: 2s;
animation-timing-function: linear;
animation-delay: 0;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#keyframes move {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(90deg);
}
}
<div></div>
<hr>
You need to change the transform origin as you go :
hr {
margin: 0;
}
div {
width: 135px;
height: 135px;
box-shadow: inset 0 0 10px #000000;
transform-origin: right bottom;
animation-name: move;
animation-duration: 12s;
animation-timing-function: linear;
animation-delay: 0;
animation-iteration-count: infinite;
animation-direction: alternate;
margin-top: 20px;
}
#keyframes move {
0% {
transform: rotate(0deg);
transform-origin: right bottom;
}
25% {
transform: rotate(90deg);
transform-origin: right bottom;
}
25.1% {
transform: translate(100%, 100%) rotate(90deg);
transform-origin: top right;
}
50% {
transform: translate(100%, 100%) rotate(180deg);
transform-origin: top right;
}
50.1% {
transform: translate(300%, 100%) rotate(180deg);
transform-origin: left top;
}
75% {
transform: translate(300%, 100%) rotate(270deg);
transform-origin: left top;
}
75.1% {
transform: translate(400%, 0%) rotate(270deg);
transform-origin: left bottom;
}
100% {
transform: translate(400%, 0%) rotate(360deg);
transform-origin: left bottom;
}
}
<div>TEST</div>
<hr>
Interesting, I would consider adding a translation and the trick is to switch fastly between two states to be able to continue the move.
You are rotating your element with 90deg which is equivalent in your case to a translation by the width of the element if we only consider the final state so switching fastly between both situation won't be visible and thus you can rotate your element again and repeat the same trick until your reach the needed position.
hr {
margin: 0;
}
div {
width: 135px;
height: 135px;
box-shadow: inset 0 0 10px #000000;
transform-origin: right bottom;
animation-name: move;
animation-duration: 4s;
animation-timing-function: linear;
animation-delay: 0;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#keyframes move {
0% {
transform: rotate(0deg);
}
25% {
transform: rotate(90deg);
}
25.01% {
transform: translateX(calc(1 * 135px)) rotate(0deg);
}
50% {
transform: translateX(calc(1 * 135px)) rotate(90deg);
}
50.01% {
transform: translateX(calc(2 * 135px)) rotate(0deg);
}
75% {
transform: translateX(calc(2 * 135px)) rotate(90deg);
}
75.01% {
transform: translateX(calc(3 * 135px)) rotate(0deg);
}
100% {
transform: translateX(calc(3 * 135px)) rotate(90deg);
}
}
<div></div>
<hr>

Animate child div after parent div has completed animation

I have 2 div ("a" and "b") I'm trying when div "a" slide Up and stop, div "b"
slide Up inside div "a".
<div id="a" class="animated slideInUp">
<div id="b" class="animated slideInUp"> </div>
</div>
Here is my JSFiddle
#a {
width: 100px;
height: 50px;
background-color: #000;
border-radius: 10px;
margin: 0 auto;
position: relative;
}
#b {
width: 100%;
height: 10px;
background-color: #860169;
position: absolute;
bottom: 0;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
.animated {
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.animated.infinite {
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
.animated.hinge {
-webkit-animation-duration: 2s;
animation-duration: 2s;
}
.animated.bounceIn,
.animated.bounceOut {
-webkit-animation-duration: .75s;
animation-duration: .75s;
}
.animated.flipOutX,
.animated.flipOutY {
-webkit-animation-duration: .75s;
animation-duration: .75s;
}
#-webkit-keyframes slideInUp {
from {
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 10%, 0);
transform: translate3d(0, 10%, 0);
}
}
#keyframes slideInUp {
from {
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 10%, 0);
transform: translate3d(0, 10%, 0);
}
}
.slideInUp {
-webkit-animation-name: slideInUp;
animation-name: slideInUp;
}
<div id="a" class="animated slideInUp">
<div id="b" class="animated slideInUpChild"> </div>
</div>
translate3d(0, y%, 0) will only translate the element in Y-axis by y% the height of the element. That is 100% would translate it by 10px (height of the child) and 10% would translate it by 1px. In addition you are positioning the element at the bottom of the parent and hence translating it by 1px (end state) is not going to have any visual effect.
You need to do the following changes to achieve the effect that you are looking for:
Use a different animation for the child element, which will move the element from bottom: 0px to bottom: calc(100% - 10px) (the minus 10px is for the height of the element). The first keyframe at bottom: 0px positions the element at the bottom of the container and then gradually move it to the top of the parent element.
Add an animation-delay to the child element that is equal to the animation-duration of parent element. This is required to make sure that the child element does not start animation before the parent element has reached the top.
Note that since you have border-radius set the to the child for the bottom-left and bottom-right, the element won't look nice once it has reached the top.
#a {
width: 100px;
height: 50px;
background-color: #000;
border-radius: 10px;
margin: 0 auto;
position: relative;
}
#b {
width: 100%;
height: 10px;
background-color: #860169;
position: absolute;
bottom: 0;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
.animated {
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.animated.infinite {
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
.animated.hinge {
-webkit-animation-duration: 2s;
animation-duration: 2s;
}
.animated.bounceIn,
.animated.bounceOut {
-webkit-animation-duration: .75s;
animation-duration: .75s;
}
.animated.flipOutX,
.animated.flipOutY {
-webkit-animation-duration: .75s;
animation-duration: .75s;
}
#-webkit-keyframes slideInUp {
from {
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 10%, 0);
transform: translate3d(0, 10%, 0);
}
}
#keyframes slideInUp {
from {
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 10%, 0);
transform: translate3d(0, 10%, 0);
}
}
.slideInUp {
-webkit-animation-name: slideInUp;
animation-name: slideInUp;
-webkit-animation-duration: 1s;
animation-duration: 1s;
}
.slideInUpChild {
-webkit-animation-name: slideInUpChild;
animation-name: slideInUpChild;
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
#-webkit-keyframes slideInUpChild {
from {
bottom: 0;
}
to {
bottom: calc(100% - 10px);
}
}
#keyframes slideInUpChild {
from {
bottom: 0;
}
to {
bottom: calc(100% - 10px);
}
}
<div id="a" class="animated slideInUp">
<div id="b" class="animated slideInUpChild"> </div>
</div>
One simple way to overcome the border-radius problem that I have mentioned above would be to do away with the border-radius and let the overflow: hidden setting on the parent take care of it.
#a {
width: 100px;
height: 50px;
background-color: #000;
border-radius: 10px;
margin: 0 auto;
position: relative;
overflow: hidden;
}
#b {
width: 100%;
height: 10px;
background-color: #860169;
position: absolute;
bottom: 0;
}
.animated {
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.animated.infinite {
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
.animated.hinge {
-webkit-animation-duration: 2s;
animation-duration: 2s;
}
.animated.bounceIn,
.animated.bounceOut {
-webkit-animation-duration: .75s;
animation-duration: .75s;
}
.animated.flipOutX,
.animated.flipOutY {
-webkit-animation-duration: .75s;
animation-duration: .75s;
}
#-webkit-keyframes slideInUp {
from {
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 10%, 0);
transform: translate3d(0, 10%, 0);
}
}
#keyframes slideInUp {
from {
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 10%, 0);
transform: translate3d(0, 10%, 0);
}
}
.slideInUp {
-webkit-animation-name: slideInUp;
animation-name: slideInUp;
-webkit-animation-duration: 1s;
animation-duration: 1s;
}
.slideInUpChild {
-webkit-animation-name: slideInUpChild;
animation-name: slideInUpChild;
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
#-webkit-keyframes slideInUpChild {
from {
bottom: 0;
}
to {
bottom: calc(100% - 10px);
}
}
#keyframes slideInUpChild {
from {
bottom: 0;
}
to {
bottom: calc(100% - 10px);
}
}
<div id="a" class="animated slideInUp">
<div id="b" class="animated slideInUpChild"> </div>
</div>

Creating this rotating animation using CSS

This is the animation I'd like to make using CSS.
It is an animated PNG. Firefox is the only browser I know that will show the animation. Please view this in FireFox so you can see the animation. I'd like to try and make it in CSS so I can use it in more browsers and still get true transparency (which animated gifs can't provide)
<-- Here is a single one of the dots, which could be used to make the animation without having to create the dot's shading in css.
This fiddle http://jsfiddle.net/jvrvK/ shows what I've got so far. I sorta have the look of the spheres, but the animation doesn't seem to work in Chrome and I don't understand CSS animations enough to create the same type of rotation in the PNG.
Thanks very much for any help!
Fiddle code below:
<ul class="busy">
<li class="busy-dot1"><b class="busy-dot-shine"></b></li>
<li class="busy-dot2"><b class="busy-dot-shine"></b></li>
<li class="busy-dot3"><b class="busy-dot-shine"></b></li>
<li class="busy-dot4"><b class="busy-dot-shine"></b></li>
<li class="busy-dot5"><b class="busy-dot-shine"></b></li>
</ul>
.busy {
list-style: none;
padding: 0;
position: relative;
transform-style: preserve-3d;
animation: rot 4s linear infinite;
width:100px;
}
.busy-dot1, .busy-dot2, .busy-dot3, .busy-dot4, .busy-dot5 {
border-radius: 50%;
display: inline-block;
transform-style: preserve-3d;
margin: 0 4px;
}
.busy-dot-shine {
display: block;
border-radius: 50%;
background: radial-gradient(circle at 25% 25%, #FFF, rgba(255,255,255,0));
background-color: #193987;
animation: rotr 4s linear infinite;
height: 20px;
width: 20px;
}
Chrome can be fussy about prefixes, add PrefixFree library to your code. You could add the prefixes yourself, but I find PreFix Free much easier.
//cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js
http://jsfiddle.net/adrianjmartin/jvrvK/2/
Another way would be to use SVG:
http://jsfiddle.net/adrianjmartin/AcvE5/3/
This would be an aproximate solution
demo
The HTML is the same that you had; the CSS is
.busy {
list-style: none;
padding: 0;
position: relative;
width:100px;
}
.busy-dot1, .busy-dot2, .busy-dot3, .busy-dot4, .busy-dot5 {
border-radius: 50%;
display: inline-block;
position: absolute;
left: 150px;
top: 50px;
-webkit-animation: rot 4s linear infinite;
animation: rot 4s linear infinite;
}
.busy-dot2 {
-webkit-animation-delay: -3.5s;
animation-delay: -3.5s;
}
.busy-dot3 {
-webkit-animation-delay: -3s;
animation-delay: -3s;
}
.busy-dot4 {
-webkit-animation-delay: -2.7s;
animation-delay: -2.7s;
}
.busy-dot-shine {
display: block;
border-radius: 50%;
background: radial-gradient(circle at 25% 25%, #FFF, rgba(255,255,255,0));
background-color: #193987;
height: 20px;
width: 20px;
}
.busy-dot2 .busy-dot-shine {
height: 15px;
width: 15px;
}
.busy-dot3 .busy-dot-shine {
height: 10px;
width: 10px;
}
.busy-dot4 .busy-dot-shine {
height: 6px;
width: 6px;
}
#-webkit-keyframes rot {
0% {-webkit-transform: scaleX(2) rotate(0deg) translateX(50px) scale(1) rotate(0deg) scaleX(0.5);
opacity: 0.5;}
25% {-webkit-transform: scaleX(2) rotate(90deg) translateX(50px) scale(1.5) rotate(-90deg) scaleX(0.5);
opacity: 0.8;}
50% {-webkit-transform: scaleX(2) rotate(180deg) translateX(50px) scale(1) rotate(-180deg) scaleX(0.5);
opacity: 0.5;}
75% {-webkit-transform: scaleX(2) rotate(270deg) translateX(50px) scale(0.8) rotate(-270deg) scaleX(0.5);
opacity: 0.2;}
100% {-webkit-transform: scaleX(2) rotate(360deg) translateX(50px) scale(1) rotate(-360deg) scaleX(0.5);
opacity: 0.5;}
}
#keyframes rot {
0% {transform: scaleX(2) rotate(0deg) translateX(50px) scale(1) rotate(0deg) scaleX(0.5);
opacity: 0.5;}
25% {transform: scaleX(2) rotate(90deg) translateX(50px) scale(1.5) rotate(-90deg) scaleX(0.5);
opacity: 0.8;}
50% {transform: scaleX(2) rotate(180deg) translateX(50px) scale(1) rotate(-180deg) scaleX(0.5);
opacity: 0.5;}
75% {transform: scaleX(2) rotate(270deg) translateX(50px) scale(0.8) rotate(-270deg) scaleX(0.5);
opacity: 0.2;}
100% {transform: scaleX(2) rotate(360deg) translateX(50px) scale(1) rotate(-360deg) scaleX(0.5);
opacity: 0.5;}
}
The trick is to set a transform that scales in X 2 times (to generate an elipse when rotated), then rotates and translates to make a circle.
Then apply a scale to make the circles grow, and at last counter-rotate to make the sphere look right
Of course, all the values are aproximate, the GIF is too small to tell if that is accurate
HTML:
<div id="all">
<div id="box">
<div id="circle"></div>
</div>
<div id="box" class="box2">
<div id="circle" class="circle2"></div>
</div>
<div id="box" class="box3">
<div id="circle" class="circle3"></div>
</div>
<div id="box" class="box4">
<div id="circle" class="circle4"></div>
</div>
<div id="box" class="box5">
<div id="circle" class="circle5"></div>
</div>
</div>
CSS:
#box {
position: absolute;
width: 50px;
height: 50px;
}
.box2 {
-webkit-transform: rotate(35deg);
}
.box3 {
-webkit-transform: rotate(70deg);
}
.box4 {
-webkit-transform: rotate(105deg);
}
.box5 {
-webkit-transform: rotate(140deg);
}
.circle2 {
-webkit-transform: scale(.8);
}
.circle3 {
-webkit-transform: scale(.6);
}
.circle4 {
-webkit-transform: scale(.4);
}
.circle5 {
-webkit-transform: scale(.2);
}
#circle {
position: relative;
top: 0px;
left: 50px;
border-radius: 50%;
background: radial-gradient(circle at 25% 25%, #FFF, rgba(255, 255, 255, 0));
background-color: #193987;
animation: rotr 4s linear infinite;
height: 20px;
width: 20px;
}
#all {
position: relative;
top: 50px;
left: 50px;
width: 50px;
height: 50px;
animation: myfirst;
animation-duration: 05s;
animation-timing-function: linear;
animation-iteration-count: infinite;
-webkit-animation-name: myfirst;
-webkit-animation-duration: 05s;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
}
#keyframes myfirst {
0% { transform: rotate(360deg);}
}
#-webkit-keyframes myfirst {
0% { -webkit-transform: rotate(360deg);}
}
Live demo
HTML:
<ul class="busy">
<li class="busy-dot1"><b class="busy-dot-shine"></b></li>
</ul>
CSS:
.busy {
list-style: none;
padding: 0;
position: relative;
transform-style: preserve-3d;
animation: rot 4s linear infinite;
width:700px;
}
.busy-dot1, .busy-dot2, .busy-dot3, .busy-dot4, .busy-dot5 {
border-radius: 50%;
display: inline-block;
transform-style: preserve-3d;
margin: 0 4px;
}
.busy-dot-shine {
display: block;
border-radius: 50%;
background: radial-gradient(circle at 25% 25%, #FFF, rgba(255,255,255,0));
background-color: #193987;
animation: rotr 4s linear infinite;
height: 60px;
width: 60px;
}
.busy li
{
transform:rotate(7deg);
-ms-transform:rotate(7deg); /* IE 9 */
-webkit-transform:rotate(7deg); /* Safari and Chrome */
animation:rotate 5s linear infinite;
-webkit-animation:rotate 5s linear infinite; /* Safari and Chrome */
}
#keyframes rotate
{
from {transform:rotate(0deg);
-ms-transform:rotate(0deg); /* IE 9 */
-webkit-transform:rotate(0deg); /* Safari and Chrome */}
to {transform:rotate(-180deg);
-ms-transform:rotate(-180deg); /* IE 9 */
-webkit-transform:rotate(-180deg); /* Safari and Chrome */}
}
#-webkit-keyframes rotate /* Safari and Chrome */
{
from {transform:rotate(0deg);
-ms-transform:rotate(0deg); /* IE 9 */
-webkit-transform:rotate(0deg); /* Safari and Chrome */}
to {transform:rotate(-360deg);
-ms-transform:rotate(-360deg); /* IE 9 */
-webkit-transform:rotate(-360deg); /* Safari and Chrome */}
}
See in action: http://jsfiddle.net/Ld9pP/1/
You'll probably choose the other one but whatever

Css Animation not working in Google Chrome

I am trying to use this loader in my web site, scc animation works well in Firefox & IE but doesn't work in Google Chrome.
#loader{
width: 820px;
height: 670px;
border: none;
overflow: hidden;
margin: 0px 70px;
background: #0d8aa5;
position: relative;
}
#innerloader{
position: absolute;
left: 50%;
top: 50%;
margin: -60px 0 0 -60px;
background: #fff;
width: 100px;
height: 100px;
border-radius: 100%;
border: 10px solid #19bee1;
}
#innerloader:after {
content: '';
background: trasparent;
width: 140%;
height: 140%;
position: absolute;
border-radius: 100%;
top: -20%;
left: -20%;
opacity: 0.7;
box-shadow: rgba(255, 255, 255, 0.6) -4px -5px 3px -3px;
-webkit-animation: rotate 2s infinite linear;
-moz-animation: rotate 2s infinite linear;
-ms-animation: rotate 2s infinite linear;
-o-animation: rotate 2s infinite linear;
animation: rotate 2s infinite linear;
}
#keyframes rotate {
0% {
-webkit-transform: rotateZ(0deg);
-moz-transform: rotateZ(0deg);
-ms-transform: rotateZ(0deg);
-o-transform: rotateZ(0deg);
transform: rotateZ(0deg);
}
100% {
-webkit-transform: rotateZ(360deg);
-moz-transform: rotateZ(360deg);
-ms-transform: rotateZ(360deg);
-o-transform: rotateZ(360deg);
transform: rotateZ(360deg);
}
}
HTML
<div id="loader"><div id="innerloader"></div></div>
P.S. Here it's working correctly also in google chrome....
You need to include the prefixed keyframe rule for WebKit browsers as well.
#-webkit-keyframes rotate {
0% {
-webkit-transform: rotateZ(0deg);
}
100% {
-webkit-transform: rotateZ(360deg);
}
}

Resources