How to get an automatic effect of rosace in css ? - html

I am making a website and there is an effect which I have putted on a circle. The circle automaticlly opens on mouse hover and then it get close when the mouse get away. I just want to make it automatic . mens it should open and close automaticlly. Here is my css code for the circle .
HTML
<div class="circle">
<h1>TRANCE-2014</h1>
</div>
CSS
.circle {
background: rgb(255, 255, 255);
border-radius: 100%;
cursor: pointer;
position: relative;
margin: 0 auto;
width: 15em;
height: 15em;
overflow: hidden;
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
}
.circle h1 {
color: rgba(189, 185, 199, 0);
font-family:'Lato', sans-serif;
font-weight: 900;
font-size: 1.6em;
line-height: 8.2em;
text-align: center;
text-transform: uppercase;
-webkit-font-smoothing: antialiased;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-transition: color 0.8s ease-in-out;
-moz-transition: color 0.8s ease-in-out;
-ms-transition: color 0.8s ease-in-out;
transition: color 0.8s ease-in-out;
}
.circle:before, .circle:after {
border-radius: 100%;
content:"";
position: absolute;
top: 0;
left: 0;
width: inherit;
height: inherit;
box-shadow: inset 10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 10.6em 0 rgba(30, 140, 209, 0.2), inset -10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 -10.6em 0 rgba(30, 140, 209, 0.2);
-webkit-transition: box-shadow 0.75s;
-moz-transition: box-shadow 0.75s;
-ms-transition: box-shadow 0.75s;
transition: box-shadow 0.75s;
}
.circle:after {
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
}
.circle:hover:before, .circle:hover:after {
box-shadow: inset 0.86em 0 0 rgba(255, 0, 0, 0.5), inset 0 0.86em 0 rgba(252, 150, 0, 0.5), inset -0.86em 0 0 rgba(0, 255, 0, 0.5), inset 0 -0.86em 0 rgba(0, 150, 255, 0.5);
}
.circle:hover > h1 {
color: rgba(185, 185, 185, 1);
}

