CSS animation timing, reversal & general flow - html

I have started to create a CSS based animation here -
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: #999999 !important;
height: 100vh;
width: 100vw;
font-size: 16px;
}
.loading-overlay {
width: 100vw;
height: 100vh;
position: absolute;
left: 0;
top: 0;
z-index: 900;
background-color: #FFFFFF !important;
}
.loading-overlay.relative {
position: relative !important;
left: 0 !important;
width: auto !important;
height: auto !important;
}
.loading-overlay .brand-logo-animation-loop {
height: 12rem;
width: 12rem;
display: block;
position: absolute;
right: calc(50% - 6rem);
top: calc(50% - 6rem);
}
.loading-overlay .brand-logo-animation-loop .shape1 {
position: absolute;
width: 0;
height: 0;
border-style: solid;
border-width: 6rem 0 6rem 6rem;
border-color: transparent transparent transparent #FAE6FF;
-webkit-animation-duration: 2s;
animation-duration: 2s;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-name: shape1;
animation-name: shape1;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-direction: normal;
animation-direction: normal;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.loading-overlay .brand-logo-animation-loop .shape2 {
position: absolute;
left: 6rem;
width: 0;
height: 0;
border-style: solid;
border-width: 6rem 6rem 6rem 0;
border-color: transparent #FAE6FF transparent transparent;
-webkit-animation-duration: 2s;
animation-duration: 2s;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-name: shape2;
animation-name: shape2;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-direction: normal;
animation-direction: normal;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.loading-overlay .brand-logo-animation-loop .shape3 {
width: 0;
height: 0;
opacity: 0;
border-style: solid;
border-width: 3rem 0 3rem 3rem;
border-color: transparent transparent transparent #660296;
position: absolute;
z-index: 200;
top: 3rem;
left: 3rem;
-webkit-animation-duration: 2s;
animation-duration: 2s;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-name: shape3;
animation-name: shape3;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-direction: normal;
animation-direction: normal;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
transform-origin: top left;
}
.loading-overlay .brand-logo-animation-loop .shape3:before {
content: "";
width: 0;
height: 0;
border-style: solid;
border-width: 3rem 3rem 3rem 0;
border-color: transparent #660296 transparent transparent;
position: absolute;
top: -3rem;
right: 3rem;
}
.loading-overlay .brand-logo-animation-loop .shape3 {
-webkit-animation-delay: 2s;
animation-delay: 2s;
}
.loading-overlay .brand-logo-animation-loop .shape4 {
width: 0;
height: 0;
border-style: solid;
border-width: 3rem 0 3rem 3rem;
border-color: transparent transparent transparent #8203C0;
position: absolute;
z-index: 100;
bottom: 0;
left: 6rem;
-webkit-animation-duration: 2s;
animation-duration: 2s;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-name: shape4;
animation-name: shape4;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-direction: normal;
animation-direction: normal;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
transform-origin: top left;
opacity: 0;
}
.loading-overlay .brand-logo-animation-loop .shape4:before {
content: "";
width: 0;
height: 0;
border-style: solid;
border-width: 3rem 3rem 3rem 0;
border-color: transparent #8203C0 transparent transparent;
position: absolute;
top: -3rem;
right: 3rem;
}
.loading-overlay .brand-logo-animation-loop .shape4 {
-webkit-animation-delay: 4s;
animation-delay: 4s;
}
.loading-overlay .brand-logo-animation-loop .shape5 {
width: 0;
height: 0;
border-style: solid;
border-width: 3rem 0 3rem 3rem;
border-color: transparent transparent transparent #8203C0;
position: absolute;
bottom: 0;
opacity: 0;
-webkit-animation-duration: 2s;
animation-duration: 2s;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-name: shape5;
animation-name: shape5;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-direction: normal;
animation-direction: normal;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}
.loading-overlay .brand-logo-animation-loop .shape5 {
-webkit-animation-delay: 6s;
animation-delay: 6s;
}
#-webkit-keyframes master-turn {
0% {
transform: rotate(-45deg);
}
25% {
transform: rotate(-45deg);
}
40% {
transform: rotate(0deg);
}
60% {
transform: rotate(0deg);
}
75% {
transform: rotate(-45deg);
}
100% {
transform: rotate(-45deg);
}
}
#keyframes master-turn {
0% {
transform: rotate(-45deg);
}
25% {
transform: rotate(-45deg);
}
40% {
transform: rotate(0deg);
}
60% {
transform: rotate(0deg);
}
75% {
transform: rotate(-45deg);
}
100% {
transform: rotate(-45deg);
}
}
#-webkit-keyframes shape1 {
0% {
left: 3rem;
opacity: 0;
}
20% {
left: calc($smallSize - 1rem);
opacity: 0.2;
}
80% {
left: calc($smallSize - 2rem);
opacity: 0.8;
}
100% {
left: 0rem;
opacity: 1;
}
}
#keyframes shape1 {
0% {
left: 3rem;
opacity: 0;
}
20% {
left: calc($smallSize - 1rem);
opacity: 0.2;
}
80% {
left: calc($smallSize - 2rem);
opacity: 0.8;
}
100% {
left: 0rem;
opacity: 1;
}
}
#-webkit-keyframes shape2 {
0% {
left: -3rem;
opacity: 0;
transform: rotate(-180deg);
}
20% {
left: 0rem;
opacity: 0.2;
transform: rotate(-90deg);
}
80% {
left: 3rem;
opacity: 0.8;
}
100% {
left: 6rem;
opacity: 1;
transform: rotate(0deg);
}
}
#keyframes shape2 {
0% {
left: -3rem;
opacity: 0;
transform: rotate(-180deg);
}
20% {
left: 0rem;
opacity: 0.2;
transform: rotate(-90deg);
}
80% {
left: 3rem;
opacity: 0.8;
}
100% {
left: 6rem;
opacity: 1;
transform: rotate(0deg);
}
}
#-webkit-keyframes shape3 {
0% {
opacity: 0;
transform: scale(0);
}
20% {
pacity: 0.2;
transform: scale(0.5);
}
80% {
opacity: 0.8;
transform: scale(1);
}
100% {
opacity: 1;
}
}
#keyframes shape3 {
0% {
opacity: 0;
transform: scale(0);
}
20% {
pacity: 0.2;
transform: scale(0.5);
}
80% {
opacity: 0.8;
transform: scale(1);
}
100% {
opacity: 1;
}
}
#-webkit-keyframes shape4 {
0% {
bottom: 3rem;
left: 3rem;
opacity: 0;
}
50% {
bottom: 3rem;
left: 3rem;
opacity: 0.5;
}
100% {
bottom: 0rem;
left: 6rem;
opacity: 1;
}
}
#keyframes shape4 {
0% {
bottom: 3rem;
left: 3rem;
opacity: 0;
}
50% {
bottom: 3rem;
left: 3rem;
opacity: 0.5;
}
100% {
bottom: 0rem;
left: 6rem;
opacity: 1;
}
}
#-webkit-keyframes shape5 {
0% {
opacity: 0;
}
50% {
opacity: 0.2;
}
100% {
opacity: 1;
}
}
#keyframes shape5 {
0% {
opacity: 0;
}
50% {
opacity: 0.2;
}
100% {
opacity: 1;
}
}
<div class="loading-overlay">
<div class="brand-logo-animation-loop">
<div class="shape1"></div>
<div class="shape2"></div>
<div class="shape3"></div>
<div class="shape4"></div>
<div class="shape5"></div>
</div>
</div>
Codepen: https://codepen.io/erswelljustin/pen/ExbKMaz
I am stuck on the timing and how to have it run forwards and then reverse out.
Explanation:
Shape 1 and Shape 2 should play first with Shape 2 rotating in from the left of its container, once this has finished then the Shape 3 animation should run, then Shape 4 and Shape 5 after that, once all completed I need to reverse the process until the shapes are gone.
I would like the whole animation to run infinitely as it is supposed to be a loading animation for an app.
I have been staring at this for days and no mater the delays I place it seems to ruin oddly, can any one help me please.
Note: I'd like to avoid using JavaScript with this.

