How can I reverse keyframe on hover off? - css

I'm working on a card flip animation using keyframes. Aside from the fact I need the origin of the animation to be in the middle, the card flips fine on hover. However, I need to "unflip" on hover off. Right now it's just resetting and not animating.
.oisqa-widget .flip-container:hover .flipper {
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
-o-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: flipcard 1s 0s 1 normal forwards;
-moz-animation: flipcard 1s 0s 1 normal forwards;
animation: flipcard 1s 0s 1 normal forwards; }
I've created a jsfiddle to show what's happening

Dont use keyframe animation for hover effects Just removed #keyframe css rules and added it inside containers on hover so that it will automatically handles hover off effect!
Here is the code jSfiddle
for FullScreen jsFiddle
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.oisqa-widget {
float: left;
width: 100%;
}
.oisqa-widget .flip-container {
height: 170px;
}
.oisqa-widget .flip-container:hover .flipper {
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
-o-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-transform: scale(2) rotateY(180deg);
}
.oisqa-widget .flip-container {
display: block;
float: left;
margin-right: 2.12766%;
width: 31.91489%;
-webkit-perspective: 1000;
-moz-perspective: 1000;
perspective: 1000;
}
.oisqa-widget .flip-container:last-child {
margin-right: 0;
}
.oisqa-widget .flipper {
position: relative;
transition: 0.6s;
transform-style: preserve-3d;
}
.oisqa-widget .front,
.oisqa-widget .back {
position: absolute;
top: 0px;
left: 0px;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
height: 170px;
padding: 20px;
text-align: center;
width: 100%;
}
.oisqa-widget .front {
background: white;
border: 1px #c3c3c3 solid;
border-top: 5px #1c4295 solid;
transform: rotateY(0deg);
z-index: 2;
}
.oisqa-widget .back {
background: #1c4295;
border: 1px #c3c3c3 solid;
border-top: 5px #f4f4f4 solid;
color: white;
transform: rotateY(180deg);
}
.oisqa-widget .back strong {
color: white;
}
.oisqa-widget strong {
color: #1c4295;
}
<div class="oisqa-widget">
<div class="flip-container">
<div class="flipper">
<div class="front">
<p class="question">question 1</p>
</div>
<div class="back">
<p class="question">answer 1</p>
</div>
</div>
</div>
<div class="flip-container">
<div class="flipper">
<div class="front">
<p class="question">question 2</p>
</div>
<div class="back">
<p class="question">answer 2</p>
</div>
</div>
</div>
<div class="flip-container">
<div class="flipper">
<div class="front">
<p class="question">question 3</p>
</div>
<div class="back">
<p class="question">answer 3</p>
</div>
</div>
</div>
</div>