I guess you mean something like this demo ?
If so you have to use the #keyframes element of CSS. More info on MDN or on CSS-Tricks.
CSS
.circle {
background: rgb(255, 255, 255);
border-radius: 100%;
cursor: pointer;
position: relative;
margin: 0 auto;
width: 15em;
height: 15em;
overflow: hidden;
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
}
.circle h1 {
font-family:'Lato', sans-serif;
font-weight: 900;
font-size: 1.6em;
line-height: 8.2em;
text-align: center;
text-transform: uppercase;
-webkit-font-smoothing: antialiased;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-animation: showText 2s infinite; /* Safari/Chrome 4+ */
-moz-animation: showText 2s infinite; /* Firefox 5+ */
-o-animation: showText 2s infinite; /* Opera 12+ */
animation: showText 2s infinite; /* IE 10+ */
animation-timing-function: ease-in-out;
/*
** -webkit-transition: color 0.8s ease-in-out;
** -moz-transition: color 0.8s ease-in-out;
** -ms-transition: color 0.8s ease-in-out;
** transition: color 0.8s ease-in-out;
*/
}
.circle:before, .circle:after {
border-radius: 100%;
content:"";
position: absolute;
top: 0;
left: 0;
width: inherit;
height: inherit;
-webkit-animation: moveCircle 2s infinite; /* Safari/Chrome 4+ */
-moz-animation: moveCircle 2s infinite; /* Firefox 5+ */
-o-animation: moveCircle 2s infinite; /* Opera 12+ */
animation: moveCircle 2s infinite; /* IE 10+ */
/*
** -webkit-transition: box-shadow 0.75s;
** -moz-transition: box-shadow 0.75s;
** -ms-transition: box-shadow 0.75s;
** transition: box-shadow 0.75s;
*/
}
.circle:after {
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
}
#-webkit-keyframes moveCircle {
0% {
box-shadow: inset 10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 10.6em 0 rgba(30, 140, 209, 0.2), inset -10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 -10.6em 0 rgba(30, 140, 209, 0.2);
}
100% {
box-shadow: inset 0.86em 0 0 rgba(255, 0, 0, 0.5), inset 0 0.86em 0 rgba(252, 150, 0, 0.5), inset -0.86em 0 0 rgba(0, 255, 0, 0.5), inset 0 -0.86em 0 rgba(0, 150, 255, 0.5);
}
}
#-moz-keyframes moveCircle {
0% {
box-shadow: inset 10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 10.6em 0 rgba(30, 140, 209, 0.2), inset -10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 -10.6em 0 rgba(30, 140, 209, 0.2);
}
100% {
box-shadow: inset 0.86em 0 0 rgba(255, 0, 0, 0.5), inset 0 0.86em 0 rgba(252, 150, 0, 0.5), inset -0.86em 0 0 rgba(0, 255, 0, 0.5), inset 0 -0.86em 0 rgba(0, 150, 255, 0.5);
}
}
#-o-keyframes moveCircle {
0% {
box-shadow: inset 10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 10.6em 0 rgba(30, 140, 209, 0.2), inset -10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 -10.6em 0 rgba(30, 140, 209, 0.2);
}
100% {
box-shadow: inset 0.86em 0 0 rgba(255, 0, 0, 0.5), inset 0 0.86em 0 rgba(252, 150, 0, 0.5), inset -0.86em 0 0 rgba(0, 255, 0, 0.5), inset 0 -0.86em 0 rgba(0, 150, 255, 0.5);
}
}
#keyframes moveCircle {
0% {
box-shadow: inset 10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 10.6em 0 rgba(30, 140, 209, 0.2), inset -10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 -10.6em 0 rgba(30, 140, 209, 0.2);
}
100% {
box-shadow: inset 0.86em 0 0 rgba(255, 0, 0, 0.5), inset 0 0.86em 0 rgba(252, 150, 0, 0.5), inset -0.86em 0 0 rgba(0, 255, 0, 0.5), inset 0 -0.86em 0 rgba(0, 150, 255, 0.5);
}
}
#-webkit-keyframes showText {
0% {
color: rgba(189, 185, 199, 0);
}
100% {
color: rgba(185, 185, 185, 1);
}
}
#-moz-keyframes showText {
0% {
color: rgba(189, 185, 199, 0);
}
100% {
color: rgba(185, 185, 185, 1);
}
}
#-o-keyframes showText {
0% {
color: rgba(189, 185, 199, 0);
}
100% {
color: rgba(185, 185, 185, 1);
}
}
#keyframes showText {
0% {
color: rgba(189, 185, 199, 0);
}
100% {
color: rgba(185, 185, 185, 1);
}
}

Related

Create a constant pulse animation