It seems that the animation-delay:6 simply doesn't sync for 100% with the actual duration of another animation that lasts 6 seconds. Especially when it keeps looping.
You might try making all animations the same length (say 10 seconds) and only use the keyframe percentages to decide when an animation starts or stops. For example, here shape2 becomes visible after shape1 became visible.
.shape1 {
width:100px;
height:100px;
background-color:green;
animation: shape1 3s infinite linear;
}
.shape2 {
width:100px;
height:100px;
background-color:blue;
animation: shape2 3s infinite linear;
}
#keyframes shape1 {
0% {
opacity: 0;
}
20% {
opacity: 1;
}
40% {
opacity: 1;
}
100% {
opacity: 1;
}
}
#keyframes shape2 {
0% {
opacity: 0;
}
20% {
opacity: 0;
}
40% {
opacity: 1;
}
100% {
opacity: 1;
}
}
<div class="shape1"></div>
<div class="shape2"></div>

Related

while using css animation dosent have any affect on my div

I tried to use animated loader but unable to rotate as key frames are not working
i {
height: 2em;
width: 2em;enter code here
border-radius: 100%;
background: #fff;
display: block;
margin: 10em auto;
position: absolute;
left: 50%;
animation: spin 2s ease infinite;
}
i:before,
i:after {
content: "";
display: block;
position: absolute;
height: inherit;
width: inherit;
background: inherit;
border-radius: inherit;
animation: spin 2s ease infinite;
-webkit-animation: spin 2s ease infinite;
-moz-animation: spin 2s ease infinite;
}
i:before {
left: -2.3em;
}
i:after {
left: 2.3em;
}
#-moz-keyframes spin {
0% {
top: 0;
-moz-transform: rotate(0deg);
}
50% {
top: -4em;
-moz-transform: rotate(-180deg);
}
100% {
top: 0;
-moz-transform: rotate(-360deg);
}
}
#-webkit-keyframes spin {
0% {
top: 0;
-webkit-transform: rotate(0deg);
}
50% {
top: -4em;
-webkit-transform: rotate(-180deg);
}
100% {
top: 0;
-webkit-transform: rotate(-360deg);
}
}
#keyframes spin {
0% {
top: 0;
transform: rotate(0deg);
}
50% {
top: -4em;
transform: rotate(-180deg);
}
100% {
top: 0;
transform: rotate(-360deg);
}
}
I think u need to add a "." before "i", if "i" is your div class name
→ CodePen Example with your code working
-HTML
<div class="i">ANIMATION</div>
-CSS
.i {
height: 2em;
width: 2em;
enter code here border-radius: 100%;
background: #fff;
display: block;
margin: 10em auto;
position: absolute;
left: 50%;
animation: spin 2s ease infinite;
}
.i:before, i:after {
content: "";
display: block;
position: absolute;
height: inherit;
width: inherit;
background: inherit;
border-radius: inherit;
animation: spin 2s ease infinite;
-webkit-animation: spin 2s ease infinite;
-moz-animation: spin 2s ease infinite;
}
.i:before {
left: -2.3em;
}
.i:after {
left: 2.3em;
}
#-moz-keyframes spin {
0% {
top: 0;
-moz-transform: rotate(0deg);
}
50% {
top: -4em;
-moz-transform: rotate(-180deg);
}
100% {
top: 0;
-moz-transform: rotate(-360deg);
}
}
#-webkit-keyframes spin {
0% {
top: 0;
-webkit-transform: rotate(0deg);
}
50% {
top: -4em;
-webkit-transform: rotate(-180deg);
}
100% {
top: 0;
-webkit-transform: rotate(-360deg);
}
}
#keyframes spin {
0% {
top: 0;
transform: rotate(0deg);
}
50% {
top: -4em;
transform: rotate(-180deg);
}
100% {
top: 0;
transform: rotate(-360deg);
}
}
Greetings!
Spin class was causing the issue so I changed the class name. Now working perfectly fine.
.loader {
height: 10px;
width: 10px;
border-radius: 100%;
background: #fff;
display: block;
margin: 10em auto;
position: absolute;
left: 50%;
animation: example 2s ease infinite;
margin-top: 25%;
}
.loader:before,
.loader:after {
content: "";
display: block;
position: absolute;
height: inherit;
width: inherit;
background: inherit;
border-radius: inherit;
animation: example 2s ease infinite;
}
.loader:before {
left: -1.2em;
}
.loader:after {
left: 1.2em;
}
#keyframes example {
0% {
transform: rotate(0deg);
top: 0;
}
50% {
transform: rotate(-180deg);
top: -2em;
}
100% {
transform: rotate(-360deg);
top: 0;
}
}