This will seem a little convoluted so bear with me...
To get the desired effect I used 3 separate animations, 2 of which are the same as your current flipcard animation, so you'll end up with flipcard, flipcard2, and hideAnswer.
To get the flipcard animation to work in both directions you'll need to add flipcard2 to the initial state of .flipper, I know this seems odd, but the hover state and the initial state need to use animations with different names, you can't use the same animation and just flip the direction. So:
.oisqa-widget .flipper {
position: relative;
/*transition: 0.6s; remove this */
transform-style: preserve-3d;
-webkit-animation: flipcard2 1s 0s 1 reverse forwards;
-moz-animation: flipcard2 1s 0s 1 reverse forwards;
animation: flipcard2 1s 0s 1 reverse forwards;
/*note that flipcard and flipcard2 are the same but here the direction is reversed*/
}
Now just doing this will get your animation going in both directions, but your answers will show when the page first loads.
To prevent that you'll need to hide everything for the first second while the animation plays through on the initial state, hence the 3rd animation hideAnswer:
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
animation: hideAnswer 1s;
}
#keyframes hideAnswer {
0%{opacity: 0;}
99%{opacity: 0;}
100%{opacity:1;}
}
Now put it all together and you'll get:
Working Example on jsFiddle
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-animation: hideAnswer 1s;
-o-animation: hideAnswer 1s;
-moz-animation: hideAnswer 1s;
animation: hideAnswer 1s;
}
#-o-keyframes hideAnswer {
0% {
opacity: 0;
}
99% {
opacity: 0;
}
100% {
opacity:1;
}
}
#-webkit-keyframes hideAnswer {
0% {
opacity: 0;
}
99% {
opacity: 0;
}
100% {
opacity:1;
}
}
#-moz-keyframes hideAnswer {
0% {
opacity: 0;
}
99% {
opacity: 0;
}
100% {
opacity:1;
}
}
#keyframes hideAnswer {
0% {
opacity: 0;
}
99% {
opacity: 0;
}
100% {
opacity:1;
}
}
#-webkit-keyframes flipcard {
0% {
-webkit-transform: scale(1) rotateY(0);
}
50% {
-webkit-transform: scale(2) rotateY(180deg);
}
100% {
-webkit-transform: scale(1) rotateY(180deg);
}
}
#-moz-keyframes flipcard {
0% {
-moz-transform: scale(1) rotateY(0);
}
50% {
-moz-transform: scale(2) rotateY(180deg);
}
100% {
-moz-transform: scale(1) rotateY(180deg);
}
}
#-o-keyframes flipcard {
0% {
-o-transform: scale(1) rotateY(0);
}
50% {
-o-transform: scale(2) rotateY(180deg);
}
100% {
-o-transform: scale(1) rotateY(180deg);
}
}
#keyframes flipcard {
0% {
transform: scale(1) rotateY(0);
}
50% {
transform: scale(2) rotateY(180deg);
}
100% {
transform: scale(1) rotateY(180deg);
}
}
#-webkit-keyframes flipcard2 {
0% {
-webkit-transform: scale(1) rotateY(0);
}
50% {
-webkit-transform: scale(2) rotateY(180deg);
}
100% {
-webkit-transform: scale(1) rotateY(180deg);
}
}
#-moz-keyframes flipcard2 {
0% {
-moz-transform: scale(1) rotateY(0);
}
50% {
-moz-transform: scale(2) rotateY(180deg);
}
100% {
-moz-transform: scale(1) rotateY(180deg);
}
}
#-o-keyframes flipcard2 {
0% {
-o-transform: scale(1) rotateY(0);
}
50% {
-o-transform: scale(2) rotateY(180deg);
}
100% {
-o-transform: scale(1) rotateY(180deg);
}
}
#keyframes flipcard2 {
0% {
transform: scale(1) rotateY(0);
}
50% {
transform: scale(2) rotateY(180deg);
}
100% {
transform: scale(1) rotateY(180deg);
}
}
.oisqa-widget {
float: left;
width: 100%;
}
.oisqa-widget .flip-container {
height: 170px;
}
.oisqa-widget .flip-container {
display: block;
float: left;
margin-right: 2.12766%;
width: 31.91489%;
-webkit-perspective: 1000;
-moz-perspective: 1000;
perspective: 1000;
}
.oisqa-widget .flip-container:last-child {
margin-right: 0;
}
.oisqa-widget .flip-container:hover .flipper {
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
-o-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: flipcard 1s 0s 1 normal forwards;
-moz-animation: flipcard 1s 0s 1 normal forwards;
animation: flipcard 1s 0s 1 normal forwards;
}
.oisqa-widget .flipper {
position: relative;
/*transition: 0.6s; remove this */
transform-style: preserve-3d;
-webkit-animation: flipcard2 1s 0s 1 reverse forwards;
-moz-animation: flipcard2 1s 0s 1 reverse forwards;
animation: flipcard2 1s 0s 1 reverse forwards;
}
.oisqa-widget .front, .oisqa-widget .back {
position: absolute;
top: 0px;
left: 0px;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
height: 170px;
padding: 20px;
text-align: center;
width: 100%;
}
.oisqa-widget .front {
background: white;
border: 1px #c3c3c3 solid;
border-top: 5px #1c4295 solid;
transform: rotateY(0deg);
z-index: 2;
}
.oisqa-widget .back {
background: #1c4295;
border: 1px #c3c3c3 solid;
border-top: 5px #f4f4f4 solid;
color: white;
transform: rotateY(180deg);
}
.oisqa-widget .back strong {
color: white;
}
.oisqa-widget strong {
color: #1c4295;
}
<div class="oisqa-widget">
<div class="flip-container">
<div class="flipper">
<div class="front">
<p class="question">question 1</p>
</div>
<div class="back">
<p class="question">answer 1</p>
</div>
</div>
</div>
<div class="flip-container">
<div class="flipper">
<div class="front">
<p class="question">question 2</p>
</div>
<div class="back">
<p class="question">answer 2</p>
</div>
</div>
</div>
<div class="flip-container">
<div class="flipper">
<div class="front">
<p class="question">question 3</p>
</div>
<div class="back">
<p class="question">answer 3</p>
</div>
</div>
</div>
</div>

