Css3 Animation looping in webkit-animation - html

I have a problem with css3 animation effect.I want to know how to continue looping without go to start place.
As a example. when clouds are moving, the webkit-animation time over, it come to first step and start animate again.So it not nice because cloud go to back and again start moving (watch 7 seconds), i want to continue animation without cloud goes to start.
DEMO Here
CSS3
.sky {
height:638px;
background:#007fd5;
position:relative;
overflow:hidden;
-webkit-animation:sky_background 50s ease-out infinite;
-moz-animation:sky_background 50s ease-out infinite;
-o-animation:sky_background 50s ease-out infinite;
-webkit-transform:translate3d(0,0,0);
-moz-transform:translate3d(0,0,0);
-o-transform:translate3d(0,0,0)
}
.moon {
background:url("http://montanaflynn.me/lab/css-clouds/images/moon.png");
position:absolute;
left:0;
height:85%;
width:300%;
-webkit-animation:moon 50s linear infinite;
-moz-animation:moon 50s linear infinite;
-o-animation:moon 50s linear infinite;
-webkit-transform:translate3d(0,0,0);
-moz-transform:translate3d(0,0,0);
-o-transform:translate3d(0,0,0)
}
.clouds_one {
margin-top: -55px;
background:url("http://montanaflynn.me/lab/css-clouds/images/cloud_one.png");
position:absolute;
left:0;
top:0;
height:80%;
width:400%;
-webkit-animation:cloud_one 5s linear infinite;
-moz-animation:cloud_one 5s linear infinite;
-o-animation:cloud_one 5s linear infinite;
-webkit-transform:translate3d(0,0,0);
-moz-transform:translate3d(0,0,0);
-o-transform:translate3d(0,0,0)
}
.clouds_two {
background:url("http://montanaflynn.me/lab/css-clouds/images/cloud_two.png");
position:absolute;
left:0;
top:0;
height:80%;
width:400%;
-webkit-animation:cloud_two 7s linear infinite;
-moz-animation:cloud_two 7s linear infinite;
-o-animation:cloud_two 7s linear infinite;
-webkit-transform:translate3d(0,0,0);
-moz-transform:translate3d(0,0,0);
-o-transform:translate3d(0,0,0)
}
.clouds_three {
background:url("http://montanaflynn.me/lab/css-clouds/images/cloud_three.png");
position:absolute;
left:0;
top:0;
height:75%;
width:400%;
-webkit-animation:cloud_three 10s linear infinite;
-moz-animation:cloud_three 10s linear infinite;
-o-animation:cloud_three 10s linear infinite;
-webkit-transform:translate3d(0,0,0);
-moz-transform:translate3d(0,0,0);
-o-transform:translate3d(0,0,0)
}
#-webkit-keyframes sky_background {
0% {
background:#007fd5;
color:#007fd5
}
50% {
background:#007fd5;
color:#007fd5
}
100% {
background:#007fd5;
color:#007fd5
}
}
#-webkit-keyframes moon {
0% {
opacity: 0;
left:-200%
-moz-transform: scale(0.5);
-webkit-transform: scale(0.5);
}
50% {
opacity: 1;
-moz-transform: scale(1);
left:0%
bottom:250px;
-webkit-transform: scale(1);
}
100% {
opacity: 0;
bottom:500px;
-moz-transform: scale(0.5);
-webkit-transform: scale(0.5);
}
}
#-webkit-keyframes cloud_one {
0% {
left:0
}
100% {
left:-200%
}
}
#-webkit-keyframes cloud_two {
0% {
left:0
}
100% {
left:-200%
}
}
#-webkit-keyframes cloud_three {
0% {
left:0
}
100% {
left:-200%
}
}
#-moz-keyframes sky_background {
0% {
background:#007fd5;
color:#007fd5
}
50% {
background:#000;
color:#a3d9ff
}
100% {
background:#007fd5;
color:#007fd5
}
}
#-moz-keyframes moon {
0% {
opacity: 0;
left:-200%
-moz-transform: scale(0.5);
-webkit-transform: scale(0.5);
}
50% {
opacity: 1;
-moz-transform: scale(1);
left:0%
bottom:250px;
-webkit-transform: scale(1);
}
100% {
opacity: 0;
bottom:500px;
-moz-transform: scale(0.5);
-webkit-transform: scale(0.5);
}
}
#-moz-keyframes cloud_one {
0% {
left:0
}
100% {
left:-200%
}
}
#-moz-keyframes cloud_two {
0% {
left:0
}
100% {
left:-200%
}
}
#-moz-keyframes cloud_three {
0% {
left:0
}
100% {
left:-200%
}
}
HTML
<div class="sky">
<div class="clouds_one"></div>
<div class="clouds_two"></div>
<div class="clouds_three"></div>
</div>