How to correctly wrap animated word cycle?

How can I make this animated word cycle (made up of absolute positioned spans) to wrap correctly as if it were a regular word inside .sentence? Maybe it's possible to add a ghost inline element with a fixed width (the width of the larger word in the cycle)?
/*Body*/
body {
background-color: #00abe9;
font-family: 'Raleway', sans-serif;
}
/*Heading1*/
h1 {
color: #fff;
font-size: 44px;
margin-top: 40px;
text-align: center;
}
/*Sentence*/
.sentence {
color: #222;
font-size: 30px;
text-align: left;
}
/*Wrapper*/
.wrapper {
background-color: #f5f5f5;
font-family: 'Raleway', sans-serif;
margin: 100px auto;
padding: 40px 40px;
position: relative;
width: 70%;
}
/*Vertical Sliding*/
.slidingVertical {
display: inline;
text-indent: 8px;
}
.slidingVertical span {
animation: topToBottom 12.5s linear infinite 0s;
-ms-animation: topToBottom 12.5s linear infinite 0s;
-webkit-animation: topToBottom 12.5s linear infinite 0s;
color: #00abe9;
opacity: 0;
overflow: hidden;
position: absolute;
}
.slidingVertical span:nth-child(2) {
animation-delay: 2.5s;
-ms-animation-delay: 2.5s;
-webkit-animation-delay: 2.5s;
}
.slidingVertical span:nth-child(3) {
animation-delay: 5s;
-ms-animation-delay: 5s;
-webkit-animation-delay: 5s;
}
.slidingVertical span:nth-child(4) {
animation-delay: 7.5s;
-ms-animation-delay: 7.5s;
-webkit-animation-delay: 7.5s;
}
.slidingVertical span:nth-child(5) {
animation-delay: 10s;
-ms-animation-delay: 10s;
-webkit-animation-delay: 10s;
}
/*topToBottom Animation*/
#-moz-keyframes topToBottom {
0% {
opacity: 0;
}
5% {
opacity: 0;
-moz-transform: translateY(-50px);
}
10% {
opacity: 1;
-moz-transform: translateY(0px);
}
25% {
opacity: 1;
-moz-transform: translateY(0px);
}
30% {
opacity: 0;
-moz-transform: translateY(50px);
}
80% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#-webkit-keyframes topToBottom {
0% {
opacity: 0;
}
5% {
opacity: 0;
-webkit-transform: translateY(-50px);
}
10% {
opacity: 1;
-webkit-transform: translateY(0px);
}
25% {
opacity: 1;
-webkit-transform: translateY(0px);
}
30% {
opacity: 0;
-webkit-transform: translateY(50px);
}
80% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#-ms-keyframes topToBottom {
0% {
opacity: 0;
}
5% {
opacity: 0;
-ms-transform: translateY(-50px);
}
10% {
opacity: 1;
-ms-transform: translateY(0px);
}
25% {
opacity: 1;
-ms-transform: translateY(0px);
}
30% {
opacity: 0;
-ms-transform: translateY(50px);
}
80% {
opacity: 0;
}
100% {
opacity: 0;
}
}
<section class="wrapper">
<h2 class="sentence">Our product is
<div class="slidingVertical">
<span>Amazing.</span>
<span>Beautiful.</span>
<span>Cute.</span>
<span>Delightful.</span>
<span>Emotional.</span>
</div>
</h2>
</section>
View the CodePen.
Don't make all the words position:absolute. Keep one of them position:relative (the longest one) so you can have a correct wrapping:
/*Body*/
body {
background-color: #00abe9;
font-family: 'Raleway', sans-serif;
}
/*Heading1*/
h1 {
color: #fff;
font-size: 44px;
margin-top: 40px;
text-align: center;
}
/*Sentence*/
.sentence {
color: #222;
font-size: 30px;
text-align: left;
}
/*Wrapper*/
.wrapper {
background-color: #f5f5f5;
font-family: 'Raleway', sans-serif;
margin: 100px auto;
padding: 40px 40px;
position: relative;
width: 70%;
}
/*Vertical Sliding*/
.slidingVertical {
display: inline-block;
position:relative; /* added */
vertical-align: text-top; /* added */
}
.slidingVertical span {
animation: topToBottom 12.5s linear infinite 0s;
color: #00abe9;
opacity: 0;
overflow: hidden;
position: absolute;
left:0; /* added */
}
/* added */
.slidingVertical span:nth-child(4) {
position:relative;
display:inline-block;
}
/**/
.slidingVertical span:nth-child(2) {
animation-delay: 2.5s;
}
.slidingVertical span:nth-child(3) {
animation-delay: 5s;
}
.slidingVertical span:nth-child(4) {
animation-delay: 7.5s;
}
.slidingVertical span:nth-child(5) {
animation-delay: 10s;
}
/*topToBottom Animation*/
#keyframes topToBottom {
0% {
opacity: 0;
}
5% {
opacity: 0;
transform: translateY(-50px);
}
10% {
opacity: 1;
transform: translateY(0px);
}
25% {
opacity: 1;
transform: translateY(0px);
}
30% {
opacity: 0;
transform: translateY(50px);
}
80% {
opacity: 0;
}
100% {
opacity: 0;
}
}
<section class="wrapper">
<h2 class="sentence">Our product is
<div class="slidingVertical">
<span>Amazing.</span>
<span>Beautiful.</span>
<span>Cute.</span>
<span>Delightful.</span>
<span>Emotional.</span>
</div>
</h2>
</section>

