Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Css animation across an Arc [duplicate]

animation across an Arc

Is it possible with current CSS3 to animate an object (DIV) along an this arc?

like image 589
Adam Wojda Avatar asked Sep 20 '13 08:09

Adam Wojda


People also ask

How do I stop an animation from repeating CSS?

The basics of pausing an animation The only way to truly pause an animation in CSS is to use the animation-play-state property with a paused value. In JavaScript, the property is “camelCased” as animationPlayState and set like this: element.

Can you have 2 animations in CSS?

You can specify multiple animations--each with their own properties--with a comma.

Can you animate width CSS?

Conclusion. The default width and height CSS properties are (along with most other properties) not suitable for animation. They impact render performance too much because updating them triggers the browser to re-evaluate related element positions and sizes.


1 Answers

I've forked the (very good) @ArunBertil "fulcrum" solution to convert it to CSS3 Animation:

Running Demo

CSS

@keyframes drawArc1 {
    0%   { transform: rotate(180deg);  }
    100% { transform: rotate(0deg);    }
}

@keyframes drawArc2 {
    0%   { transform: rotate(-180deg); }
    100% { transform: rotate(0deg);    }
}

body{
    padding: 150px;    
    background: black;
}

.wrapper {
    width: 300px;
    animation: drawArc1 3s linear infinite;
}

.inner {    
    border-radius: 50%;
    display: inline-block;
    padding: 30px;    
    background: yellowgreen;
    animation: drawArc2 3s linear infinite;
}

HTML

<div class="wrapper">
    <div class="inner"></div>
</div>

Watch it on FireFox... to run it on other browsers, simply put the prefixes (@-webkit-keyframes, etc)

like image 151
Andrea Ligios Avatar answered Oct 02 '22 01:10

Andrea Ligios