SVG CSS Animation for IE and Safari not working - html

Hi guys so im hitting a brick wall with 2 issues:
IE the pulse in the middle works but not the circular progress
In safari (win) the curcluar progress does not work
Firefox and Chrome work fine
Any ideas? i literally only have a few hours ot crack this.
NOTE: You have to click on the circle in order to start the animation. Thanks in advance for any help in cracking this for me.
JSFiddle: http://jsfiddle.net/0pkqk5r0/1/
HTML:
<div id="loader">
<svg height="80" width="80" viewBox="-10 -10 220 220">
<path id="back" d="M0,100 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0" fill="#FF1251" stroke="#FF1251" stroke-width="20" />
<path id="ring" d="M100,0 a100,100 0 0 1 0,200 a100,100 0 0 1 0,-200,0" fill="none" stroke="#FF1251" stroke-width="20" stroke-dasharray="629" stroke-linecap="round" stroke-dashoffset="629" />
</svg>
<div id="circle"></div>
</div>
CSS:
/* temp */
body {
background: #072237;
}
h3, p {
color: #ffffff;
}
#loader {
position: relative;
width: 80px;
height: 80px;
cursor: pointer;
}
#ring.active {
-webkit-animation: load 6s 1 forwards;
-moz-animation: load 6s 1 forwards;
-o-animation: load 6s 1 forwards;
-ms-animation: load 6s 1 forwards;
animation: load 6s 1 forwards;
}
#circle {
position: absolute;
width: 20px;
height: 20px;
top: 50%;
left: 50%;
margin-left: -10px;
margin-top: -10px;
background: #FFFFFF;
border-radius: 50%;
}
#circle.active {
background: #FF1251;
-webkit-animation: pulse 1.2s 3;
-moz-animation: pulse 1.2s 3;
-o-animation: pulse 1.2s 3;
-ms-animation: pulse 1.2s 3;
animation: pulse 1.2s 3;
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
-o-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-transform: scale(0.8);
-moz-transform: scale(0.8);
-ms-transform: scale(0.8);
-o-transform: scale(0.8);
transform: scale(0.8);
}
/* Pulse */
#-webkit-keyframes pulse {
0% {
transform: scale(0.8);
}
20% {
transform: scale(1);
}
40% {
transform: scale(0.8);
}
100% {
transform: scale(0.8);
}
}
#-moz-keyframes pulse {
0% {
transform: scale(0.8);
}
20% {
transform: scale(1);
}
40% {
transform: scale(0.8);
}
100% {
transform: scale(0.8);
}
}
#-o-keyframes pulse {
0% {
-o-transform: scale(0.8);
transform: scale(0.8);
}
20% {
-o-transform: scale(1);
transform: scale(1);
}
40% {
-o-transform: scale(0.8);
transform: scale(0.8);
}
100% {
-o-transform: scale(0.8);
transform: scale(0.8);
}
}
#-ms-keyframes pulse {
0% {
-ms-transform: scale(0.8);
transform: scale(0.8);
}
20% {
-ms-transform: scale(1);
transform: scale(1);
}
40% {
-ms-transform: scale(0.8);
transform: scale(0.8);
}
100% {
-ms-transform: scale(0.8);
transform: scale(0.8);
}
}
#keyframes pulse {
0% {
transform: scale(0.8);
}
20% {
transform: scale(1);
}
40% {
transform: scale(0.8);
}
100% {
transform: scale(0.8);
}
}
/* Loading */
#-webkit-keyframes load {
80% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 0;
}
}
#-moz-keyframes load {
80% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 0;
}
}
#-o-keyframes load {
80% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 0;
}
}
#-ms-keyframes load {
80% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 0;
}
}
#keyframes load {
80% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 0;
}
}