The CSS animated loader work correctly only once in IE 11

The CSS loader doesn't work sometimes in IE 11. When the page is loaded for the first time, everything is OK. But after the first correct one, the loader is displayed incorrectly, and only the central stick changes it's size. Seems like :before and :after pieces don't work properly. How can I fix it for IE 11? It works fine for Chrome, for example.
.loader {
background: #1C5685;
position: relative;
width: 0.8em;
height: 4em;
margin: 250px auto;
color: #1C5685;
text-indent: -9999em;
font-size: 11px;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
.loader:before {
width: 0.8em;
height: 4em;
background: #1C5685;
content: '';
position: absolute;
top: 0;
left: -1.5em;
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.loader:after {
width: 0.8em;
height: 4em;
background: #1C5685;
content: '';
position: absolute;
top: 0;
left: 1.5em;
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
}
#-webkit-keyframes load1 {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
#keyframes load1 {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
#loadingDiv {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: white;
opacity: 0.7;
z-index: 3;
}
Working Demo:
.loader {
background: #1C5685;
position: relative;
width: 0.8em;
height: 4em;
margin: 250px auto;
color: #1C5685;
text-indent: -9999em;
font-size: 11px;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
.loader:before {
width: 0.8em;
height: 4em;
background: #1C5685;
content: '';
position: absolute;
top: 0;
left: -1.5em;
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.loader:after {
width: 0.8em;
height: 4em;
background: #1C5685;
content: '';
position: absolute;
top: 0;
left: 1.5em;
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
}
#-webkit-keyframes load1 {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
#keyframes load1 {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
#loadingDiv {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: white;
opacity: 0.7;
z-index: 3;
}
<div id="loadingDiv">
<div class="loader">Loading...</div>
</div>
UPD:
It was to pulse like this
But it did it like this (only middle stick pulsed)
So the solution was found by myself - to replace the unproperly working in IE ":before" and ":after" pseudo-elements with REAL elements, to update their animation delays and to put them together (they are not displayed by default and become visible on loadings):
<!-- 3 loadingDiv's with loaders inside: 1 div for each of 3 animated sticks of loader -->
<div style="display:none" id="loadingDiv1">
<div class="loader1" >Loading...</div>
</div>
<div style="display:none" id="loadingDiv2">
<div class="loader2" >Loading...</div>
</div>
<div style="display:none" id="loadingDiv3">
<div class="loader3" >Loading...</div>
</div>
.loader1,
.loader2,
.loader3 {
background: #1C5685;
position: relative;
width: 0.8em;
height: 4em;
margin: 250px auto;
color: #1C5685;
text-indent: -9999em;
font-size: 11px;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
}
.loader1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.loader2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
/* .loader3 has 0 delay */
#-webkit-keyframes load1 {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
#keyframes load1 {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
#loadingDiv1,
#loadingDiv2,
#loadingDiv3 {
position: fixed;
top: 0;
width: 100%;
height: 100%;
opacity: 0.7;
z-index: 3;
}
#loadingDiv1 {
left: -1em;
background-color: white;
}
#loadingDiv2 {
left: 0;
}
#loadingDiv3 {
left: 1em;
}