Related

mix-blend-mode doesn't working with animation over it

I have this codepen example: https://codepen.io/levai-ferenc/pen/bGLYVOr
<div class="wrapper">
<div class="element">
<div class="image" />
</div>
</div>
#keyframes alpha_buildIn {
0% {
opacity: 0;
-webkit-opacity: 0;
transform: translateX(0) translateY(0);
-webkit-transform: translateX(0) translateY(0);}
100% {
opacity: 1;
-webkit-opacity: 1;
}
}
#-webkit-keyframes alpha_buildIn {
0% {
opacity: 0;
-webkit-opacity: 0;
transform: translateX(0) translateY(0);
-webkit-transform: translateX(0) translateY(0);
}
100% {
opacity: 1;
-webkit-opacity: 1;
}
}
.wrapper {
width: 580px;
height: 400px;
background-color: rgb(218, 39, 39);
transform: scale(2.81724);
transform-origin: 0px 0px 0px;
}
.element {
animation: 0.8s cubic-bezier(0.215, 0.61, 0.355, 1) 0s 1 normal both running
alpha_buildIn;
width: 100%;
height: 100%;
}
.image {
width: 100%;
height: 100%;
background-image: url(https://d1az8j93w0r5an.cloudfront.net/assets/media/8oxrr);
mix-blend-mode: color;
}
I have to use mix-blend-mode, but it doesn't apply if I use animation on a div over
Any idea how can I do it to work both ? Animation and blend-mode too.

Convert 2d image to 3d image

I have a 2d image in my html which I would like to style it to appear 3d with css but I keep searching the internet and no luck. To add I want the logo to rotate as well. The image is planet earth and I wanted to rotate like that in the navbar. Again have researched and what I get is to rotate the y,x, and z and sometimes to use photoshop.
Here is my code:
* {
box-sizing: border-box;
}
.index-header {
width: 100%;
height: 100px;
background-color: #000;
}
.index-header .index-logo {
float: left;
height: 100px;
width: 100px;
perspective: 360px;
transform: scale3d(360deg);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"  />
<meta name="viewport"  content="width=device-width, initial-scale=1.0"  />
<link rel="stylesheet"  href="style.css"  />
<title>Document</title>
</head>
<body>
<header class="index-header">
<img src="logo/logo.png"  alt=""  class="index-logo"  />
</header>
</body>
</html>
Do you mean something like this?
#import url(https://fonts.googleapis.com/css?family=Sigmar+One);
body {
margin: 0;
text-align: center;
background: #F4F1F8;
}
h1 {
font-family: 'Sigmar One', cursive;
color: #FFC84D;
}
h4 {
font-family: monospace;
}
section {
display: block;
width: 660px;
margin: 0 auto;
}
div {
height: 120px;
width: 220px;
}
.container {
position: relative;
display: inline-block;
height: 120px;
margin: 0 2em 2em 0;
opacity: .7;
border-radius: 5px;
background: #E4E1E4;
-webkit-perspective: 400px;
perspective: 400px;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.transform {
position: absolute;
bottom: 0;
background: rgba(65, 245, 254, .5);
border-radius: 5px;
-webkit-animation: notransform 5s infinite;
animation: notransform 5s infinite;
}
.translate3d {
-webkit-transform: translate3d(20px,20px,20px);
-ms-transform: translate3d(20px,20px,20px);
transform: translate3d(20px,20px,20px);
}
.scale3d {
-webkit-transform: scale3d(0,0,1);
-ms-transform: scale3d(0,0,1);
transform: scale3d(0,0,1);
-webkit-animation-delay: .5s;
animation-delay: .5s;
}
.rotate3d {
-webkit-transform: rotate3d(1, .5, 1, -30deg);
-ms-transform: rotate3d(1, .5, 1, -30deg);
transform: rotate3d(1, .5, 1, -30deg);
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
.rotateX {
-webkit-transform: rotateX(180deg);
-ms-transform: rotateX(180deg);
transform: rotateX(180deg);
-webkit-animation-delay: 1.5s;
animation-delay: 1.5s;
}
.rotateY {
-webkit-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
transform: rotateY(180deg);
-webkit-animation-delay: 2s;
animation-delay: 2s;
}
.rotateZ {
-webkit-transform: rotateZ(180deg);
-ms-transform: rotateZ(180deg);
transform: rotateZ(180deg);
-webkit-animation-delay: 2.5s;
animation-delay: 2.5s;
}
#-webkit-keyframes notransform {
50% {transform: none;}
}
#keyframes notransform {
50% {transform: none;}
}
<h1>CSS3 3D Transform examples</h1>
<section>
<div class="container">
<div class="transform translate3d"><h4>translate3d(20px,20px,20px)</h4></div>
</div>
<div class="container">
<div class="transform scale3d"><h4>scale3d(0,0,1)</h4></div>
</div>
<div class="container">
<div class="transform rotate3d"><h4>rotate3d(1, .5, 1, -30deg)</h4></div>
</div>
<div class="container">
<div class="transform rotateX"><h4>rotateX(180deg)</h4></div>
</div>
<div class="container">
<div class="transform rotateY"><h4>rotateY(180deg)</h4></div>
</div>
<div class="container">
<div class="transform rotateZ"><h4>rotateZ(180deg)</h4></div>
</div>
</section>

How to add a slow zoom in effect to slider images using slick slider?

I am trying to replicate the slow zoom in effect that the slider uses on this website: https://www.palazzokitchens.co.nz/
I'm using slick slider, how can I achieve this effect?
I have tried using scale(1.5) with a long transition but this also makes its children scale as well.
I have setup a slider demo have, any help is much appreciated: https://codepen.io/ifusion/pen/EvRPOB
Use this code and please see code in full page.
$(document).ready(function() {
$('.hero-slider').slick({
arrows: false,
autoplay: true,
autoplaySpeed: 3000
});
});
.no-overflow {
overflow: hidden;
}
.columns{
position:relative;
}
.hero-image {
background-repeat: no-repeat;
background-size: cover;
background-position: center center;
height: 550px;
position: relative;
width: 100%;
}
.hero-text {
font-size: 50px;
color: white;;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
}
.slick-slider { overflow: hidden; }
.slick-slider div.slick-active .hero-image {
-webkit-animation: myMove 8s 1 ease-in-out;
-moz-animation: myMove 8s 1 ease-in-out;
-o-animation: myMove 8s 1 ease-in-out;
-ms-animation: myMove 8s 1 ease-in-out;
animation: myMove 8s 1 ease-in-out;
}
#keyframes myMove {
from { transform: scale(1.0,1.0); transform-origin: 50% 50%; }
to { transform: scale(1.1,1.1); transform-origin: 50% 0%; }
}
#-webkit-keyframes myMove {
from { -webkit-transform: scale(1.0,1.0); -webkit-transform-origin: 50% 50%; }
to { -webkit-transform: scale(1.1,1.1); -webkit-transform-origin: 50% 0%; }
}
#-o-keyframes myMove {
from { -o-transform: scale(1.0,1.0); -o-transform-origin: 50% 50%; }
to { -o-transform: scale(1.1,1.1); -o-transform-origin: 50% 0%; }
}
#-moz-keyframes myMove {
from { -moz-transform: scale(1.0,1.0); -moz-transform-origin: 50% 50%; }
to { -moz-transform: scale(1.1,1.1); -moz-transform-origin: 50% 0%; }
}
#-ms-keyframes myMove {
from { -ms-transform: scale(1.0,1.0); -ms-transform-origin: 50% 50%; }
to { -ms-transform: scale(1.1,1.1); -ms-transform-origin: 50% 0%; }
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.js"></script>
<div class="hero-slider">
<div class="columns">
<div class="hero-image" style="background-image: url('http://lorempixel.com/output/city-q-c-1900-500-6.jpg')">
</div>
<div class="hero-text">Dummy text in here 1</div>
</div>
<div class="columns">
<div class="hero-image" style="background-image: url('http://lorempixel.com/output/technics-q-c-1900-500-8.jpg')">
</div>
<div class="hero-text">Dummy text in here 2</div>
</div>
<div class="columns">
<div class="hero-image" style="background-image: url('http://lorempixel.com/output/nature-q-c-1900-500-5.jpg')">
</div>
<div class="hero-text">Dummy text in here 3</div>
</div>
</div>
You need to separate image from slide and animate only image:
Updated codepen