The shorthand animations will work on:
IE10+
Safari 9+
Use HTML+TIME for older versions of IE:
.time {behavior: url(#default#time2)}
<div id="circle" class="time" begin="0" end="2" timeAction="style">
Use longhand for older versions of Safari:
#circle.active {
-webkit-animation-name: pulse;
-webkit-animation-duration: 2s;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: 3;
}
References
Introduction to CSS3 Animations
What's New in Safari
Safari CSS Visual Effects Guide
Internet Explorer 10 Guide for Developers
Internet Explorer 10 on Windows 7
HTML+TIME Specification
time2 Behavior
Using the HTML+TIME Document Object Model (DOM)
Animated DHTML
BUG: HTML+TIME Code Fails Inside an Element Behavior

Related

Animation in mozilla doesn't work properly

I didn't asked about transform origin. I asked why the animation doesn't work on mozilla
I'm stuck doing some animation svg on Mozilla. What I have tried in Chrome the animation worked perfectly fine, but when I tested on mozilla it's doesn't work well. I have put the vendor prefix, still the animation doesn't work properly.
I can't share the svg because the line of code to share here is limited, So please check it out from the demo.
Here is the DEMO
CSS
.trans-animate {
-webkit-transform: translate(-24%,9%);
transform: translate(-24%,9%);
-webkit-animation: wavedash 6s ease-out infinite;
animation: wavedash 6s ease-out infinite;
}
#-webkit-keyframes wavedash {
0% {
-webkit-transform: translate(-28%,9%);
transform: translate(-28%,9%);
}
50% {
-webkit-transform: translate(-42%,9%);
transform: translate(-42%,9%);
}
100% {
-webkit-transform: translate(-20%,9%);
transform: translate(-20%,9%);
}
}
.trans-animate2 {
-webkit-transform: translate(-38%,2%);
transform: translate(-38%,2%);
-webkit-animation: wavedash2 10s ease-out infinite;
animation: wavedash2 10s ease-out infinite;
}
#-webkit-keyframes wavedash2 {
0% {
-webkit-transform: translate(-28%,2%);
transform: translate(-28%,2%);
}
50% {
-webkit-transform: translate(-5%,2%);
transform: translate(-5%,2%);
}
100% {
-webkit-transform: translate(8%,2%);
transform: translate(8%,2%);
}
}
.dolphin-loca {
/*transform: translate(-166%,69%);*/
-webkit-animation: dolphin 8s ease-out infinite;
animation: dolphin 8s ease-out infinite;
}
#-webkit-keyframes dolphin {
0% {
-webkit-transform: translate(-172%,40%);
transform: translate(-172%,40%);
}
50% {
-webkit-transform: translate(-172%, -36%);
transform: translate(-172%, -36%);
}
65% {
-webkit-transform: translate(-172%, -36%);
transform: translate(-172%, -36%);
}
80% {
-webkit-transform: translate(-172%, -36%);
transform: translate(-172%, -36%);
}
100% {
-webkit-transform: translate(-172%,40%);
transform: translate(-172%,40%);
}
}
.text-dolphin {
-webkit-animation: dolphin-button 8s ease-out infinite;
animation: dolphin-button 8s ease-out infinite;
}
#-webkit-keyframes dolphin-button {
0% {
-webkit-transform: translate(-172%,40%);
transform: translate(-172%,40%);
opacity: 0;
}
50% {
-webkit-transform: translate(-123%, -60%);
transform: translate(-123%, -60%);
opacity: 0;
}
65% {
-webkit-transform: translate(-123%, -60%);
transform: translate(-123%, -60%);
opacity: 1;
}
78% {
-webkit-transform: translate(-123%, -60%);
transform: translate(-123%, -60%);
opacity: 1;
}
85% {
-webkit-transform: translate(-162%, -60%);
transform: translate(-162%, -60%);
opacity: 0;
}
100% {
-webkit-transform: translate(-172%,40%);
transform: translate(-172%,40%);
opacity: 0;
}
}
.closeEye {
-webkit-animation: eye 1.5s cubic-bezier(.17,.67,.48,.84) infinite;
animation: eye 1.5s cubic-bezier(.17,.67,.48,.84) infinite;
}
#-webkit-keyframes eye {
0% {
-webkit-transform: translateY(0px) scaleY(1);
transform: translateY(0px) scaleY(1);
}
10% {
-webkit-transform: translateY(265px) scaleY(0.05);
transform: translateY(265px) scaleY(0.05);
}
15% {
-webkit-transform: translateY(170px) scaleY(0.4);
transform: translateY(170px) scaleY(0.4);
}
25% {
-webkit-transform: translateY(85px) scaleY(0.7);
transform: translateY(85px) scaleY(0.7);
}
30% {
-webkit-transform: translateY(85px) scaleY(0.7);
transform: translateY(85px) scaleY(0.7);
}
35% {
-webkit-transform: translateY(170px) scaleY(0.4);
transform: translateY(170px) scaleY(0.4);
}
40% {
-webkit-transform: translateY(255px) scaleY(0.1);
transform: translateY(255px) scaleY(0.1);
}
100% {
-webkit-transform: translateY(0px) scaleY(1);
transform: translateY(0px) scaleY(1);
}
}
There are two reasons your animation doesn't work on Firefox.
The primary reason is that you have #-webkit-keyframes rules, which work in Chrome, but you have no #keyframes rules, which Firefox needs. You need to include both variants.
The second reason is related to the transform-origin difference between Firefox and Chrome.
Percentages in SVG files are relative to the viewport size (the dimensions of the SVG). That's what Firefox does. So translate(-172%,40%) is putting the dolphin way off the edge of the SVG.
Chrome is calculating percentages relative to the dimensions of the dolphin. That is not the correct behaviour.
If you want your animation to work in both browsers, you need to switch to using absolute pixel values in your transform rules (eg. 100px).
.dolphin-loca {
-webkit-animation: dolphin 8s ease-out infinite;
animation: dolphin 8s ease-out infinite;
}
#-webkit-keyframes dolphin {
0% {
transform: translate(-300px, 100px);
}
50% {
transform: translate(-300px, -100px);
}
65% {
transform: translate(-300px, -100px);
}
80% {
transform: translate(-300px, -100px);
}
100% {
transform: translate(-300px, 100px);
}
}
#keyframes dolphin {
0% {
transform: translate(-300px, 100px);
}
50% {
transform: translate(-300px, -100px);
}
65% {
transform: translate(-300px, -100px);
}
80% {
transform: translate(-300px, -100px);
}
100% {
transform: translate(-300px, 100px);
}
}
<svg x="0px" y="0px" width="1600px" height="450.39px" viewBox="0 0 1600 450.39">
<g id="Layer_7" class="dolphin-loca" >
<path id="XMLID_29_" fill="#0083B7" d="M805.419,255.439c0-44.307-28.647-75.028-71.876-79.144 c1.21-4.736,2.37-7.935-2.083-7.935c-3.665,0-8.222,3.306-11.537,7.72c-44.529,2.807-74.611,34.122-74.611,79.359 c0,12.658,2.772,23.054,7.724,31.504c-4.966,9.543-5.992,22.504-1.546,28.282c5.617,7.3,8.705-3.645,17.415-11.529 c15.167,10.519,32.232,14.748,56.46,14.748c2.102,0,4.185-0.033,6.248-0.098c-0.163,6.328-2.354,13.155-7.468,20.396 c-3.842-5.743-20.614-27.065-47.537-8.519c-1.583,1.09,17.322,28.912,44.758,12.288c-0.328,0.717-0.755,2.152,1.434,1.581 c-4.001,6.03-9.983,19.613,5.826,32.179c1.107,0.88,16.966-18.865-2.171-34.437c5.641-3.797,16.995-12.42,26.062-25.462 c13.228-2.205,20.431-6.272,29.324-12.662c8.699,7.883,11.786,18.811,17.4,11.515c4.446-5.778,3.42-18.739-1.546-28.282 C802.648,278.493,805.419,268.097,805.419,255.439z M725.366,314.436c-44.229,0-74.917-14.978-74.917-59.207 s30.688-74.401,74.917-74.401c44.229,0,74.917,30.172,74.917,74.401S769.595,314.436,725.366,314.436z" />
</g>
</svg>