I'm trying to create a sun with a pulsing animation. However, I'm having trouble with the intervals of the pulse. Two pulses should always be moving with the transition. Also the sun shouldn't be standing without a pulse.
.pulse {
margin: 100px;
display: block;
width: 85px;
height: 85px;
border-radius: 50%;
background: #cca92c;
cursor: pointer;
box-shadow: 0 0 0 rgba(204, 169, 44, 0.4);
animation: pulse 2s infinite;
position: relative;
}
.pulse::before {
content: '';
box-shadow: 0 0 0 rgba(204, 169, 44, 0.4);
animation: pulse2 2.5s infinite;
border-radius: 50%;
width: 85px;
height: 85px;
border-radius: 50%;
display: block;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
.pulse:hover {
animation: none;
}
#-webkit-keyframes pulse {
0% {
-webkit-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
}
70% {
-webkit-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
}
100% {
-webkit-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
}
}
#keyframes pulse {
0% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
}
70% {
-moz-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
box-shadow: 0 0 0 40px rgba(204, 169, 44, 0);
}
100% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
}
}
#-webkit-keyframes pulse2 {
0% {
-webkit-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
}
70% {
-webkit-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
}
100% {
-webkit-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
}
}
#keyframes pulse2 {
0% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
}
70% {
-moz-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
box-shadow: 0 0 0 60px rgba(204, 169, 44, 0);
}
100% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
}
}
<div class="nb-infosys-sun">
<span class="pulse"></span>
</div>
This is what I got after adding animation-delay:
.pulse::before {
content: '';
box-shadow: 0 0 0 rgba(204, 169, 44, 0.4);
animation: pulse2 1s infinite;
animation-delay: 0.5s;
border-radius: 50%;
width: 85px;
height: 85px;
border-radius: 50%;
display: block;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
Here is the JSFiddle demo
You can add some animation delay to adjust timing of both pulse as below snippet
.pulse {
margin: 100px;
display: block;
width: 85px;
height: 85px;
border-radius: 50%;
background: #cca92c;
cursor: pointer;
box-shadow: 0 0 0 rgba(204, 169, 44, 0.4);
animation: pulse 2s linear infinite both;
position: relative;
}
.pulse::before {
content: '';
box-shadow: 0 0 0 rgba(204, 169, 44, 0.4);
animation: pulse2 2s linear 1s infinite both;
border-radius: 50%;
width: 85px;
height: 85px;
border-radius: 50%;
display: block;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
.pulse:hover {
animation: none;
}
#-webkit-keyframes pulse {
0% {
-webkit-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
}
70% {
-webkit-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
}
100% {
-webkit-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
}
}
#keyframes pulse {
0% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
}
70% {
-moz-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
box-shadow: 0 0 0 40px rgba(204, 169, 44, 0);
}
100% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
}
}
#-webkit-keyframes pulse2 {
0% {
-webkit-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
}
70% {
-webkit-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
}
100% {
-webkit-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
}
}
#keyframes pulse2 {
0% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
}
70% {
-moz-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
box-shadow: 0 0 0 60px rgba(204, 169, 44, 0);
}
100% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
}
}
<div class="nb-infosys-sun">
<span class="pulse"></span>
</div>
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Pulse Animation CSS</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="center">
<div class="pulse">code_snail</div>
</div>
</body>
</html>
style.css
body {
margin: 0;
padding: 0;
background: #262626;
}
.center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.pulse {
width: 150px;
height: 150px;
background: rgb(255, 0, 64);
border-radius: 50%;
color: #fff;
font-size: 20px;
text-align: center;
line-height: 150px;
font-family: Verdana, Geneva, Tahoma, sans-serif;
animation: animate 2s linear infinite;
}
#keyframes animate {
0% {
box-shadow: 0 0 0 0 rgba(255, 0, 64, 0.7), 0 0 0 0 rgba(255, 0, 64, 0.7);
}
40% {
box-shadow: 0 0 0 50px rgba(255, 0, 64, 0), 0 0 0 0 rgba(255, 0, 64, 0.7);
}
80% {
box-shadow: 0 0 0 50px rgba(255, 0, 64, 0), 0 0 0 30px rgba(255, 0, 64, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(255, 0, 64, 0), 0 0 0 30px rgba(255, 0, 64, 0);
}
}
Output
codesnail.com

Linking Pulse buttons and make tables disappear

Hey guys I am having trouble linking my pulse buttons to their corresponding table, my code is attached can anyone give some feed back on how to make only one table show at a time based on a click on the pulse button?
https://codepen.io/jmrowe0231/pen/KGVYLp
label div.pulse-button {
position:relative;
width: 25px;
height: 25px;
border: none;
box-shadow: 0 0 0 0 rgba(232, 76, 61, 0.7);
border-radius: 50%;
background-color: #00aed6;
background-image: url(http://image.carnivalcruiselineemail.com/lib/fe9513727761047c7c/m/10/plus_icon.png);
background-size: cover;
background-repeat: no-repeat;
cursor: pointer;
-webkit-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
-moz-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
-ms-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
}
label[for=Mexico1] div.pulse-button {
left: -143px;
top: -175px;
}
label[for=Mexico2] div.pulse-button {
left: 280px;
top: -192px;
}
label[for=Mexico3] div.pulse-button {
left: -243px;
top: -278px;
}
# -webkit-keyframes pulse {
to {
box-shadow: 0 0 0 45px rgba(232, 76, 61, 0);
}
}
#-moz-keyframes pulse {
to {
box-shadow: 0 0 0 45px rgba(232, 76, 61, 0);
}
}
#-ms-keyframes pulse {
to {
box-shadow: 0 0 0 45px rgba(232, 76, 61, 0);
}
}
#keyframes pulse {
to {
box-shadow: 0 0 0 45px rgba(232, 76, 61, 0);
}