CSS 3 Animation with Keyframes on hover change of opacity and z-index don't work

I have some moving word css3 animation.
The animation is fine (snippet). If someone use hover the animation stops (fine), but don't accept a change of the opacity and z-index (.bubble:hover).
opacity: 1;
z-index: 100;
The .bubble:hover class is in use the transform action works.
transform: scale(1.2);
The aim is to pop the hovered bubble in the foreground.
If the bubble is left the animation should move on from the point of stop.
How can I fix it?
Thanks for help.
.solSystem {
postion: absolute;
height: 25vw;
}
.orbitLink,
.orbitLink:active,
.orbitLink:visited {
color: #FFF;
}
.mars:hover,
.earth:hover {
animation-play-state: paused;
}
.bubble:hover {
background: #DE383B !Important;
padding: 1vw;
border: 0.1vw solid #000;
color: #FFF !Important;
transform: scale(1.2);
opacity: 1;
z-index: 100;
}
.mars {
float: left;
margin: 4vw auto;
border-radius: 50%;
position: absolute;
animation-name: moveRigthToLeft, scale, color;
animation-iteration-count: infinite, infinite;
animation-timing-function: ease-in-out, linear;
}
.earth {
float: left;
margin: 4vw auto;
border-radius: 50%;
position: absolute;
animation-name: moveLeftToRigth, scale, color;
animation-iteration-count: infinite, infinite;
animation-timing-function: ease-in-out, linear;
}
.bubble {
padding: 1vw;
color: #FFF;
border-color: #000;
border-width: 0.1vw;
background-color: #004A99;
font-weight: bold;
font-size: 1.1vw;
font-family: Arial, FreeSans, sans-serif;
position: absolute;
border-style: solid;
border-radius: 100%;
}
#keyframes moveLeftToRigth {
0% {
left: 15vw;
}
50% {
left: 40vw;
}
100% {
left: 15vw;
}
}
#keyframes scale {
0% {
transform: scale(1);
}
32% {
transform: scale(0.7);
animation-timing-function: ease-in;
}
70% {
transform: scale(0.8);
animation-timing-function: ease-in;
}
75% {
transform: scale(0.9);
animation-timing-function: ease-in-out;
}
86% {
transform: scale(1.2);
}
98% {
transform: scale(1.1);
}
100% {
transform: scale(1);
}
}
#keyframes color {
0% {
opacity: 0.5;
z-index: 1;
}
20% {
opacity: 0.6;
z-index: 2;
}
40% {
opacity: 0.7;
z-index: 3;
}
60% {
opacity: 0.8;
z-index: 4;
}
80% {
opacity: 0.9;
z-index: 5;
}
90% {
opacity: 1;
z-index: 6;
}
95% {
opacity: 0.8;
z-index: 4;
}
100% {
opacity: 0.6;
z-index: 2;
}
}
<div class="solSystem">
<a href="Test1.html">
<div class="earth" style="animation-duration: 20s,20s,20s;">
<div class="bubble" style="left:12vw;">
Test1
</div>
</div>
</a>
<a href="Test2.html">
<div class="mars" style="animation-duration: 30s,30s,30s;">
<div class="bubble" style="left:30vw;">
Test2
</div>
</div>
</a>
</div>
This happend cause you gave to parent div less opacity with "color" keyframes and then apply that animation to parent of a hovered div. You should make color changes on "bubble" div.
codepen:
http://codepen.io/bra1N/pen/dXKLbp
.solSystem {
postion: absolute;
height: 25vw;
}
.orbitLink,
.orbitLink:active,
.orbitLink:visited {
color: #FFF;
}
.mars:hover,
.earth:hover {
animation-play-state: paused;
}/*
.bubble:hover {
background: #DE383B !Important;
padding: 1vw;
border: 0.1vw solid #000;
color: #FFF !Important;
transform: scale(1.2);
opacity: 1 !important;
z-index: 100 !important;
}*/
.mars {
float: left;
margin: 4vw auto;
border-radius: 50%;
position: absolute;
animation-name: moveRigthToLeft, scale;
animation-iteration-count: infinite, infinite;
animation-timing-function: ease-in-out, linear;
}
.earth {
float: left;
margin: 4vw auto;
border-radius: 50%;
position: absolute;
animation-name: moveLeftToRigth, scale;
animation-iteration-count: infinite, infinite;
animation-timing-function: ease-in-out, linear;
}
.bubble {
padding: 1vw;
color: #FFF;
border-color: #000;
border-width: 0.1vw;
background-color: #004A99;
font-weight: bold;
font-size: 1.1vw;
font-family: Arial, FreeSans, sans-serif;
position: absolute;
border-style: solid;
border-radius: 100%;
animation-name: color;
animation-iteration-count: infinite;
animation-duration: 30s;
}
#keyframes moveLeftToRigth {
0% {
left: 15vw;
}
50% {
left: 40vw;
}
100% {
left: 15vw;
}
}
#keyframes scale {
0% {
transform: scale(1);
}
32% {
transform: scale(0.7);
animation-timing-function: ease-in;
}
70% {
transform: scale(0.8);
animation-timing-function: ease-in;
}
75% {
transform: scale(0.9);
animation-timing-function: ease-in-out;
}
86% {
transform: scale(1.2);
}
98% {
transform: scale(1.1);
}
100% {
transform: scale(1);
}
}
#keyframes color {
0% {
opacity: 0.4;
z-index: 1;
}
20% {
opacity: 0.6;
z-index: 2;
}
40% {
opacity: 0.7;
z-index: 3;
}
60% {
opacity: 0.8;
z-index: 4;
}
80% {
opacity: 0.9;
z-index: 5;
}
90% {
opacity: 1;
z-index: 6;
}
95% {
opacity: 0.8;
z-index: 4;
}
100% {
opacity: 0.6;
z-index: 2;
}
}
<div class="solSystem">
<a href="Test1.html">
<div class="earth" style="animation-duration: 20s,20s,20s;">
<div class="bubble" style="left:12vw;">
Test1
</div>
</div>
</a>
<a href="Test2.html">
<div class="mars" style="animation-duration: 30s,30s,30s;">
<div class="bubble" style="left:30vw;">
Test2
</div>
</div>
</a>
</div>