how can animate image

I want to stop this animation again and again, also when animations is finished spacecraft go right & fly with rotates.
jsfiddle
/* Table of contents
---------------
- Imports
- Mixins
- Extends
- Main Elements
*/
/*
IMPORTS
*/
#import url("http://fonts.googleapis.com/css?family=Montserrat");
/*
MIXINS
*/
/*
EXTENDS
*/
.center-hv, .ufo {
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
/*
CONTAINER
*/
.loading {
font-family: 'Montserrat', sans-serif;
background-color: #2e5b8d;
color: white;
position: fixed;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
top: 0;
left: 0;
-webkit-transition: 2s ease-in-out;
-moz-transition: 2s ease-in-out;
-o-transition: 2s ease-in-out;
-ms-transition: 2s ease-in-out;
transition: 2s ease-in-out;
}
/*
MAIN ELEMENTS
*/
.ufo {
position: absolute;
background-image: url("http://www.picz.ge/img/s2/1503/25/d/d3ea7c2c9736.png");
width: 130px;
height: 256px;
top: 55%;
}
.ufo.light {
background-image: url("http://biacosta.com/img/loading/ufoLight.png");
opacity: 0;
-webkit-animation: 3s ease-in-out infinite normal running;
-moz-animation: 3s ease-in-out infinite normal running;
-o-animation: 3s ease-in-out infinite normal running;
-ms-animation: 3s ease-in-out infinite normal running;
animation: 3s ease-in-out infinite normal running;
-webkit-animation-name: switch;
-moz-animation-name: switch;
-o-animation-name: switch;
-ms-animation-name: switch;
animation-name: switch;
}
#-webkit-keyframes switch {
30% {
opacity: 0;
}
40% {
opacity: 1;
}
80% {
opacity: 1;
}
90% {
opacity: 0;
}
}
#-moz-keyframes switch {
30% {
opacity: 0;
}
40% {
opacity: 1;
}
80% {
opacity: 1;
}
90% {
opacity: 0;
}
}
#keyframes switch {
30% {
opacity: 0;
}
40% {
opacity: 1;
}
80% {
opacity: 1;
}
90% {
opacity: 0;
}
}
.small-ghost {
position: absolute;
background-image: url("http://www.picz.ge/img/s2/1503/25/9/93b31db2958a.png");
width: 61px;
height: 53px;
bottom: 15px;
opacity: 1;
-webkit-animation: 3s ease-in-out infinite normal;
-moz-animation: 3s ease-in-out infinite normal;
-o-animation: 3s ease-in-out infinite normal;
-ms-animation: 3s ease-in-out infinite normal;
animation: 3s ease-in-out infinite normal;
-webkit-animation-name: float;
-moz-animation-name: float;
-o-animation-name: float;
-ms-animation-name: float;
animation-name: float;
right: 32px;
}
#-webkit-keyframes float {
0% {
opacity: 1;
bottom: 15px;
}
20% {
opacity: 1;
}
50% {
opacity: 0.5;
bottom: 15px;
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
90% {
bottom: 150px;
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-o-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
opacity: 0;
}
}
#-moz-keyframes float {
0% {
opacity: 0;
bottom: 15px;
}
20% {
opacity: 1;
}
50% {
opacity: 0.5;
right: 45px;
bottom: 15px;
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
90% {
right: 45px;
bottom: 150px;
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-o-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
opacity: 0;
}
}
#keyframes float {
0% {
opacity: 0;
right: -130px;
bottom: 15px;
}
20% {
opacity: 1;
}
50% {
opacity: 0.5;
right: 45px;
bottom: 15px;
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
90% {
right: 45px;
bottom: 150px;
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-o-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
opacity: 0;
}
}
<div class="loading">
<div class="ufo light"></div>
<div class="ufo">
<div class="small-ghost"></div>
</div>
i want to stop this animation
If you do not want the animation to be infinite then replace all infinite values in all animation (with its suffixes) properties with 1. This value is related to animation-iteration-count so animation count will be 1 instead of infinite.
After that a small enchantment left in .small-ghost. It should have initial opacity set to 0 to be hidden after the animation.
https://jsfiddle.net/g1uh1Lsk/1/
also when animations is finished spacecraft go right & fly with rotates.
It's better to try to make this part by yourself and then ask a concrete question if something goes wrong.