CSS loader does not start animating

I am unable to make the css loader from here: http://cssdeck.com/labs/css3-loader-newtons-cradle work in jsfiddle, here is the demo: http://jsfiddle.net/4eUrG/
I looked more at their source code and they seem to use some javascript to make it start, is that really needed?
It uses the html:
<div class="cord leftMove">
<div class="ball"></div>
</div>
<div class="cord">
<div class="ball"></div>
</div>
<div class="cord">
<div class="ball"></div>
</div>
<div class="cord">
<div class="ball"></div>
</div>
<div class="cord">
<div class="ball"></div>
</div>
<div class="cord">
<div class="ball"></div>
</div>
<div class="cord rightMove">
<div class="ball" id="first"></div>
</div>
<div class="shadows">
<div class="leftShadow"></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div class="rightShadow"></div>
</div>
<br><br>
Inspired by Jordi Verdu
</div>
and the CSS:
#import url(http://fonts.googleapis.com/css?family=Quicksand:700);
body{
font-family: 'Quicksand', sans-serif;
margin:0;
background: #ede9de;
color:#666;
}
a, a:visited, a:hover{
text-decoration:none;
color:#db5989;
}
a:hover{
color:#a05772;
}
.container {
height: 150px;
left: 50%;
margin: -75px 0 0 -53px;
position: absolute;
top: 50%;
width: 106px;
text-align:center;
}
.cord{
padding-top:100px;
width:15px;
transform: rotate(0deg);
transform-origin:50% 50%;
float:left;
}
.ball{
background:#333;
width:15px;
height:15px;
float:left;
border-radius:50%;
}
.shadows{
clear:left;
padding-top:20px;
margin-left:-2px;
}
.shadows div{
float:left;
margin-left: 2px;
width:13px;
height:3px;
border-radius:50%;
box-shadow: 0px 0px 3px rgba(204, 204, 204, 0.3);
background: rgba(204, 204, 204, 0.3);
}
.leftMove{
animation: leftBall .5s ease-in-out 0s infinite alternate;
}
.rightMove{
animation: rightBall .5s ease-in-out 0s infinite alternate;
}
.leftShadow{
animation: leftShadowN .5s ease-in-out 0s infinite alternate;
}
.rightShadow{
animation: rightShadowN .5s ease-in-out 0s infinite alternate;
}
#keyframes leftBall
{
0% {
transform: rotate(0deg) translateY(0px);
}
/*this pauses the ball at the begining*/
50% {
transform: rotate(0deg) translateY(0px);
}
100% {
transform: rotate(50deg) translateY(-20px);
}
}
#keyframes rightBall
{
0% {
transform: rotate(-50deg) translateY(-20px);
}
/*this pauses the ball at the begining*/
50% {
transform: rotate(0deg) translateY(0px);
}
100% {
transform: rotate(0deg) translateY(0px)
translateX(0px);
}
}
#keyframes leftShadowN
{
0% {
transform: translateX(0px);
}
/*this pauses the ball at the begining*/
50% {
transform: translateX(0px);
}
100% {
transform: translateX(-25px);
}
}
#keyframes rightShadowN
{
0% {
transform: translateX(25px);
}
/*this pauses the ball at the begining*/
50% {
transform: translateY(0px);
}
100% {
transform: translateY(0px);
}
}
/*colors*/
.cord:nth-of-type(1) .ball{
background:#335672;
}
.cord:nth-of-type(2) .ball{
background:#35506b;
}
.cord:nth-of-type(3) .ball{
background:#5f4e60;
}
.cord:nth-of-type(4) .ball{
background:#924a4e;
}
.cord:nth-of-type(5) .ball{
background:#a73a33;
}
.cord:nth-of-type(6) .ball{
background:#cf4231;
}
.cord:nth-of-type(7) .ball{
background:#df3e2a;
}
It works on IE10.
In order to make it works in webkit based browser, you need to specify it in the css for transform and animation
Here for exemple :
.leftMove {
animation: leftBall .5s ease-in-out 0s infinite alternate;
-webkit-animation: leftBall .5s ease-in-out 0s infinite alternate;
}
And here too :
#keyframes leftBall {
0% {
transform: rotate(0deg) translateY(0px);
}
/*this pauses the ball at the begining*/
50% {
transform: rotate(0deg) translateY(0px);
}
100% {
transform: rotate(50deg) translateY(-20px);
}
}
#-webkit-keyframes leftBall {
0% {
-webkit-transform: rotate(0deg) translateY(0px);
}
/*this pauses the ball at the begining*/
50% {
-webkit-transform: rotate(0deg) translateY(0px);
}
100% {
-webkit-transform: rotate(50deg) translateY(-20px);
}
}
You can check this fiddle for a complete update that works.

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

Resources