Unable to animate transform: scale and box-shadow simultaneously

I need to animate the circle's box-shadow and scale it down to 1 from 1.6x during the same transition period of box-shadow.
The issue I'm facing is the animation of scale is happening after the animation of box-shadow is done.
body {
background-color: #333;
}
.ripple {
width: 20px;
margin: 50px auto;
height: 20px;
background: #ccc;
border-radius: 50%;
animation: rippleeff 2s ease infinite;
}
#keyframes rippleeff {
0% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
transform: scale(1.4);
}
70% {
-moz-box-shadow: 0 0 0 20px rgba(204, 169, 44, 0);
box-shadow: 0 0 0 20px rgba(204, 169, 44, 0);
transform: scale(1.6);
}
100% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
transform: scale(1);
}
}
<div class="ripple">
</div>
Fiddle
When your transform: scale(1.6), your box-shadow become transparent and after that when you going to scale(1) your box-shadow is animating but you can't see it because it's transparent...so change box-shadow color
Also changed scale value in the code...
body {
background-color: #333;
}
.ripple {
width: 20px;
margin: 50px auto;
height: 20px;
background: #ccc;
border-radius: 50%;
animation: rippleeff 2s linear infinite;
}
#keyframes rippleeff {
0% {
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
transform: scale(1);
}
50% {
box-shadow: 0 0 0 20px rgba(204, 169, 44, 0);
transform: scale(1.6);
}
100% {
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
transform: scale(1);
}
}
<div class="ripple">
</div>

Chain/sequence animation in CSS [duplicate]

This question already has answers here:
CSS Animations with delay for each child element
(6 answers)
Closed 5 years ago.
i want my buttons chronologically - the second button start animating after first button ends and so on ...
Could somebody help me achieve that effect ?
a {
padding: 6px;
display: block;
width: 50px;
font-size: 17px;
margin: 10px auto;
border: 2px solid;
text-decoration: none;
box-shadow: 0 0 0 rgba(204,169,44, 0.4);
animation: pulse 2s infinite;
}
#keyframes pulse {
0% {
-moz-box-shadow: 0 0 0 0 rgba(204,169,44, 0.4);
box-shadow: 0 0 0 0 rgba(204,169,44, 0.4);
}
70% {
-moz-box-shadow: 0 0 0 10px rgba(255,208,0, 0.2);
box-shadow: 00 0 0 10px rgba(255,208,0, 0.2);
}
100% {
-moz-box-shadow: 0 0 0 0 rgba(204,169,44, 0);
box-shadow: 0 0 0 0 rgba(204,169,44, 0);
}
}
<a class="btn-100" href="#">100</a>
<a class="btn-500" href="#">500</a>
<a class="btn-1250" href="#">1250</a>
As others have suggested, use animation-delay to offset each element's animation.
In order to loop the entire group, multiply the animation duration by the number of elements and change your keyframes accordingly. Below, I've multiplied the animation duration by three and divided the keyframe percentages by three.
If you have a large number of elements or they are added dynamically, you may want to consider using JavaScript, as mentioned here.
a {
padding: 6px;
display: block;
width: 50px;
font-size: 17px;
margin: 10px auto;
border: 2px solid;
text-decoration: none;
box-shadow: 0 0 0 rgba(204, 169, 44, 0.4);
animation: pulse 6s infinite;
}
.btn-100 {
animation-delay: 0s;
}
.btn-500 {
animation-delay: 2s;
}
.btn-1250 {
animation-delay: 4s;
}
#keyframes pulse {
0% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
}
23.333% {
-moz-box-shadow: 0 0 0 10px rgba(255, 208, 0, 0.2);
box-shadow: 00 0 0 10px rgba(255, 208, 0, 0.2);
}
33.333% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
}
}
<a class="btn-100" href="#">100</a>
<a class="btn-500" href="#">500</a>
<a class="btn-1250" href="#">1250</a>
Just add some animation delay:
.btn-500 {
animation-delay: 0.6s;
}
.btn-1250 {
animation-delay: 1.3s;
}
Demonstration:
a {
padding: 6px;
display: block;
width: 50px;
font-size: 17px;
margin: 10px auto;
border: 2px solid;
text-decoration: none;
box-shadow: 0 0 0 rgba(204, 169, 44, 0.4);
animation: pulse 2s infinite;
}
.btn-500 {
animation-delay: 0.6s;
}
.btn-1250 {
animation-delay: 1.3s;
}
#keyframes pulse {
0% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
}
70% {
-moz-box-shadow: 0 0 0 10px rgba(255, 208, 0, 0.2);
box-shadow: 00 0 0 10px rgba(255, 208, 0, 0.2);
}
100% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
}
}
<a class="btn-100" href="#">100</a>
<a class="btn-500" href="#">500</a>
<a class="btn-1250" href="#">1250</a>
View on jsFiddle