Inline WebSVG doesn't have crisp lines?

I have an svg background that starts as separated then in 3 secs of page load, is moved to form the background. You can see a large triangle from the start that has rather poor quality and is very choppy, what could be the cause of this?
Here is a Codepen link for example.
CSS
html,
body,
.avatar {
/* position: absolute; */
width: 100%;
/* height: 100%; */
display: block;
}
body {
background: -webkit-linear-gradient(90deg, #4CB8C4 10%, #3CD3AD 90%); /* Chrome 10+, Saf5.1+ */
background: -moz-linear-gradient(90deg, #4CB8C4 10%, #3CD3AD 90%); /* FF3.6+ */
background: -ms-linear-gradient(90deg, #4CB8C4 10%, #3CD3AD 90%); /* IE10 */
background: -o-linear-gradient(90deg, #4CB8C4 10%, #3CD3AD 90%); /* Opera 11.10+ */
background: linear-gradient(90deg, #4CB8C4 10%, #3CD3AD 90%); /* W3C */
}
.avatar {
z-index: 800;
}
.avatar path {
-webkit-transform-origin: center center;
-ms-transform-origin: center center;
transform-origin: center center;
-webkit-transition: all 3s ease;
transition: all 3s ease;
-webkit-transform: translate(0);
-ms-transform: translate(0);
transform: translate(0);
}
.avatar path:nth-of-type(4n+1) {
-webkit-animation: p1 3s ease 1;
animation: p1 3s ease 1;
}
.avatar path:nth-of-type(4n+2) {
-webkit-animation: p2 3s ease 1;
animation: p2 3s ease 1;
}
.avatar path:nth-of-type(4n+3) {
-webkit-animation: p3 3s ease 1;
animation: p3 3s ease 1;
}
.avatar path:nth-of-type(4n+4) {
-webkit-animation: p4 3s ease 1;
animation: p4 3s ease 1;
}
.hover {
position: absolute;
width: 40%;
height: 40vw;
top: 50%;
left: 30%;
margin-top: -20vw;
border-radius: 50%;
cursor: pointer;
z-index: 1000;
visibility: hidden;
-webkit-animation: waitforit 0 ease-in 3s 1 forwards;
animation: waitforit 0 ease-in 3s 1 forwards;
}
.hover:hover + .avatar path:nth-of-type(4n+1) {
-webkit-transform: translate(800%, 400%) rotate(-690deg) translateZ(0);
transform: translate(800%, 400%) rotate(-690deg) translateZ(0);
}
.hover:hover + .avatar path:nth-of-type(4n+2) {
-webkit-transform: translate(-700%, 600%) rotate(-720deg) translateZ(0);
transform: translate(-700%, 600%) rotate(-720deg) translateZ(0);
}
.hover:hover + .avatar path:nth-of-type(4n+3) {
-webkit-transform: translate(-900%, -500%) rotate(-820deg) translateZ(0);
transform: translate(-900%, -500%) rotate(-820deg) translateZ(0);
}
.hover:hover + .avatar path:nth-of-type(4n+4) {
-webkit-transform: translate(700%, -800%) rotate(-950deg) translateZ(0);
transform: translate(700%, -800%) rotate(-950deg) translateZ(0);
}
p {
position: absolute;
bottom: 0.5em;
font-family: sans-serif;
font-weight: 100;
letter-spacing: 0.1em;
color: #fff;
border-left: 20px solid #fff;
padding: 2px 0 0 4px;
left: -50%;
-webkit-animation: infromleft 0.5s ease-in 1 forwards;
animation: infromleft 0.5s ease-in 1 forwards;
}
#-webkit-keyframes p1 {
0% {
-webkit-transform: translate(-300%, -700%) rotate(520deg) translateZ(0);
transform: translate(-300%, -700%) rotate(520deg) translateZ(0);
}
100% {
-webkit-transform: translate(0);
transform: translate(0);
}
}
#keyframes p1 {
0% {
-webkit-transform: translate(-300%, -700%) rotate(520deg) translateZ(0);
transform: translate(-300%, -700%) rotate(520deg) translateZ(0);
}
100% {
-webkit-transform: translate(0);
transform: translate(0);
}
}
#-webkit-keyframes p2 {
0% {
-webkit-transform: translate(400%, -900%) rotate(850deg) translateZ(0);
transform: translate(400%, -900%) rotate(850deg) translateZ(0);
}
100% {
-webkit-transform: translate(0);
transform: translate(0);
}
}
#keyframes p2 {
0% {
-webkit-transform: translate(400%, -900%) rotate(850deg) translateZ(0);
transform: translate(400%, -900%) rotate(850deg) translateZ(0);
}
100% {
-webkit-transform: translate(0);
transform: translate(0);
}
}
#-webkit-keyframes p3 {
0% {
-webkit-transform: translate(500%, 900%) rotate(325deg) translateZ(0);
transform: translate(500%, 900%) rotate(325deg) translateZ(0);
}
100% {
-webkit-transform: translate(0);
transform: translate(0);
}
}
#keyframes p3 {
0% {
-webkit-transform: translate(500%, 900%) rotate(325deg) translateZ(0);
transform: translate(500%, 900%) rotate(325deg) translateZ(0);
}
100% {
-webkit-transform: translate(0);
transform: translate(0);
}
}
#-webkit-keyframes p4 {
0% {
-webkit-transform: translate(-500%, 900%) rotate(748deg) translateZ(0);
transform: translate(-500%, 900%) rotate(748deg) translateZ(0);
}
100% {
-webkit-transform: translate(0);
transform: translate(0);
}
}
#keyframes p4 {
0% {
-webkit-transform: translate(-500%, 900%) rotate(748deg) translateZ(0);
transform: translate(-500%, 900%) rotate(748deg) translateZ(0);
}
100% {
-webkit-transform: translate(0);
transform: translate(0);
}
}
#-webkit-keyframes waitforit {
0% {
visibility: hidden;
}
100% {
visibility: visible;
}
}
#keyframes waitforit {
0% {
visibility: hidden;
}
100% {
visibility: visible;
}
}
#-webkit-keyframes infromleft {
0% {
left: -50%;
}
100% {
left: 0;
}
}
#keyframes infromleft {
0% {
left: -50%;
}
100% {
left: 0;
}
}
Thanks for the help everyone.
Alright, so #Sirko pointed out it was using a PNG as a source, so this is partly credited to him.
I was changing the colors of my triangles earlier on in AI, and I clicked the gradient mesh tool and added extra points to my triangle, which in turn caused that single triangle to be treated as a .png.
Thanks for the help everyone, appreciate it!

