The css animation is http://codepen.io/pksunkara/pen/gbejPv. It was inspired by http://codepen.io/fbrz/pen/ljuJn.
EDIT: How do you stop the first frame jump in that codepen?
HTML of my codepen is given below.
<div id="loader">
<div id="loaderout" class="box">
<div id="loaderin" class="box"></div>
<div class="ballbox box">
<div class="first-1 ball"></div>
<div class="second-1 ball"></div>
</div>
</div>
<div class="ballbox box">
<div class="first-2 ball"></div>
<div class="second-2 ball"></div>
</div>
</div>
CSS of my codepen is given below:
body {
background: #e9e9e9;
}
#loader {
position: absolute;
top: calc(50% - 40px);
left: calc(50% - 40px);
}
.box {
width: 80px;
height: 80px;
}
#loaderout + .ballbox {
animation: rotate-1 1.5s linear infinite;
}
#loaderin + .ballbox {
animation: rotate-2 1.5s ease-in-out infinite;
}
#loaderout {
animation: rotate-1 1.5s linear infinite;
clip: rect(0, 80px, 80px, 40px);
position: absolute;
}
#keyframes rotate-1 {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(220deg);
}
}
#keyframes rotate-2 {
0% {
transform: rotate(-140deg);
}
100% {
transform: rotate(140deg);
}
}
#loaderin {
animation: rotate-2 1.5s ease-in-out infinite,
animate 1.5s ease-in-out infinite;
clip: rect(0, 80px, 80px, 40px);
border-radius: 50%;
height: 80px;
width: 80px;
position: absolute;
}
#keyframes animate {
0% {
box-shadow: inset #e04e38 0 0 0 16px;
}
50% {
box-shadow: inset #e04e38 0 0 0 2px;
}
100% {
box-shadow: inset #e04e38 0 0 0 16px;
}
}
.ball {
position: absolute;
background: #e04e38;
border-radius: 50%;
}
.first-1 {
animation: borderball 1.5s ease-in-out infinite;
}
.second-1 {
animation: borderball 1.5s ease-in-out infinite;
bottom: 0;
}
.first-2 {
animation: borderball 1.5s ease-in-out infinite,
firstball 1.5s ease-in-out infinite;
}
.second-2 {
animation: borderball 1.5s ease-in-out infinite,
secondball 1.5s ease-in-out infinite;
bottom: 0;
visibility: hidden;
}
#keyframes firstball {
1%, 49% {
visibility: visible;
}
0%, 50%, 100% {
visibility: hidden;
}
}
#keyframes secondball {
0%, 50%, 100% {
visibility: hidden;
}
51%, 99% {
visibility: visible;
}
}
#keyframes borderball {
0%, 100% {
width: 16px;
height: 16px;
left: 32px;
}
50% {
width: 2px;
height: 2px;
left: 38px;
}
}
I fixed it by changing some specific CSS rules to the following.
.second-2 {
animation: borderball 1.5s ease-in-out infinite,
secondball 1.5s ease-in-out infinite;
bottom: 0;
opacity: 0;
}
#keyframes firstball {
0%, 50% {
opacity: 1;
}
51%, 100% {
opacity: 0;
}
}
#keyframes secondball {
0%, 50% {
opacity: 0;
}
51%, 100% {
opacity: 1;
}
}
Related
I need to animate this CSS animation infinitely. I added the animation-iteration-count: infinite;. But it didn't work.
What I need to do to animate this infinitely?
.pre-loader-area {
position: fixed;
z-index: 10;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.9);
opacity: 1;
}
.pre-loader {
width: 20vw;
height: 20vw;
margin-left: auto;
margin-right: auto;
transform: translateY(40vh);
}
.pre-loader-block-line1,
.pre-loader-block-line2 {
position: relative;
width: 20vw;
height: 9vw;
}
.pre-loader-block-line2 {
position: relative;
top: 2.5vw;
}
.pre-loader-blocks {
position: relative;
float: left;
background-color: rgba(255, 255, 255, 0.8);
width: 41%;
height: 90%;
}
.block2,
.block4 {
float: right;
}
.block1 {
animation: scale-up 1s, scale-down 1s 1s, stay 6s 2s;
animation-iteration-count: infinite;
}
.block2 {
animation: scale-up 1s 1s, scale-down 1s 2s, stay 6s 3s;
animation-iteration-count: infinite;
}
.block4 {
animation: scale-up 1s 2s, scale-down 1s 3s, stay 6s 4s;
animation-iteration-count: infinite;
}
.block3 {
animation: scale-up 1s 3s, scale-down 1s 4s, stay 6s 5s;
animation-iteration-count: infinite;
}
#keyframes scale-up {
0% {
scale: 1;
}
100% {
scale: 1.2;
}
}
#keyframes scale-down {
0% {
scale: 1.2;
}
100% {
scale: 1;
}
}
#keyframes stay {
0% {
scale: 1;
}
100% {
scale: 1;
}
}
<div class="pre-loader-area">
<div class="pre-loader">
<div class="pre-loader-block-line1">
<div class="block1 pre-loader-blocks"></div>
<div class="block2 pre-loader-blocks"></div>
</div>
<div class="pre-loader-block-line2">
<div class="block3 pre-loader-blocks"></div>
<div class="block4 pre-loader-blocks"></div>
</div>
</div>
</div>
I think your best option would be to a single animation which you use for each of the blocks. You can then set the animtion for each block with a different delay (with will make a difference just for the 1st time the animation plays)
I have created a little snippet to help illustrate what i mean
.pre-loader-area {
position: fixed;
z-index: 10;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.9);
opacity: 1;
}
.pre-loader {
width: 20vw;
height: 20vw;
margin-left: auto;
margin-right: auto;
transform: translateY(40vh);
}
.pre-loader-block-line1,
.pre-loader-block-line2 {
position: relative;
width: 20vw;
height: 9vw;
}
.pre-loader-block-line2 {
position: relative;
top: 2.5vw;
}
.pre-loader-blocks {
position: relative;
float: left;
background-color: rgba(255, 255, 255, 0.8);
width: 41%;
height: 90%;
}
.block2,
.block4 {
float: right;
}
.block1 {
animation: blockAnimation 4s infinite 0s;
}
.block2 {
animation: blockAnimation 4s infinite 1s;
}
.block3 {
animation: blockAnimation 4s infinite 3s;
}
.block4 {
animation: blockAnimation 4s infinite 2s;
}
#keyframes blockAnimation {
0% {
scale: 1;
}
20% {
scale: 1.2;
}
40% {
scale: 1;
}
100% {
scale: 1;
}
}
<div class="pre-loader-area">
<div class="pre-loader">
<div class="pre-loader-block-line1">
<div class="block1 pre-loader-blocks"></div>
<div class="block2 pre-loader-blocks"></div>
</div>
<div class="pre-loader-block-line2">
<div class="block3 pre-loader-blocks"></div>
<div class="block4 pre-loader-blocks"></div>
</div>
</div>
</div>
Looking at the timings and delays you have set it seems to want each square to expand for one second, contract for one second and then hang around doing nothing for 6 seconds.
The overall time of a complete cycle is therefore 8 seconds.
You can create one set of keyframes which scales the element up for 1/8th of the iteration duration, scales it down for a further 1/8th and then does nothing for 6/8ths.
#keyframes scale {
0%, 25%, 100% { scale: 1; }
12.5% {scale: 1.2; }
}
This animation and the duration of 8s is the same for each block.
Each block then has its own delay. 0s for the first one, 1 for the second one and so on as you already have.
.pre-loader-area {
position: fixed;
z-index: 10;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.9);
opacity: 1;
}
.pre-loader {
width: 20vw;
height: 20vw;
margin-left: auto;
margin-right: auto;
transform: translateY(40vh);
}
.pre-loader-block-line1,
.pre-loader-block-line2 {
position: relative;
width: 20vw;
height: 9vw;
}
.pre-loader-block-line2 {
position: relative;
top: 2.5vw;
}
.pre-loader-blocks {
position: relative;
float: left;
background-color: rgba(255, 255, 255, 0.8);
width: 41%;
height: 90%;
animation: scale 8s var(--delay) infinite;
}
.block2,
.block4 {
float: right;
}
.block1 {
--delay: 0s;
}
.block2 {
--delay: 1s;
}
.block4 {
--delay: 3s;
}
.block3 {
--delay: 2s;
}
#keyframes scale {
0%,
25%,
100% {
scale: 1;
}
12.5% {
scale: 1.2;
}
}
#keyframes scale-up {
0% {
scale: 1;
}
100% {
scale: 1.2;
}
}
#keyframes scale-down {
0% {
scale: 1.2;
}
100% {
scale: 1;
}
}
#keyframes stay {
0% {
scale: 1;
}
100% {
scale: 1;
}
}
<div class="pre-loader-area">
<div class="pre-loader">
<div class="pre-loader-block-line1">
<div class="block1 pre-loader-blocks"></div>
<div class="block2 pre-loader-blocks"></div>
</div>
<div class="pre-loader-block-line2">
<div class="block3 pre-loader-blocks"></div>
<div class="block4 pre-loader-blocks"></div>
</div>
</div>
</div>
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>
I want to ask a way to create a repetitive wave on the bottom of the div using css, here's an example of his image
enter image description here
html, body { height: 100%; }
body {
background:radial-gradient(ellipse at center, rgba(255,254,234,1) 0%, rgba(255,254,234,1) 35%, #B7E8EB 100%);
// background:#B7E8EB;
overflow: hidden;
}
.ocean {
height: 5%;
width:100%;
position:absolute;
bottom:0;
left:0;
background: #015871;
}
.wave {
background: url(http://tedmcdo.com/labs/wave.svg) repeat-x;
position: absolute;
top: -198px;
width: 6400px;
height: 198px;
animation: wave 7s cubic-bezier( 0.36, 0.45, 0.63, 0.53) infinite;
transform: translate3d(0, 0, 0);
}
.wave:nth-of-type(2) {
top: -175px;
animation: wave 7s cubic-bezier( 0.36, 0.45, 0.63, 0.53) -.125s infinite, swell 7s ease -1.25s infinite;
opacity: 1;
}
#keyframes wave {
0% {
margin-left: 0;
}
100% {
margin-left: -1600px;
}
}
#keyframes swell {
0%, 100% {
transform: translate3d(0,-25px,0);
}
50% {
transform: translate3d(0,5px,0);
}
}
<div class="ocean">
<div class="wave"></div>
</div>
I tried to put a "float:right" in the .skill_item_colored_main_wrap part. but it became such a mess. I think it has something to do with -webkit-animation part.
how can i modify it so it will transit from right to left?
.shortcode_skill {
position:relative;
overflow:hidden;
}
.shortcode_skill:before {
position:absolute;
top:0;
left:27%;
margin:15px 0 0;
width:1px;
height:95%;
background:rgba(0, 0, 0, .1);
content:"";
}
.skill_item {
overflow:hidden;
width:100%;
}
.skill_item > span {
float:left;
padding:24px 4.7% 0 0;
width:25%;
text-align:right;
}
.skill_item_colored_main_wrap {
float:left;
padding:15px 0 5px;
width:70%;
}
.skill_item_colored_wrap {
position:relative;
height:33px;
}
.skill_item_colored {
position:absolute;
width:100%;
height:100%;
-webkit-animation:move 2s linear .1s normal none 1 ;
-moz-animation:move 2s linear .1s normal none 1 ;
-ms-animation:move 2s linear .1s normal none 1 ;
-o-animation:move 2s linear .1s normal none 1 ;
animation:move 2s linear .1s normal none 1 ;
}
#-webkit-keyframes move {
from {width:0;}
to {width:100%;}
}
#-ms-keyframes move {
from {width:0;}
to {width:100%;}
}
#-o-keyframes move {
from {width:0;}
to {width:100%;}
}
#keyframes move {
from {width:0;}
to {width:100%;}
}
.skill_item_colored_wrap > span {
position:relative;
display:block;
}
.skill_item_colored > span {
display:block;
padding:8px 10px;
text-align:right;
-webkit-animation:opacity 2.5s linear .1s normal none 1 ;
-moz-animation:opacity 2.5s linear .1s normal none 1 ;
-ms-animation:opacity 2.5s linear .1s normal none 1 ;
-o-animation:opacity 2.5s linear .1s normal none 1 ;
animation:opacity 2.5s linear .1s normal none 1 ;
}
#-webkit-keyframes opacity {
0% {opacity:0;}
90% {opacity:0;}
100% {opacity:1;}
}
#-moz-keyframes opacity {
0% {opacity:0;}
90% {opacity:0;}
100% {opacity:1;}
}
#-ms-keyframes opacity {
0% {opacity:0;}
90% {opacity:0;}
100% {opacity:1;}
}
#-o-keyframes opacity {
0% {opacity:0;}
90% {opacity:0;}
100% {opacity:1;}
}
#keyframes opacity {
0% {opacity:0;}
90% {opacity:0;}
100% {opacity:1;}
}
<div class="skill_item">
<span>hello world </span>
<div class="skill_item_colored_main_wrap">
<div class="skill_item_colored_wrap" style="width:95%;">
<div class="skill_item_colored" style="background-color:#f97a14;">
<span>95%</span>
</div>
</div>
</div>
</div>
A quick and easy way to do this would be to rotate the parent element 180deg and then rotate the child element negative -180deg.
Assuming you want the text aligned to the left, I added text-align: left. Omit that if you want it aligned to the right.
.skill_item_colored_wrap {
transform: rotate(180deg);
}
.skill_item_colored_wrap .skill_item_colored > span {
text-align: left;
transform: rotate(-180deg);
}
.skill_item_colored_wrap {
transform: rotate(180deg);
}
.skill_item_colored_wrap .skill_item_colored > span {
text-align: left;
transform: rotate(-180deg);
}
.shortcode_skill {
position: relative;
overflow: hidden;
}
.shortcode_skill:before {
position: absolute;
top: 0;
left: 27%;
margin: 15px 0 0;
width: 1px;
height: 95%;
background: rgba(0, 0, 0, .1);
content: "";
}
.skill_item {
overflow: hidden;
width: 100%;
}
.skill_item > span {
float: left;
padding: 24px 4.7% 0 0;
width: 25%;
text-align: right;
}
.skill_item_colored_main_wrap {
float: left;
padding: 15px 0 5px;
width: 70%;
}
.skill_item_colored_wrap {
position: relative;
height: 33px;
}
.skill_item_colored {
position: absolute;
width: 100%;
height: 100%;
-webkit-animation: move 2s linear .1s normal none 1;
-moz-animation: move 2s linear .1s normal none 1;
-ms-animation: move 2s linear .1s normal none 1;
-o-animation: move 2s linear .1s normal none 1;
animation: move 2s linear .1s normal none 1;
}
#-webkit-keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
#-ms-keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
#-o-keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
#keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
.skill_item_colored_wrap > span {
position: relative;
display: block;
}
.skill_item_colored > span {
display: block;
padding: 8px 10px;
text-align: right;
-webkit-animation: opacity 2.5s linear .1s normal none 1;
-moz-animation: opacity 2.5s linear .1s normal none 1;
-ms-animation: opacity 2.5s linear .1s normal none 1;
-o-animation: opacity 2.5s linear .1s normal none 1;
animation: opacity 2.5s linear .1s normal none 1;
}
#-webkit-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-moz-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-ms-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-o-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<div class="skill_item">
<span>hello world </span>
<div class="skill_item_colored_main_wrap">
<div class="skill_item_colored_wrap" style="width:95%;">
<div class="skill_item_colored" style="background-color:#f97a14;">
<span>95%</span>
</div>
</div>
</div>
</div>
As an alternative, you could also set direction: rtl on the .skill_item element, and then set the .skill_item_colored_main_wrap element's display to inline-block and remove float: left:
.skill_item {
overflow: hidden;
width: 100%;
direction: rtl;
}
.skill_item_colored_main_wrap {
display: inline-block;
}
.skill_item {
overflow: hidden;
width: 100%;
direction: rtl;
}
.skill_item_colored_main_wrap {
display: inline-block;
}
.shortcode_skill {
position: relative;
overflow: hidden;
}
.shortcode_skill:before {
position: absolute;
top: 0;
left: 27%;
margin: 15px 0 0;
width: 1px;
height: 95%;
background: rgba(0, 0, 0, .1);
content: "";
}
.skill_item > span {
float: left;
padding: 24px 4.7% 0 0;
width: 25%;
}
.skill_item_colored_main_wrap {
padding: 15px 0 5px;
width: 70%;
}
.skill_item_colored_wrap {
position: relative;
height: 33px;
}
.skill_item_colored {
position: absolute;
width: 100%;
height: 100%;
-webkit-animation: move 2s linear .1s normal none 1;
-moz-animation: move 2s linear .1s normal none 1;
-ms-animation: move 2s linear .1s normal none 1;
-o-animation: move 2s linear .1s normal none 1;
animation: move 2s linear .1s normal none 1;
}
#-webkit-keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
#-ms-keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
#-o-keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
#keyframes move {
from {
width: 0;
}
to {
width: 100%;
}
}
.skill_item_colored_wrap > span {
position: relative;
display: block;
}
.skill_item_colored > span {
display: block;
padding: 8px 10px;
text-align: right;
-webkit-animation: opacity 2.5s linear .1s normal none 1;
-moz-animation: opacity 2.5s linear .1s normal none 1;
-ms-animation: opacity 2.5s linear .1s normal none 1;
-o-animation: opacity 2.5s linear .1s normal none 1;
animation: opacity 2.5s linear .1s normal none 1;
}
#-webkit-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-moz-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-ms-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-o-keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes opacity {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<div class="skill_item">
<span>hello world </span>
<div class="skill_item_colored_main_wrap">
<div class="skill_item_colored_wrap" style="width:95%;">
<div class="skill_item_colored" style="background-color:#f97a14;">
<span>95%</span>
</div>
</div>
</div>
</div>
Here an alternative,
<div class="progress">
<div class="progress-bar progress-bar-info" role="progressbar" style="width:95%%;"></div>
</div>
And add this to your CSS
.progress-middle .progress-bar {
position: relative;
}
.progress-right .progress-bar {
float: right;
}
What we did here is make sure the position is relative then float the progress-bar to right instead of left.
I'm trying to animate a tractor moving across the screen. I've got it working perfectly on my screen, however I want it to work across different platforms (only included -webkit-). When I re-size, the tractor is fluid, but the wheels aren't. How can I make them adjust together?
<body>
<div class="container">
<div class="tractor">
<img src="img/tractor-700px.png" alt="tractor">
</div>
<div class="wheels">
<div class="b_wheel">
<img src="img/b_wheel.png">
</div>
<div class="f_wheel">
<img src="img/f_wheel.png">
</div>
</div>
</div>
Here's my main CSS:
.tractor {
width: 380px;
position: absolute;
top: 40%;
left: -5%;
}
.tractor img {
width: 100%;
}
.tractor::after {
content: "";
display: block;
width: 120px;
height: 120px;
background: url('img/steam.png') no-repeat;
background-size: 120px;
position: absolute;
top: -37%;
left: 56%;
opacity: 0;
}
.f_wheel {;
width: 125px;
position: absolute;
top: 66.5%;
left: 13%;
}
.f_wheel img {
width: 100%;
}
.b_wheel {
width: 190px;
position: absolute;
top: 58.8%;
left: -7%;
}
.b_wheel img {
width: 100%;
}
And CSS for the animation:
.tractor {
-webkit-animation: tractor-bounce 3s ease-in-out infinite,
tractor-go 10s ease-in-out forwards;
}
.tractor::after {
-webkit-animation: steam 4s 2s infinite;
}
.f_wheel,
.b_wheel {
-webkit-animation: wheel-spin 10s ease-in-out forwards;
}
.f_wheel {
-webkit-animation: front-wheel-go 10s ease-in-out forwards,
wheel-spin 10s ease-in-out forwards;
}
.b_wheel {
-webkit-animation: back-wheel-go 10s ease-in-out forwards,
wheel-spin 10s ease-in-out forwards;
}
/* Keyframes - WebKit only
------------------------------------------ */
#-webkit-keyframes tractor-bounce {
50% { -webkit-transform: rotate(-5deg) translateY(-3px); }
}
#-webkit-keyframes tractor-go {
100% { left: 70%; }
}
#-webkit-keyframes steam {
40% { opacity: .8; }
60% { opacity: 1; }
100% { -webkit-transform: translate(-15%, -35%) rotateZ(20deg); }
}
#-webkit-keyframes wheel-spin {
0% { -webkit-transform: translateX(0px) rotate(50deg); }
100% { -webkit-transform: translateX(0px) rotate(480deg); }
}
#-webkit-keyframes front-wheel-go {
100% { left: 88%; }
}
#-webkit-keyframes back-wheel-go {
100% { left: 68.5%; }
}
JSFiddle to show it in action: http://jsfiddle.net/0j5L92vh/1/
[PS - This is my first post here so many thanks in advance! Let me know if I need to include anything else.]
I found a solution to your problem.
I utilized the .container div you have provided to keep everything positioned relative
to your tractor image. You can see the changes in the css code that made will make
it work in non webkit browsers. It will not work on versions of Internet Explorer before number 9.
The changes I have made are only to your css.
jsfiddle: http://jsfiddle.net/larryjoelane/h324j6u6/113/
css:
.container{
width: 380px;
position: relative;
/*bind the animation and set its properties*/
-webkit-animation: tractor 10s linear 0s; /* Chrome, Safari, Opera */
animation: tractor 10s linear 0s;
}
/*bind the wheel-spin animation*/
.f_wheel,
.b_wheel {
-webkit-animation: wheel-spin 10s ease-in-out forwards;
animation: wheel-spin 10s ease-in-out forwards;
}
/*bind the tractor bounce-animation*/
.tractor {
-webkit-animation: tractor-bounce 3s ease-in-out infinite,
tractor-go 10s ease-in-out forwards;
animation: tractor-bounce 3s ease-in-out infinite,
tractor-go 10s ease-in-out forwards;
}
.tractor img{
width:100%;
}
.b_wheel {
width: 190px;
position: relative;
top: -120px;
left: -7%;
}
.b_wheel img {
width: 100%;
}
.f_wheel{
width: 125px;
position:relative;
top: -258px;
left: 65%;
}
.f_wheel img {
width: 100%;
}
/* Chrome, Safari, Opera */
#-webkit-keyframes tractor {
0% { left:0px; top:0px;}
25% {left:200px; top:0px;}
50% {left:400px; top:0px;}
75% {left:600px; top:0px;}
100% {left:800px; top:0px;}
}
/* Standard syntax */
#keyframes tractor {
0% { left:0px; top:0px;}
25% {left:200px; top:0px;}
50% {left:400px; top:0px;}
75% {left:600px; top:0px;}
100% {left:800px; top:0px;}
}
/*standard browser animation*/
#keyframes wheel-spin{
0% { transform: translateX(0px) rotate(50deg); }
100% { transform: translateX(0px) rotate(480deg); }
}
/*webkit browser animation*/
#-webkit-keyframes wheel-spin{
0% { -webkit-transform: translateX(0px) rotate(50deg); }
100% { -webkit-transform: translateX(0px) rotate(480deg); }
}
/*webkit tractor-bounce animation*/
#-webkit-keyframes tractor-bounce {
50% { -webkit-transform: rotate(-5deg) translateY(-3px); }
}
/*standard tractor-bounce web browser animation*/
#keyframes tractor-bounce {
50% { transform: rotate(-5deg) translateY(-3px); }
}