Reverse this css motion blur effect to vertical

I have this code which allows the object to motion blur side to side however I want it to motion blue vertically so it goes from up to down and then back to up. Could you please help me out?
http://jsfiddle.net/db8gr4y6/
#outer {
position: relative;
margin: 10px;
}
#mb {
position: absolute;
left: 0;
font-size: 2em;
font-weight: bold;
padding: 0.2em 1em;
color: #fff;
background-color: #600;
border: 0.2em solid #c00;
border-radius: 8px;
text-shadow: 0 0 5px rgba(255, 255, 255, 0);
box-shadow: 0 0 2px rgba(200, 0, 0, 0);
-webkit-animation: motionblur 4s ease-in-out infinite;
animation: motionblur 4s ease-in-out infinite;
}
#-webkit-keyframes motionblur {
0% {
left: 0;
text-shadow: 0 0 0 rgba(255, 255, 255, 0);
box-shadow: 0 0 0 rgba(200, 0, 0, 0);
}
5% {
left: 0;
-webkit-transform-origin: 0 0;
-webkit-transform: scaleX(0.85);
}
25% {
text-shadow: -5px 0 5px rgba(255, 255, 255, 1);
box-shadow: -15px 0 10px -5px rgba(200, 0, 0, 0.5);
-webkit-transform: scaleX(1.1) skewX(-4deg);
}
50% {
left: 300px;
text-shadow: 0 0 0 rgba(255, 255, 255, 0);
box-shadow: 0 0 0 rgba(200, 0, 0, 0);
-webkit-transform: scaleX(1) skewX(0deg);
}
55% {
left: 300px;
-webkit-transform-origin: 100% 0;
-webkit-transform: scaleX(0.85);
}
75% {
text-shadow: 5px 0 5px rgba(255, 255, 255, 1);
box-shadow: 15px 0 10px -5px rgba(200, 0, 0, 0.5);
-webkit-transform: scaleX(1.1) skewX(4deg);
}
100% {
left: 0px;
text-shadow: 0 0 0 rgba(255, 255, 255, 0);
box-shadow: 0 0 0 rgba(200, 0, 0, 0);
-webkit-transform: scaleX(1) skewX(0deg);
}
}
#keyframes motionblur {
0% {
left: 0;
text-shadow: 0 0 0 rgba(255, 255, 255, 0);
box-shadow: 0 0 0 rgba(200, 0, 0, 0);
}
5% {
left: 0;
transform-origin: 0 0;
transform: scaleX(0.85);
}
25% {
text-shadow: -5px 0 5px rgba(255, 255, 255, 1);
box-shadow: -15px 0 10px -5px rgba(200, 0, 0, 0.5);
transform: scaleX(1.1) skewX(-4deg);
}
50% {
left: 300px;
text-shadow: 0 0 0 rgba(255, 255, 255, 0);
box-shadow: 0 0 0 rgba(200, 0, 0, 0);
transform: scaleX(1) skewX(0deg);
}
55% {
left: 300px;
transform-origin: 100% 0;
transform: scaleX(0.85);
}
75% {
text-shadow: 5px 0 5px rgba(255, 255, 255, 1);
box-shadow: 15px 0 10px -5px rgba(200, 0, 0, 0.5);
transform: scaleX(1.1) skewX(4deg);
}
100% {
left: 0px;
text-shadow: 0 0 0 rgba(255, 255, 255, 0);
box-shadow: 0 0 0 rgba(200, 0, 0, 0);
transform: scaleX(1) skewX(0deg);
}
<div id="outer">
<div id="mb">Motion Blur</div>
</div>
Try this to reverse animation.
Just replace all left attributes into Top
And all transform property of X, ScaleX and SkewX to SkewX SkewY
#outer {
position: relative;
margin: 10px;
}
#mb {
position: absolute;
left: 0;
font-size: 2em;
font-weight: bold;
padding: 0.2em 1em;
color: #fff;
background-color: #600;
border: 0.2em solid #c00;
border-radius: 8px;
text-shadow: 0 0 5px rgba(255, 255, 255, 0);
box-shadow: 0 0 2px rgba(200, 0, 0, 0);
-webkit-animation: motionblur 4s ease-in-out infinite;
animation: motionblur 4s ease-in-out infinite;
}
#-webkit-keyframes motionblur {
0% {
top: 0;
text-shadow: 0 0 0 rgba(255, 255, 255, 0);
box-shadow: 0 0 0 rgba(200, 0, 0, 0);
}
5% {
top: 0;
-webkit-transform-origin: 0 0;
-webkit-transform: scaleY(0.85);
}
25% {
text-shadow: -5px 0 5px rgba(255, 255, 255, 1);
box-shadow: -15px 0 10px -5px rgba(200, 0, 0, 0.5);
-webkit-transform: scaleY(1.1) skewY(-4deg);
}
50% {
top: 300px;
text-shadow: 0 0 0 rgba(255, 255, 255, 0);
box-shadow: 0 0 0 rgba(200, 0, 0, 0);
-webkit-transform: scaleY(1) skewY(0deg);
}
55% {
left: 300px;
-webkit-transform-origin: 100% 0;
-webkit-transform: scaleY(0.85);
}
75% {
text-shadow: 5px 0 5px rgba(255, 255, 255, 1);
box-shadow: 15px 0 10px -5px rgba(200, 0, 0, 0.5);
-webkit-transform: scaleY(1.1) skewY(4deg);
}
100% {
top: 0px;
text-shadow: 0 0 0 rgba(255, 255, 255, 0);
box-shadow: 0 0 0 rgba(200, 0, 0, 0);
-webkit-transform: scaleY(1) skewY(0deg);
}
}
#keyframes motionblur {
0% {
top: 0;
text-shadow: 0 0 0 rgba(255, 255, 255, 0);
box-shadow: 0 0 0 rgba(200, 0, 0, 0);
}
5% {
top: 0;
-webkit-transform-origin: 0 0;
-webkit-transform: scaleY(0.85);
}
25% {
text-shadow: -5px 0 5px rgba(255, 255, 255, 1);
box-shadow: -15px 0 10px -5px rgba(200, 0, 0, 0.5);
-webkit-transform: scaleY(1.1) skewY(-4deg);
}
50% {
top: 300px;
text-shadow: 0 0 0 rgba(255, 255, 255, 0);
box-shadow: 0 0 0 rgba(200, 0, 0, 0);
-webkit-transform: scaleY(1) skewY(0deg);
}
55% {
top: 300px;
-webkit-transform-origin: 100% 0;
-webkit-transform: scaleY(0.85);
}
75% {
text-shadow: 5px 0 5px rgba(255, 255, 255, 1);
box-shadow: 15px 0 10px -5px rgba(200, 0, 0, 0.5);
-webkit-transform: scaleY(1.1) skewY(4deg);
}
100% {
top: 0px;
text-shadow: 0 0 0 rgba(255, 255, 255, 0);
box-shadow: 0 0 0 rgba(200, 0, 0, 0);
-webkit-transform: scaleY(1) skewY(0deg);
}
<div id="outer">
<div id="mb">Motion Blur</div>
</div>