CSS SVG Path - Circular Progress Bar (small ammends)

As you will see from the code below I have a lovely circular progress bar however I have a few questions and a little lost on how to achieve this (ideally I don't want to use any JS)
I want to make the pink bar that goes around be curved and not
flat, is this possible? like the edge of it. So instead of it being
| it would be a little like ) at the start and end.
The throbbing circle in the middle, is it possible for it to pause
for like 1 second once animation is complete before it starts
again?
/* Load Progress Animation */
#-webkit-keyframes load {
0% {
stroke-dashoffset: 0
}
}
#-moz-keyframes load {
0% {
stroke-dashoffset: 0
}
}
#keyframes load {
0% {
stroke-dashoffset: 0
}
}
/* Qik Progress Container */
.progress {
position: relative;
display: inline-block;
padding: 0;
text-align: center;
}
/* Item SVG */
.progress svg {
width: 4rem;
height: 4rem;
}
.progress svg:nth-child(2) {
position: absolute;
left: 0;
top: 0;
transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
}
.progress svg:nth-child(2) path {
fill: none;
stroke-width: 20;
stroke-dasharray: 629;
stroke: rgba(60, 99, 121, 0.9);
-webkit-animation: load 8s;
-moz-animation: load 8s;
-o-animation: load 8s;
animation: load 8s;
}
.pulse {
border-radius: 50%;
width: 18px;
height: 18px;
background: #ff1251;
position: absolute;
top: 1.45rem;
left: 1.45rem;
-webkit-animation: pulse 0.6s linear infinite;
-moz-animation: pulse 0.6s linear infinite;
-ms-animation: pulse 0.6s linear infinite;
animation: pulse 0.6s linear infinite;
}
#keyframes "pulse" {
0% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
50% {
-moz-transform: scale(0.8);
-o-transform: scale(0.8);
-ms-transform: scale(0.8);
transform: scale(0.8);
}
100% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
}
#-moz-keyframes pulse {
0% {
-moz-transform: scale(1);
transform: scale(1);
}
50% {
-moz-transform: scale(0.8);
transform: scale(0.8);
}
100% {
-moz-transform: scale(1);
transform: scale(1);
}
}
#-webkit-keyframes "pulse" {
0% {
-webkit-transform: scale(1);
transform: scale(1);
}
50% {
-webkit-transform: scale(0.8);
transform: scale(0.8);
}
100% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
#-ms-keyframes "pulse" {
0% {
-ms-transform: scale(1);
transform: scale(1);
}
50% {
-ms-transform: scale(0.8);
transform: scale(0.8);
}
100% {
-ms-transform: scale(1);
transform: scale(1);
}
}
<div class="progress">
<svg viewBox="-10 -10 220 220">
<g fill="none" stroke-width="20" transform="translate(100,100)">
<path d="M-100,0a100,100 0 1,0 200,0a100,100 0 1,0 -200,0" stroke="#FF1252" stroke-linejoin="round" />
</g>
</svg>
<svg viewBox="-10 -10 220 220">
<path d="M200,100 C200,44.771525 155.228475,0 100,0 C44.771525,0 0,44.771525 0,100 C0,155.228475 44.771525,200 100,200 C155.228475,200 200,155.228475 200,100 Z" stroke-dashoffset="629"></path>
</svg>
<div class="pulse"></div>
</div>
I've re-written the entire code.
For your first question, you could simply use stroke-linecap="round".
For the second one, you will have to add an extra #keyframes rule for the delay.
body {
background: #072237;
}
h3 {
color: #ffffff;
}
#loader {
position: relative;
width: 80px;
height: 80px;
}
#ring {
-webkit-animation: load 6s 1 forwards;
animation: load 6s 1 forwards;
}
#circle {
position: absolute;
width: 20px;
height: 20px;
top: 50%;
left: 50%;
margin-left: -10px;
margin-top: -10px;
background: #FF1251;
border-radius: 50%;
transform: scale(0.8);
-webkit-animation: pulse 1.2s 3;
animation: pulse 1.2s 3;
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
}
#-webkit-keyframes pulse {
0% {
transform: scale(0.8);
}
20% {
transform: scale(1);
}
40% {
transform: scale(0.8);
}
100% {
transform: scale(0.8);
}
}
#keyframes pulse {
0% {
transform: scale(0.8);
}
20% {
transform: scale(1);
}
40% {
transform: scale(0.8);
}
100% {
transform: scale(0.8);
}
}
#-webkit-keyframes load {
80% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 0;
}
}
#keyframes load {
80% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 0;
}
}
<div id="loader">
<svg height="80" width="80" viewBox="-10 -10 220 220">
<path id="back" d="M0,100 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0" fill="#FFFFFF" stroke="#034870" stroke-width="20" stroke-linecap="round" />
<path id="ring" d="M100,0 a100,100 0 0 1 0,200 a100,100 0 0 1 0,-200,0" fill="none" stroke="#FF1251" stroke-width="20" stroke-dasharray="629" stroke-linecap="round" stroke-dashoffset="629" />
</svg>
<div id="circle"></div>
</div>
No. 1. is possible using stroke-linecap, but it requires some changes to your code, becasue in your case the red line is actually a background and the gray the stroke - so it would result in a concave circle, so "(", not ")" at the end of the red line. 2. can be done using longer animation set to alternate so it "sleeps" between 50% and 100% and back. I've made some changes:
http://jsfiddle.net/3yq3kmo1/
Changes in SVG (the second element):
<svg viewBox="-10 -10 220 220">
<circle r="100" cx="100" cy="100" stroke-dashoffset="0" />
</svg>
CSS (note that the dashoffset has been reversed, so now a red stroke grows and hides the gray, instead of red shrinking and revealing the gray; the stroke on path in first SVG element is gray now.)
.progress svg:nth-child(2) circle {
fill: none;
stroke-width: 20;
stroke-dasharray: 629;
stroke: #ff1251;
stroke-linecap:round;
animation: load 8s;
}
The pause in animation:
.pulse {
animation: pulse 1.6s linear infinite alternate;
}
#keyframes pulse {
0% {
transform: scale(0.8);
}
50% {
transform: scale(1);
}
100% {
transform: scale(1);
}
}

