What is wrong with this CSS background syntax? - css

At this link: [http://codepen.io/FelixKiunke/pen/nvDcj][1] you can see that this guy made a nice circle that finishing filling its edges up every 10 seconds. This is what I want to duplicate.
I have copied the compiled CSS as well as the HTML from this page and put it in some local files. When I open my page with this on it, Chrome tells me that the background CSS elements have invalid syntax and so the circle does not show up at all.
Why is the syntax invalid in my copied code but not on the site?
/*
NOTE ABOUT THE FORK:
This demonstrates the use of radial gradients on the Pie Spinner by HugoGiraudel (http://codepen.io/HugoGiraudel/pen/BHEwo).
Most of the code is unchanged, too make my changes clear I have removed the previous comments.
I added radial gradients (see the color change on hover) and a demonstration for the responsive size (click), and a little "Click me" pseudo element.
*/
* {
box-sizing: border-box;
}
.wrapper {
width: 250px;
height: 250px;
margin: 10px auto;
position: relative;
background: white;
/*The bigger size at click:*/
transition: width 0.5s, height 0.5s;
}
.wrapper.big {
width: 400px;
height: 400px;
}
.pie {
width: 50%;
height: 100%;
transform-origin: 100% 50%;
position: absolute;
/*
Here comes the radial gradient.
Note that it has to have the alignment "left center" for the .filler,
and "right center" for the .spinner!
*/
/*CHROME SAYS THE NEXT LINE IS INVALID*/
background: radial-gradient(left center, circle, #00ccff 0px, #000088 100%);
/* The borders mustn't be transparent, that looks really ugly! */
border: 20px solid #024;
}
.spinner {
border-radius: 100% 0 0 100% / 50% 0 0 50%;
z-index: 200;
/*CHROME SAYS THE NEXT LINE IS INVALID*/
background: radial-gradient(right center, circle, #00ccff 0px, #000088 100%);
border-right: none;
animation: rota 10s linear infinite;
}
.spinner::after {
position: absolute;
height: 20px;
top: 0px;
right: 0px;
content: "Click me!";
transform: rotate(270deg);
transform-origin: 100% 100%;
color: white;
font: 16px/20px sans-serif;
}
.wrapper:hover .pie {
border-color: #620;
}
.wrapper:hover .filler {
/*CHROME SAYS THE NEXT LINE IS INVALID*/
background: radial-gradient(left center, circle, #ffbb11 0px, #dd6600 100%);
}
.wrapper:hover .spinner {
background: radial-gradient(right center, circle, #ffbb11 0px, #dd6600 100%);
}
.filler {
border-radius: 0 100% 100% 0 / 0 50% 50% 0;
left: 50%;
opacity: 0;
z-index: 100;
animation: fill 10s steps(1, end) infinite;
border-left: none;
}
.mask {
width: 50%;
height: 100%;
position: absolute;
background: inherit;
opacity: 1;
z-index: 300;
animation: mask 10s steps(1, end) infinite;
}
#keyframes rota {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
#keyframes mask {
0% {
opacity: 1;
}
50%, 100% {
opacity: 0;
}
}
#keyframes fill {
0% {
opacity: 0;
}
50%, 100% {
opacity: 1;
}
}
<div class="wrapper">
<div class="pie spinner"></div>
<div class="pie filler"></div>
<div class="mask"></div>
</div>​
Update
Here is the updated (and working) CSS:
/Spinner/
/*
NOTE ABOUT THE FORK:
This demonstrates the use of radial gradients on the Pie Spinner by HugoGiraudel (http://codepen.io/HugoGiraudel/pen/BHEwo).
Most of the code is unchanged, too make my changes clear I have removed the previous comments.
I added radial gradients (see the color change on hover) and a demonstration for the responsive size (click), and a little "Click me" pseudo element.
*/
* {
box-sizing: border-box;
}
.wrapper {
width: 250px;
height: 250px;
margin: 10px auto;
position: relative;
background: white;
/*The bigger size at click:*/
transition: width 0.5s, height 0.5s;
}
.wrapper.big {
width: 400px;
height: 400px;
}
.pie {
width: 50%;
height: 100%;
transform-origin: 100% 50%;
position: absolute;
/*
Here comes the radial gradient.
Note that it has to have the alignment "left center" for the .filler,
and "right center" for the .spinner!
*/
background: -webkit-gradient(circle at left center, #00ccff 0px, #000088 100%);
background: -webkit-linear-gradient(circle at left center, #00ccff 0px, #000088 100%);
background: -moz-linear-gradient(circle at left center, #00ccff 0px, #000088 100%);
background: -ms-linear-gradient(circle at left center, #00ccff 0px, #000088 100%);
background: -o-linear-gradient(circle at left center, #00ccff 0px, #000088 100%);
background: radial-gradient(circle at left center, #00ccff 0px, #000088 100%);
/* The borders mustn't be transparent, that looks really ugly! */
border: 20px solid #024;
}
.spinner {
border-radius: 100% 0 0 100% / 50% 0 0 50%;
z-index: 200;
background: -webkit-gradient(circle at right center, #00ccff 0px, #000088 100%);
background: -webkit-linear-gradient(circle at right center, #00ccff 0px, #000088 100%);
background: -moz-linear-gradient(circle at right center, #00ccff 0px, #000088 100%);
background: -ms-linear-gradient(circle at right center, #00ccff 0px, #000088 100%);
background: -o-linear-gradient(circle at right center, #00ccff 0px, #000088 100%);
background: radial-gradient(circle at right center, #00ccff 0px, #000088 100%);
border-right: none;
-webkit-animation: rota 10s linear infinite;
-moz-animation: rota 10s linear infinite;
-o-animation: rota 10s linear infinite;
animation: rota 10s linear infinite;
}
.spinner::after {
position: absolute;
height: 20px;
top: 0px;
right: 0px;
content: "Click me!";
transform: rotate(270deg);
transform-origin: 100% 100%;
color: white;
font: 16px/20px sans-serif;
}
.wrapper:hover .pie {
border-color: #620;
}
.wrapper:hover .filler {
background: -webkit-gradient(circle at left center, #ffbb11 0px, #dd6600 100%);
background: -webkit-linear-gradient(circle at left center, #ffbb11 0px, #dd6600 100%);
background: -moz-linear-gradient(circle at left center, #ffbb11 0px, #dd6600 100%);
background: -ms-linear-gradient(circle at left center, #ffbb11 0px, #dd6600 100%);
background: -o-linear-gradient(circle at left center, #ffbb11 0px, #dd6600 100%);
background: radial-gradient(circle at left center, #ffbb11 0px, #dd6600 100%);
}
.wrapper:hover .spinner {
background: -webkit-gradient(circle at right center, #ffbb11 0px, #dd6600 100%);
background: -webkit-linear-gradient(circle at right center, #ffbb11 0px, #dd6600 100%);
background: -moz-linear-gradient(circle at right center, #ffbb11 0px, #dd6600 100%);
background: -ms-linear-gradient(circle at right center, #ffbb11 0px, #dd6600 100%);
background: -o-linear-gradient(circle at right center, #ffbb11 0px, #dd6600 100%);
background: radial-gradient(circle at right center, #ffbb11 0px, #dd6600 100%);
}
.filler {
border-radius: 0 100% 100% 0 / 0 50% 50% 0;
left: 50%;
opacity: 0;
z-index: 100;
-webkit-animation: fill 10s steps(1, end) infinite;
-moz-animation: fill 10s steps(1, end) infinite;
-o-animation: fill 10s steps(1, end) infinite;
animation: fill 10s steps(1, end) infinite;
border-left: none;
}
.mask {
width: 50%;
height: 100%;
position: absolute;
background: inherit;
opacity: 1;
z-index: 300;
-webkit-animation: mask 10s steps(1, end) infinite;
-moz-animation: mask 10s steps(1, end) infinite;
-o-animation: mask 10s steps(1, end) infinite;
animation: mask 10s steps(1, end) infinite;
}
#-webkit-keyframes rota {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
#-moz-keyframes rota {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
#-o-keyframes rota {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
#keyframes rota {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
#-webkit-keyframes mask {
0% {
opacity: 1;
}
50%, 100% {
opacity: 0;
}
}
#-moz-keyframes mask {
0% {
opacity: 1;
}
50%, 100% {
opacity: 0;
}
}
#-o-keyframes mask {
0% {
opacity: 1;
}
50%, 100% {
opacity: 0;
}
}
#keyframes mask {
0% {
opacity: 1;
}
50%, 100% {
opacity: 0;
}
}
#-webkit-keyframes fill {
0% {
opacity: 0;
}
50%, 100% {
opacity: 1;
}
}
#-moz-keyframes fill {
0% {
opacity: 0;
}
50%, 100% {
opacity: 1;
}
}
#-o-keyframes fill {
0% {
opacity: 0;
}
50%, 100% {
opacity: 1;
}
}
#keyframes fill {
0% {
opacity: 0;
}
50%, 100% {
opacity: 1;
}
}
[1]: http://codepen.io/FelixKiunke/pen/nvDcj

The syntax indeed is incorrect. It should be radial-gradient(circle at right center, #ffbb11 0px, #dd6600 100%). This is also incorrect in the CodePen, and once you fix it, the animation looks different (it has a 'Click here' call-to-action when you hover it). It is not the core issue, though.
The reason why the animation doesn't work at all in your version, is because the animation properties need a -webkit- prefix in Chrome.
In the CodePen, -prefix-free is used, which is why it works. It is a library that automatically adds the prefixed version of the CSS properties.
CodePen can also use Autoprefixer (another such library) or neither. Once you select 'neither', you'll see that the CodePen example also doesn't work anymore, because the (S)CSS doesn't contain the required prefixed version for the CSS attributes.
So, the solution: either use a library too, or add the required prefixed attributes for Chrome (and maybe other browsers too).

Related

clip-path is not animating?

WHAT I HAVE
I have a div (class = circle), I set key-fames for 4s so that it nicely animates from triangle to octagon.
body {
background-color: #252525;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.circle {
width: 30rem;
height: 5rem;
background-color: #1c7ed6;
animation: wave--animate 4s infinite ease-in-out alternate;
}
#keyframes wave--animate {
0% {
/* triangle */
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
100% {
/* octagon */
clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
}
}
<body>
<section class="section--water-waves">
<p class=circle></p>
</section>
</body>
WHAT I NEED
but, it immediately changes to octagon, instead of nicely and slowly getting animated to octagon...

Why does this animation start not to have transition when I add a linear gradient over it? [duplicate]

I want to move my gradient that has multiple colors smoothly but the problem is that the animation is not smooth. It just changes its position at every step.
<style>
.animated {
width: 300px;
height: 300px;
border: 1px solid black;
animation: gra 5s infinite;
animation-direction: reverse;
-webkit-animation: gra 5s infinite;
-webkit-animation-direction: reverse;
animation-timing-function: linear;
-webkit-animation-timing-function: linear;
}
#keyframes gra {
0% {
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, #ff670f), color-stop(21%, #ff670f), color-stop(56%, #ffffff), color-stop(88%, #0eea57));
background: -webkit-linear-gradient(-45deg, #ff670f 0%, #ff670f 21%, #ffffff 56%, #0eea57 88%);
background: linear-gradient(135deg, #ff670f 0%, #ff670f 21%, #ffffff 56%, #0eea57 88%);
}
50% {
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, #ff670f), color-stop(10%, #ff670f), color-stop(40%, #ffffff), color-stop(60%, #0eea57));
background: -webkit-linear-gradient(-45deg, #ff670f 0%, #ff670f 10%, #ffffff 40%, #0eea57 60%);
background: linear-gradient(135deg, #ff670f 0%, #ff670f 10%, #ffffff 40%, #0eea57 60%);
}
100% {
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, #ff670f), color-stop(5%, #ff670f), color-stop(10%, #ffffff), color-stop(40%, #0eea57));
background: -webkit-linear-gradient(-45deg, #ff670f 0%, #ff670f 5%, #ffffff 10%, #0eea57 40%);
background: linear-gradient(135deg, #ff670f 0%, #ff670f 5%, #ffffff 10%, #0eea57 40%);
}
}
</style>
<div class="animated">
<h1>Hello</h1>
</div>
Is it possible to accomplish without using jQuery?
My jsfiddle link is https://jsfiddle.net/bAUK6
Please try this code:
#gradient
{
height:300px;
width:300px;
border:1px solid black;
font-size:30px;
background: linear-gradient(130deg, #ff7e00, #ffffff, #5cff00);
background-size: 200% 200%;
-webkit-animation: Animation 5s ease infinite;
-moz-animation: Animation 5s ease infinite;
animation: Animation 5s ease infinite;
}
#-webkit-keyframes Animation {
0%{background-position:10% 0%}
50%{background-position:91% 100%}
100%{background-position:10% 0%}
}
#-moz-keyframes Animation {
0%{background-position:10% 0%}
50%{background-position:91% 100%}
100%{background-position:10% 0%}
}
#keyframes Animation {
0%{background-position:10% 0%}
50%{background-position:91% 100%}
100%{background-position:10% 0%}
}
<html>
<div id="gradient">
Hello
</div>
</html>
Dynamic implementation of Dave's answer:
:root{
--overlay-color-1: #ff0000;
--overlay-color-2: #0000ff;
--anim-duration: 2s;
}
#gradient {
opacity: 0.8;
background: none;
}
#gradient:after,
#gradient:before {
content: '';
display: block;
position: absolute;
top: 0; bottom: 0; left: 0; right: 0;
}
#gradient:before {
background: linear-gradient(135deg, var(--overlay-color-2) 0%, var(--overlay-color-1) 100%);
animation: OpacityAnim var(--anim-duration) ease-in-out 0s infinite alternate;
}
#gradient:after {
background: linear-gradient(135deg, var(--overlay-color-1) 0%, var(--overlay-color-2) 100%);
animation: OpacityAnim var(--anim-duration) ease-in-out calc(-1 * var(--anim-duration)) infinite alternate;
}
#keyframes OpacityAnim {
0%{opacity: 1.0}
100%{opacity: 0.0}
}
<div id="gradient"></div>
Using CSS variables it's now a trivial task.
Here is a basic example (hover to see the result)
#property --a{
syntax: '<angle>';
inherits: false;
initial-value: 90deg;
}
#property --l{
syntax: '<percentage>';
inherits: false;
initial-value: 10%;
}
#property --c{
syntax: '<color>';
inherits: false;
initial-value: red;
}
.box {
/* needed for firefox to have a valid output */
--a:80deg;
--l:10%;
--c:red;
/**/
cursor:pointer;
height:200px;
transition:--a 0.5s 0.1s,--l 0.5s,--c 0.8s;
background:linear-gradient(var(--a), var(--c) var(--l),blue,var(--c) calc(100% - var(--l)));
}
.box:hover {
--a:360deg;
--l:40%;
--c:green;
}
<div class="box"></div>
More details here: https://dev.to/afif/we-can-finally-animate-css-gradient-kdk
How about this:
Set the body margin and padding to 0. Set an html rule to 100% height (higher than 100% may be required).
Set the body to the end state for the gradient.
Create an empty div with a background which is the start state for the gradient. Give the empty div 100% height.
Give both the body and the empty div a background-attachment: fixed;
Create a wrapper for your body content.
Set the empty div to position: fixed;
Set the wrapper to position: relative;
Give both a z-index, the wrapper being higher.
Create an animation that will change the opacity of the empty div from 1 to 0 over the desired time. Add animation-fill-mode:forwards; to the div rule so the animation stays where it ends.
It's not as sexy as a real animated gradient shift, but it's as simple as you can get with CSS only and keyframes, I think.
Here is another way. The following has the static gradient containing all phases of the animation, which is then moved inside the outer element. This allows to perform animation smoothly (as the topic suggests), because the only animation here is the element position.
Please note that for the sake of performance the gradient element left unchanged. Although the question was to animate the gradient, moving the background does practically the same thing, while the performance wins!
.animated {
width: 300px;
height: 300px;
overflow: hidden;
position: relative;
border: 1px solid black;
}
.innerGradient {
z-index: -1;
width: 300%;
height: 300%;
position: absolute;
animation: gra 5s infinite;
-webkit-animation: gra 5s infinite;
background: linear-gradient(135deg, #ff670f 0%, #ff670f 20%, #ffffff 50%, #0eea57 80%, #0eea57 100%);
background: -webkit-linear-gradient(135deg, #ff670f 0%, #ff670f 20%, #ffffff 50%, #0eea57 80%, #0eea57 100%);
}
#keyframes gra {
0% { left: -200%; top: -200%; }
50% { left: 0%; top: 0%; }
100% { left: -200%; top: -200%; }
}
<div class="animated">
<h1>Hello</h1>
<div class="innerGradient"></div>
</div>

Constructing a 3D pyramid with CSS but just need the final touch

I'm almost there, I found the perfect CSS pyramid: https://codepen.io/SL20XX/pen/NZLGjx
But I want to apply this gradient instead of the single "#00B4FF" color:
background-image: linear-gradient(39deg, #12103E 0%, #721B34 100%);
I tried many tweaks but doesn't work. I'm confused with the "$color" variable.
How would you do?
Thanks a lot!
You can put a border-image on each surface rather than a border color.
This snippet does this but has to clip each surface back into a triangle shape.
Note: to get the shading effect you need to decide what linear-gradient you want for each of the lighten/darken colors in your original and subsitute those for the one linear-gradient used here.
<style>
.container {
--color: #00B4FF;
--speed: 5s;
}
.container {
width: 400px;
height: 400px;
margin: 0 auto;
position: relative;
perspective: 300px;
perspective-origin: 50% 40%;
}
.side {
position: absolute;
left: 140px;
top: 150px;
width: 0;
height: 0;
border-left: 60px solid transparent;
border-right: 60px solid transparent;
border-bottom: 120px solid #ccc;
transform-origin: 50% 0%;
animation: spin var(--speed) infinite linear;
}
.back {
animation-delay: calc(var(--speed) / -2);
}
.right {
animation-delay: calc(var(--speed) / -4);
}
.left {
animation-delay: calc(var(--speed) * -0.75);
}
#keyframes spin {
0% {
transform: rotateY(0deg) rotateX(30deg);
/*border-bottom-color: lighten(#0000FF, 5%);*/
border-image: linear-gradient(red, yellow);
clip-path: polygon(0 100%, 100% 100%, 50% 0);
}
25% {
transform: rotateY(90deg) rotateX(30deg);
/*border-bottom-color: darken(#0000FF, 5%);*/
border-image: linear-gradient(red, yellow);
clip-path: polygon(0 100%, 100% 100%, 50% 0);
opacity: 1;
}
25.1% {
opacity: 0;
}
50% {
transform: rotateY(180deg) rotateX(30deg);
/*border-bottom-color: darken(#0000FF, 12%);*/
border-image: linear-gradient(red, yellow);
clip-path: polygon(0 100%, 100% 100%, 50% 0);
}
74.9% {
opacity: 0;
}
75% {
transform: rotateY(270deg) rotateX(30deg);
/*border-bottom-color: darken(#0000FF, 15%);*/
border-image: linear-gradient(red, yellow);
clip-path: polygon(0 100%, 100% 100%, 50% 0);
opacity: 1;
}
100% {
transform: rotateY(360deg) rotateX(30deg);
/*border-bottom-color: lighten(#0000FF, 5%);*/
border-image: linear-gradient(red, yellow);
clip-path: polygon(0 100%, 100% 100%, 50% 0);
}
}
.shadow {
position: absolute;
top: 300px;
left: 175px;
width: 50px;
height: 50px;
background-color: #bbb;
box-shadow: 0 0 40px 40px #bbb;
animation: shadow var(--speed) infinite linear;
}
#keyframes shadow {
0% {
transform: rotateX(90deg) rotateZ(0deg);
}
100% {
transform: rotateX(90deg) rotateZ(-360deg);
}
}
</style>
<div class="container">
<div class="side left"></div>
<div class="side front"></div>
<div class="side right"></div>
<div class="side back"></div>
<div class="shadow"></div>
</div>

Animated pseudo elements and z-index - works in Firefox but not in Chrome

In firefox pseudo elements are behind the div (this is what I wanted to achieve) but in chrome they are on top. Is this a bug in chrome? Anyone knows how to fix this? Adding z-index to the div didn't help me to solve this problem.
I've also tried to apply some styles to div:hover but then when I hover over the div element it falls behind pseudo elements (in Firefox, in Chrome pseudo elements are already on top).
Demo on codepen https://codepen.io/mariuszdaniel/pen/rzdyRV?editors=1100
#keyframes spin {
from {
transform: rotate(0turn)
translateY(-100%) translateY(50%)
rotate(1turn)
}
to {
transform: rotate(1turn)
translateY(-100%) translateY(50%)
rotate(0turn);
}
}
#keyframes spin-rev {
from {
transform: rotate(1turn)
translateY(-100%) translateY(50%)
rotate(0turn)
}
to {
transform: rotate(0turn)
translateY(-100%) translateY(50%)
rotate(1turn);
}
}
#keyframes glow {
from {
filter: blur(100px);
opacity: 0.8
}
to {
filter: blur(200px);
opacity: 0.4;
}
}
.path {
width:300px;
height: 300px;
padding: 20px;
margin: 100px auto;
border-radius: 50%;
background-image: url(https://unsplash.it/300);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
transition: transform 0.5s, box-shadow 0.5s;
}
.path:hover {
transform: scale(1.25);
box-shadow: 0 0 50px 0 #3333;
}
.path::before, .path::after {
content: "";
position:aboslute;
display: block;
width: 75%;
height: 75%;
margin: 25% auto 0;
border-radius: 50%;
/*filter: blur(100px); */
/*opacity: 0.5;*/
}
.path::before {
/*mix-blend-mode: hue;*/
z-index: -200;
background-color: #21D4FD;
background-image: linear-gradient(19deg, #21D4FD 0%, #B721FF 100%);
animation: spin 9s infinite /*alternate*/ linear, glow 3s infinite alternate linear;
}
.path::after {
margin-top: -100%;
z-index: -100;
background-color: #08AEEA;
background-image: linear-gradient(0deg, #08AEEA 0%, #2AF598 100%);
animation: spin-rev 6s infinite /*alternate-reverse*/ linear, glow 6s infinite alternate linear;
}
<div class="path"></div>

CSS radial / circular progress indicator with a transparent middle

I'd like to make a radial progress indicator with css that has it's middle circle transparent. See here: http://codepen.io/geedmo/pen/InFfd – it's a perfect example of what I want to do but the middle (.overlay) has background-color which overlays the bigger circle. However, I'd like to have it transparent (the bigger circle would have transparent middle too). How to do it?
<div class="wrap">
<div class="progress-radial progress-25">
<div class="overlay">25%</div>
</div>
<div class="progress-radial progress-50">
<div class="overlay">50%</div>
</div>
<div class="progress-radial progress-75">
<div class="overlay">75%</div>
</div>
<div class="progress-radial progress-90">
<div class="overlay">90%</div>
</div>
</div>
SASS:
// Colors
$barColor: tomato
$overlayColor: #fffde8
$backColor: #2f3439
#import url(http://fonts.googleapis.com/css?family=Noto+Sans)
body
padding: 30px 0
background-color: $backColor
font-family: 'Noto Sans', sans-serif
.wrap
width: 600px
margin: 0 auto
/* -------------------------------------
* Bar container
* ------------------------------------- */
.progress-radial
float: left
margin-right: 30px
position: relative
width: 100px
height: 100px
border-radius: 50%
border: 2px solid $backColor // remove gradient color
/* -------------------------------------
* Optional centered circle w/text
* ------------------------------------- */
.progress-radial .overlay
position: absolute
width: 60px
height: 60px
background-color: $overlayColor
border-radius: 50%
margin-left: 20px
margin-top: 20px
text-align: center
line-height: 60px
font-size: 16px
/* -------------------------------------
* Mixin for progress-% class
* ------------------------------------- */
$step: 5 // step of % for created classes
$loops: round(100 / $step)
$increment: 360 / $loops
$half: round($loops / 2)
#for $i from 0 through $loops
.progress-#{$i*$step}
#if $i < $half
$nextdeg: 90deg + ( $increment * $i )
border-image: linear-gradient(90deg, $backColor 50%, transparent 50%, transparent), linear-gradient($nextdeg, $barColor 50%, $backColor 50%, $backColor)
#else
$nextdeg: -90deg + ( $increment * ( $i - $half ) )
border-image: linear-gradient($nextdeg, $barColor 50%, transparent 50%, transparent), linear-gradient(270deg, $barColor 50%, $backColor 50%, $backColor)
This is the result I'd like to get:
html code :
<div class="wrapper">
<div class="pie spinner lightBlue"></div>
<div class="pie filler lightBlue"></div>
<div class="mask"></div>
</div>
css code :
body {
background-color: #f3f3f4;
}
.lightBlue {
border: 10px solid #a8d2d2;
}
.wrapper {
width: 250px;
height: 250px;
margin: 10px auto;
position: relative;
background: white;
background-color: #f3f3f4;
-webkit-transition: width 0.5s, height 0.5s;
transition: width 0.5s, height 0.5s;
-webkit-animation: finalRota 2s 10s linear forwards;
animation: finalRota 2s 10s linear forwards;
}
.wrapper .pie {
width: 50%;
height: 100%;
position: absolute;
background-color: radial-gradient(left center, circle, #00ccff 0px, #000088 100%);
-webkit-transform-origin: 100% 50%;
-ms-transform-origin: 100% 50%;
transform-origin: 100% 50%;
}
.wrapper .spinner {
border-radius: 100% 0 0 100% / 50% 0 0 50%;
z-index: 200;
background-color: radial-gradient(right center, circle, #00ccff 0px, #000088 100%);
border-right: none;
-webkit-animation: rota 10s linear forwards;
animation: rota 10s linear forwards;
}
.wrapper .filler {
border-radius: 0 100% 100% 0 / 0 50% 50% 0;
left: 50%;
border: 10px solid #8dbdbb;
opacity: 0;
z-index: 100;
border-left: none;
-webkit-animation: fill 10s steps(1, end) forwards;
animation: fill 10s steps(1, end) forwards;
}
.wrapper .mask {
width: 50%;
height: 100%;
position: absolute;
background: inherit;
opacity: 1;
z-index: 300;
-webkit-animation: mask 10s steps(1, end) forwards;
animation: mask 10s steps(1, end) forwards;
}
#-webkit-keyframes opoFinalRota {
100% {
-webkit-transform: rotate(30deg);
-ms-transform: rotate(30deg);
transform: rotate(30deg);
}
}
#keyframes opoFinalRota {
100% {
-webkit-transform: rotate(30deg);
-ms-transform: rotate(30deg);
transform: rotate(30deg);
}
}
#-webkit-keyframes rota {
0% {
-webkit-transform: rotate(300deg);
transform: rotate(300deg);
}
100% {
-webkit-transform: rotate(60deg);
transform: rotate(60deg);
}
}
#keyframes rota {
0% {
-webkit-transform: rotate(300deg);
transform: rotate(300deg);
}
100% {
-webkit-transform: rotate(60deg);
transform: rotate(60deg);
}
}
#-webkit-keyframes mask {
0% {
opacity: 1;
}
50%, 100% {
opacity: 0;
}
}
#keyframes mask {
0% {
opacity: 1;
}
50%, 100% {
opacity: 0;
}
}
#-webkit-keyframes fill {
0% {
opacity: 0;
}
50%, 100% {
opacity: 1;
}
}
#keyframes fill {
0% {
opacity: 0;
}
50%, 100% {
opacity: 1;
}
}
and a demo : http://jsfiddle.net/usrs01ye/2/
Just set your $overlayColor variable to transparent
$overlayColor: transparent
Here's a working codepen

Resources