Related

How to add full page color background to a single element loading animation?

I have a single html div that I am using for a loading screen element. I need to add a full page background color. In other words, I need the rotating image to be on top of a solid color full page background.
Also, I can only use one element. Here is what I have so far:
.animsition-loading {
background-image: url('../images/logo-loading.png');
width: 100px;
height: 111px;
background-repeat: no-repeat;
background-size: contain;
position: fixed;
top: 50%;
left: 50%;
margin-top: -16px;
margin-left: -16px;
-webkit-animation: spin1 .5s infinite linear;
-moz-animation: spin1 .5s infinite linear;
-o-animation: spin1 .5s infinite linear;
-ms-animation: spin1 .5s infinite linear;
animation: spin1 .5s infinite linear;
}
#-webkit-keyframes spin1 {
0% { -webkit-transform: rotate(0deg);}
100% { -webkit-transform: rotate(360deg);}
}
#-moz-keyframes spin1 {
0% { -moz-transform: rotate(0deg);}
100% { -moz-transform: rotate(360deg);}
}
#-o-keyframes spin1 {
0% { -o-transform: rotate(0deg);}
100% { -o-transform: rotate(360deg);}
}
#-ms-keyframes spin1 {
0% { -ms-transform: rotate(0deg);}
100% { -ms-transform: rotate(360deg);}
}
#-keyframes spin1 {
0% { transform: rotate(0deg);}
100% { transform: rotate(360deg);}
}
You could possibly use psuedo elements. If you have your container cover the whole viewport, then absolutely position the psuedo after element in the center like so:
.animation-loading{
position: fixed;
width: 100vw;
height: 100vh;
background-color: YOUR_COLOUR;
}
.animation-loading::after{
content: "";
display: block;
background-image: url('../images/logo-loading.png');
width: 100px;
height: 111px;
background-repeat: no-repeat;
background-size: contain;
position: absolute;
top: 50%;
left: 50%;
margin-top: -16px;
margin-left: -16px;
-webkit-animation: spin1 .5s infinite linear;
-moz-animation: spin1 .5s infinite linear;
-o-animation: spin1 .5s infinite linear;
-ms-animation: spin1 .5s infinite linear;
animation: spin1 .5s infinite linear;
}
#-webkit-keyframes spin1 {
0% { -webkit-transform: rotate(0deg);}
100% { -webkit-transform: rotate(360deg);}
}
#-moz-keyframes spin1 {
0% { -moz-transform: rotate(0deg);}
100% { -moz-transform: rotate(360deg);}
}
#-o-keyframes spin1 {
0% { -o-transform: rotate(0deg);}
100% { -o-transform: rotate(360deg);}
}
#-ms-keyframes spin1 {
0% { -ms-transform: rotate(0deg);}
100% { -ms-transform: rotate(360deg);}
}
#-keyframes spin1 {
0% { transform: rotate(0deg);}
100% { transform: rotate(360deg);}
}
You can use this HTML for "loading circle":
<div id='loading-bg' style='display:none; position:fixed; z-index:9999; top:0; right:0; bottom:0; left:0; background-color:rgba(0,0,0,0.4); width:100%; height:100%;'><div id='floatingCirclesG' style='position:fixed; top:50%; left:50%; margin-left:-64px; margin-top:-64px;'><div class='f_circleG' id='frotateG_01'></div><div class='f_circleG' id='frotateG_02'></div><div class='f_circleG' id='frotateG_03'></div><div class='f_circleG' id='frotateG_04'></div><div class='f_circleG' id='frotateG_05'></div><div class='f_circleG' id='frotateG_06'></div><div class='f_circleG' id='frotateG_07'></div><div class='f_circleG' id='frotateG_08'></div></div></div>
together with this CSS:
#floatingCirclesG{
position:relative;
width:128px;
height:128px;
-moz-transform:scale(0.6);
-webkit-transform:scale(0.6);
-ms-transform:scale(0.6);
-o-transform:scale(0.6);
transform:scale(0.6);
}
.f_circleG{
position:absolute;
background-color:#c1c9ce;
height:23px;
width:23px;
-moz-border-radius:12px;
-moz-animation-name:f_fadeG;
-moz-animation-duration:0.64s;
-moz-animation-iteration-count:infinite;
-moz-animation-direction:linear;
-webkit-border-radius:12px;
-webkit-animation-name:f_fadeG;
-webkit-animation-duration:0.64s;
-webkit-animation-iteration-count:infinite;
-webkit-animation-direction:linear;
-ms-border-radius:12px;
-ms-animation-name:f_fadeG;
-ms-animation-duration:0.64s;
-ms-animation-iteration-count:infinite;
-ms-animation-direction:linear;
-o-border-radius:12px;
-o-animation-name:f_fadeG;
-o-animation-duration:0.64s;
-o-animation-iteration-count:infinite;
-o-animation-direction:linear;
border-radius:12px;
animation-name:f_fadeG;
animation-duration:0.64s;
animation-iteration-count:infinite;
animation-direction:linear;
}
#frotateG_01{
left:0;
top:52px;
-moz-animation-delay:0.24s;
-webkit-animation-delay:0.24s;
-ms-animation-delay:0.24s;
-o-animation-delay:0.24s;
animation-delay:0.24s;
}
#frotateG_02{
left:15px;
top:15px;
-moz-animation-delay:0.32s;
-webkit-animation-delay:0.32s;
-ms-animation-delay:0.32s;
-o-animation-delay:0.32s;
animation-delay:0.32s;
}
#frotateG_03{
left:52px;
top:0;
-moz-animation-delay:0.4s;
-webkit-animation-delay:0.4s;
-ms-animation-delay:0.4s;
-o-animation-delay:0.4s;
animation-delay:0.4s;
}
#frotateG_04{
right:15px;
top:15px;
-moz-animation-delay:0.48s;
-webkit-animation-delay:0.48s;
-ms-animation-delay:0.48s;
-o-animation-delay:0.48s;
animation-delay:0.48s;
}
#frotateG_05{
right:0;
top:52px;
-moz-animation-delay:0.56s;
-webkit-animation-delay:0.56s;
-ms-animation-delay:0.56s;
-o-animation-delay:0.56s;
animation-delay:0.56s;
}
#frotateG_06{
right:15px;
bottom:15px;
-moz-animation-delay:0.64s;
-webkit-animation-delay:0.64s;
-ms-animation-delay:0.64s;
-o-animation-delay:0.64s;
animation-delay:0.64s;
}
#frotateG_07{
left:52px;
bottom:0;
-moz-animation-delay:0.72s;
-webkit-animation-delay:0.72s;
-ms-animation-delay:0.72s;
-o-animation-delay:0.72s;
animation-delay:0.72s;
}
#frotateG_08{
left:15px;
bottom:15px;
-moz-animation-delay:0.8s;
-webkit-animation-delay:0.8s;
-ms-animation-delay:0.8s;
-o-animation-delay:0.8s;
animation-delay:0.8s;
}
#-moz-keyframes f_fadeG{
0%{
background-color:#123041}
100%{
background-color:#c1c9ce}
}
#-webkit-keyframes f_fadeG{
0%{
background-color:#123041}
100%{
background-color:#c1c9ce}
}
#-ms-keyframes f_fadeG{
0%{
background-color:#123041}
100%{
background-color:#c1c9ce}
}
#-o-keyframes f_fadeG{
0%{
background-color:#123041}
100%{
background-color:#c1c9ce}
}
#keyframes f_fadeG{
0%{
background-color:#123041}
100%{
background-color:#c1c9ce}
}
...and you are done! Fiddle here: https://jsfiddle.net/62zgk0qw/

CSS keyframes animation not working in Safari

I have made an animation for some elements (images and buttons) to fade in and out using opacity. It works perfectly on all browsers, except on Safari. When I try to run it in Safari, all my elements has 100% opacity without any animation to see..
Example from the button element:
Here is my HTML:
<div id = "ctaButton" class="animate-fadeButton">
</div>
And my CSS:
#ctaButton{
position:absolute;
margin: auto;
left: 26%;
top:70%;
padding:10px; background: #CCC;
background-color: rgba(255,131,15,0.5);
}
#keyframes fadeButton {
0% { opacity:0; }
25% { opacity:0; }
35% { opacity:1; }
90% { opacity:1; }
100% { opacity:0; }
animation-timing-function: linear;
}
#-o-keyframes fadeButton{
0% { opacity:0; }
25% { opacity:0; }
35% { opacity:1; }
90% { opacity:1; }
100% { opacity:0; }
animation-timing-function: linear;
}
#-moz-keyframes fadeButton{
0% { opacity:0; }
25% { opacity:0; }
35% { opacity:1; }
90% { opacity:1; }
100% { opacity:0; }
animation-timing-function: linear;
}
#-webkit-keyframes fadeButton{
0% { opacity:0; }
25% { opacity:0; }
35% { opacity:1; }
90% { opacity:1; }
100% { opacity:0; }
-webkit-animation-timing-function: linear;
}
.animate-fadeButton {
-webkit-animation: fadeButton 15s infinite;
-moz-animation: fadeButton 15s infinite;
-o-animation: fadeButton 15s infinite;
animation: fadeButton 15s infinite;
}
You need to set the animation name and timing before the keyframes animation and not after
CSS
#ctaButton {
position: absolute;
margin: auto;
left: 26%;
top: 70%;
padding: 10px;
background: #CCC;
background-color: rgba(255, 131, 15, 0.5);
}
.animate-fadeButton {
-webkit-animation: fadeButton 15s infinite;
-moz-animation: fadeButton 15s infinite;
-o-animation: fadeButton 15s infinite;
animation: fadeButton 15s infinite;
}
#keyframes fadeButton {
0% {
opacity: 0;
}
25% {
opacity: 0;
}
35% {
opacity: 1;
}
90% {
opacity: 1;
}
100% {
opacity: 0;
}
animation-timing-function: linear;
}
#-o-keyframes fadeButton {
0% {
opacity: 0;
}
25% {
opacity: 0;
}
35% {
opacity: 1;
}
90% {
opacity: 1;
}
100% {
opacity: 0;
}
animation-timing-function: linear;
}
#-moz-keyframes fadeButton {
0% {
opacity: 0;
}
25% {
opacity: 0;
}
35% {
opacity: 1;
}
90% {
opacity: 1;
}
100% {
opacity: 0;
}
animation-timing-function: linear;
}
#-webkit-keyframes fadeButton {
0% {
opacity: 0;
}
25% {
opacity: 0;
}
35% {
opacity: 1;
}
90% {
opacity: 1;
}
100% {
opacity: 0;
}
-webkit-animation-timing-function: linear;
}