how to use -webkit-transform: translateX using % and position absolute

Hi guys a while back i posted a question regarding a banner i was making, well i have the animation working now but i cant get -webkit-transform: translateX(-40%) to work when i combine it with position:absolute.
The problem is i have 3 images and 3 bits of text that i need to fly onto the screen one after the other and end up overlapping which is why i was trying to use position:absolute but i cant get -webkit-transform: translateX(-40%) to work when i do this however i can get -webkit-transform: translateX(-40px) to work but that doesn't help me as i want it to be the same on different screen sizes. Does anybody know how i can get my animation to work with -webkit-transform: translateX(-40%) and have multiple images overlapping?
Example Code:
Html:
<div class="text3" id="txt3">
Moving Text
</div>
Css:
#txt3{
position:absolute;
top: 150px;
z-index: 1;
}
.text3 {
-webkit-animation-duration: 15s;
-webkit-animation-iteration-count: 1;
-webkit-animation-timing-function: ease;
-webkit-animation-fill-mode: both;
-moz-animation-duration: 15s;
-moz-animation-iteration-count: 1;
-moz-animation-timing-function: ease;
-moz-animation-fill-mode: both;
-o-animation-duration: 15s;
-o-animation-iteration-count: 1;
-o-animation-timing-function: ease;
-o-animation-fill-mode: both;
animation-duration: 15s;
animation-iteration-count: 1;
animation-timing-function: ease;
animation-fill-mode: both;}
#-webkit-keyframes text3 {
0% {
-webkit-transform: translateX(-40%)
;opacity: 1;
}
3% {
-webkit-transform: translateX(-40%)
}
30% {
-webkit-transform: translateX(20%)
}
37% {
-webkit-transform: translateX(20%)
;opacity: 1;
}
50% {
-webkit-transform: translateX(35%)
;opacity: 0;
}
100% {
opacity: 0;
-webkit-transform: translateX(35%)
}
}
#-moz-keyframes text3 {
0% {
-moz-transform: translateX(-40%)
;opacity: 1;
}
3% {
-moz-transform: translateX(-40%)
}
30% {
-moz-transform: translateX(20%)
}
37% {
-moz-transform: translateX(20%)
;opacity: 1;
}
50% {
-moz-transform: translateX(35%)
;opacity: 0;
}
100% {
opacity: 0;
-moz-transform: translateX(35%)
}
}
#-o-keyframes text3 {
0% {
-o-transform: translateX(-40%)
;opacity: 1;
}
3% {
-o-transform: translateX(-40%)
}
30% {
-o-transform: translateX(20%)
}
37% {
-o-transform: translateX(20%)
;opacity: 1;
}
50% {
-o-transform: translateX(35%)
;opacity: 0;
}
100% {
opacity: 0;
-o-transform: translateX(35%)
}
}
#keyframes text3 {
0% {
transform: translateX(-40%)
;opacity: 1;
}
3% {
transform: translateX(-40%)
}
30% {
transform: translateX(20%)
}
37% {
transform: translateX(20%)
;opacity: 1;
}
50% {
transform: translateX(35%)
;opacity: 0;
}
100% {
opacity: 0;
transform: translateX(35%)
}
}
.text3 {
-webkit-animation-name: text3;
-moz-animation-name: text3;
-o-animation-name: text3;
animation-name: text3;
}
Here are some working example of the animation:
-webkit-transform: translateX(-40%)
position:absolute
Any Help would be greatly appreciated.
crackruckles