Keyframe Animation only working in Internet Explorer

I am trying to add this scroll animation script to my website: http://codepen.io/zutrinken/pen/yhqEA
#scrolldown {
bottom: 40px;
height: 100px;
margin-left: -50px;
position: absolute;
left: 50%;
text-align: center;
width: 100px;
z-index: 100;
}
#scrolldown p {
font: 700 0.7em/1em 'Avenir',sans-serif;
animation-duration: 2s;
animation-fill-mode: both;
animation-iteration-count: infinite;
animation-name: scroll;
color: #000;
}
#scrolldown > p {
text-transform: uppercase;
text-indent: 3px;
}
.mouse {
border: 2px solid #000;
border-radius: 13px;
display: block;
height: 46px;
left: 50%;
margin: 10px 0 0 -13px;
position: absolute;
width: 26px;
}
.mouse span {
display: block;
font-size: 1.5em;
margin: 6px auto;
}
#keyframes scroll {
0% {
opacity: 1;
transform: translateY(0px);
}
100% {
opacity: 0;
transform: translateY(10px);
}
}
<div id="scrolldown">
<p>scroll</p>
<div class="mouse">
<span><p>↓</p></span>
</div>
</div>
The animation works in Chrome while in Code Pen but i can not get it to work outside of Code Pen. How Can I get this script to work with other browsers?
http://rapidevac.biz/tapreport/ This is my website that i added the script to. Like i said, it works with IE 9 but not with other browsers.
Thanks guys for reviewing my question!
Add this after your #keyframes scroll to se the animation in all browsers
#-moz-keyframes scroll {
0% {
opacity: 1;
transform: translateY(0px);
}
100% {
opacity: 0;
transform: translateY(10px);
}
}
#-o-keyframes scroll {
0% {
opacity: 1;
transform: translateY(0px);
}
100% {
opacity: 0;
transform: translateY(100px);
}
}
#-webkit-keyframes scroll {
0% {
opacity: 1;
transform: translateY(0px);
}
100% {
opacity: 0;
transform: translateY(100px);
}
}
#keyframes scroll {
0% {
opacity: 1;
transform: translateY(0px);
}
100% {
opacity: 0;
transform: translateY(10px);
}
}
Your transitions are not cross-browser friendly.
Change your #scrolldown p css to this:
#scrolldown p {
font: 700 0.7em/1em 'Avenir',sans-serif;
animation-duration: 2s;
animation-fill-mode: both;
animation-iteration-count: infinite;
animation-name: scroll;
-webkit-animation-duration: 2s;
-webkit-animation-fill-mode: both;
-webkit-animation-iteration-count: infinite;
-webkit-animation-name: scroll;
-moz-animation-duration: 2s;
-moz-animation-fill-mode: both;
-moz-animation-iteration-count: infinite;
-moz-animation-name: scroll;
-o-animation-name: scroll;
-o-animation-duration: 2s;
-o-animation-fill-mode: both;
-o-animation-iteration-count: infinite;
}