The image is not spinning

I followed the explanations on this jsFiddle page http://jsfiddle.net/gionaf/Ugc5g/ to spin an image on my page http://www.prezzio.net/ but it does not work: the image is not spinning.
To be clear, here is the image to spin:
Here is the original code:
.spin {
position: absolute;
top: 50%;
left: 50%;
width: 120px;
height: 120px;
margin:-60px 0 0 -60px;
-webkit-animation:spin 4s linear infinite;
-moz-animation:spin 4s linear infinite;
animation:spin 4s linear infinite;
}
#-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
#-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
#keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
<img class="spin" src="http://makeameme.org/media/templates/120/grumpy_cat.jpg" alt="" width="120" height="120">
Any idea ? Thanks.
The culprit lies in your main_style.css line 369.
Add these lines,
#-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
#-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
#keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
And it should spin as you expect.
Try this, here is Demo with all Vendor prefixes
img {
animation: 2s spin infinite linear;
}
#keyframes spin {
to {transform: rotate(360deg);}
}
<img src="http://www.prezzio.net/files/theme/spin.png" alt="">

<p> tag won't stay on hovered state even when hovering over it

I have a <p> tag, and when I hover over it I want it to play an animation with #keyframes. It does the animation perfectly, but when the animation has finished, it will revert back to the state before the hovering. Does anyone know what I'm doing wrong?
EDIT: If you'd rather use a fiddle, check this out.
The reason why the buttons flash red is purely for testing reasons.
My HTML is as follows:
<div id="imgOver9" class="imgOver">
<p id="pLink9" class="pLink" href="home.html">Chillin', relaxin', maxin' all cool and shootin' some b-ball outside of school</p>
</div>
Here is the CSS for the <p> element:
.pLink{
position:absolute;
left:1vw;
top:-1vw;
height:24vw;
width:24vw;
opacity:0;
text-align:justify;
display:block;
font-family: 'Antic Didone', 'serif';
z-index:1;
background-color:red;
font-size:2vw;
}
.pLink:hover{
animation: pLink linear 0.1s;
animation-iteration-count: 1;
transform-origin:;
-webkit-animation: pLink linear 0.1s;
-webkit-animation-iteration-count: 10;
-webkit-transform-origin: ;
-moz-animation: pLink linear 0.1s;
-moz-animation-iteration-count: 1;
-moz-transform-origin: ;
-o-animation: pLink linear 0.1s;
-o-animation-iteration-count: 1;
-o-transform-origin: ;
-ms-animation: pLink linear 0.1s;
-ms-animation-iteration-count: 1;
-ms-transform-origin: ;
}
#keyframes pLink{
0% {
opacity:0;
color:#000000
}
100% {
opacity:1;
color:#8C8C96;
}
}
#-moz-keyframes pLink{
0% {
opacity:0;
color:#000000
}
100% {
opacity:1;
color:#8C8C96;
}
}
#-webkit-keyframes pLink {
0% {
opacity:0;
color:#000000
}
100% {
opacity:1;
color:#8C8C96;
}
}
#-o-keyframes pLink {
0% {
opacity:0;
color:#000000
}
100% {
opacity:1;
color:#8C8C96;
}
}
#-ms-keyframes pLink {
0% {
opacity:0;
color:#000000
}
100% {
opacity:1;
color:#8C8C96;
}
}
And here is the CSS for the parent div:
.imgOver{
opacity:0%;
width:26vw;
height:26vw;
}
.imgOver:hover{
animation: imgOver linear 0.1s;
animation-iteration-count: 1;
transform-origin: ;
-webkit-animation: imgOver linear 0.1s;
-webkit-animation-iteration-count: 1;
-webkit-transform-origin: ;
-moz-animation: imgOver linear 0.1s;
-moz-animation-iteration-count: 1;
-moz-transform-origin: ;
-o-animation: imgOver linear 0.1s;
-o-animation-iteration-count: 1;
-o-transform-origin: ;
-ms-animation: imgOver linear 0.1s;
-ms-animation-iteration-count: 1;
-ms-transform-origin: ;
}
#keyframes imgOver{
0% {
opacity:0;
}
100% {
opacity:1;
}
}
#-moz-keyframes imgOver{
0% {
opacity:0;
}
100% {
opacity:1;
}
}
#-webkit-keyframes imgOver {
0% {
opacity:0;
}
100% {
opacity:1;
}
}
#-o-keyframes imgOver {
0% {
opacity:0;
}
100% {
opacity:1;
}
}
#-ms-keyframes imgOver {
0% {
opacity:0;
}
100% {
opacity:1;
}
}
I have been going over this for hours now, and I cannot find the flaw. I would be very grateful for whoever manages to solve my issue.
You will need to use animation: pLink 0.1s forwards; in order to keep the final state of the animation.
Here is a demo fiddle

CSS3 Animation doesn't work in IE10

This JSFiddle contains a CSS animation that works for me in Chrome, Firefox and Safari, but not IE 10. It doesn't start the animation in IE10 - can't see anything wrong here?
.x1 {
left: 200px;
top: -150px;
-webkit-transform: scale(0.8);
-moz-transform: scale(0.8);
-o-transform: scale(0.8);
-ms-transform: scale(0.8);
transform: scale(0.8);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
filter: alpha(opacity=80);
opacity: 0.8;
-webkit-animation: moveclouds 47s linear infinite;
-moz-animation: moveclouds 47s linear infinite;
-ms-animation: moveclouds 47s linear infinite;
-o-animation: moveclouds 47s linear infinite;
animation: moveclouds 47s linear infinite;
}
#keyframes "moveclouds" {
0% {
margin-left: 1000px;
}
100% {
margin-left: -1000px;
}
}
#-moz-keyframes moveclouds {
0% {
margin-left: 1000px;
}
100% {
margin-left: -1000px;
}
}
#-webkit-keyframes "moveclouds" {
0% {
margin-left: 1000px;
}
100% {
margin-left: -1000px;
}
}
#-ms-keyframes "moveclouds" {
0% {
margin-left: 1000px;
}
100% {
margin-left: -1000px;
}
}
#-o-keyframes "moveclouds" {
0% {
margin-left: 1000px;
}
100% {
margin-left: -1000px;
}
}
Here's the JsFiddle Link http://jsfiddle.net/zXTSp/1/
Try the Jsfiddle in IE10
http://jsfiddle.net/2V3Sx/
It should be #-webkit-keyframes moveclouds {
not #-webkit-keyframes "moveclouds" {...a typo...:)
Hope this works