I have created simple progress-bar alike animation using keyframes. Seems to not work on windows safari 5.1.7, also on mac safari (can't provide version). Here is fiddle i created http://jsfiddle.net/26tgnrff/4/ . Been digging around for some while, but cant find solution.
Thanks.
html:
<div class="content">
<h3>Animation demo</h3>
<ul id="skill">
<li><span class="animated expand y2003 green"></span>
</li>
<li><span class="animated expand y2006 purple"></span>
</li>
<li><span class="animated expand y2008 green"></span>
</li>
<li><span class="animated expand y2011 purple"></span>
</li>
<li><span class="animated expand y2014 green"></span>
</li>
</ul>
</div>
css:
.expand {
height: 25px;
margin: 2px 0;
position: absolute;
}
.expand.green {
background: #8DD005;
box-shadow: 0px 0px 7px 0px #86a624;
}
.expand.purple {
background: #5a3266;
box-shadow: 0px 0px 7px 0px #5a3266;
}
.animated.y2003 {
width: 15%;
-moz-animation: html5 2s ease-out;
-webkit-animation: html5 2s ease-out;
animation: html5 2s ease-out;
}
.animated.y2006 {
width: 52.5%;
-moz-animation: css3 2s ease-out;
-webkit-animation: css3 2s ease-out;
animation: css3 2s ease-out;
}
.animated.y2008 {
width: 84.7%;
-moz-animation: jquery 2s ease-out;
-webkit-animation: jquery 2s ease-out;
animation: jquery 2s ease-out;
}
.animated.y2011 {
width: 77.5%;
-moz-animation: photoshop 2s ease-out;
-webkit-animation: photoshop 2s ease-out;
animation: photoshop 2s ease-out;
}
.animated.y2014 {
width: 100%;
-moz-animation: dreamweaver 2s ease-out;
-webkit-animation: dreamweaver 2s ease-out;
animation: dreamweaver 2s ease-out;
}
#-moz-keyframes html5 {
from {
width: 5px;
}
to {
width: 15%;
}
}
#-moz-keyframes css3 {
from {
width: 5px;
}
to {
width: 52.5%;
}
}
#-moz-keyframes jquery {
from {
width: 5px;
}
to {
width: 84.7%;
}
}
#-moz-keyframes photoshop {
from {
width: 5px;
}
to {
width: 77.5%;
}
}
#-moz-keyframes dreamweaver {
from {
width: 5px;
}
to {
width: 100%;
}
}
#-webkit-keyframes'html5' {
from {
width: 5px;
}
to {
width: 15%;
}
}
#-webkit-keyframes'css3' {
from {
width: 5px;
}
to {
width: 52.5%;
}
}
#-webkit-keyframes'jquery' {
from {
width: 5px;
}
to {
width: 84.7%;
}
}
#-webkit-keyframes'photoshop' {
from {
width: 5px;
}
to {
width: 77.5%;
}
}
#-webkit-keyframes'dreamweaver' {
from {
width: 5px;
}
to {
width: 100%;
}
}
You have extra semicolons at the end of your keyframes - should be e.g.
#-webkit-keyframes'photoshop' {
from {
width: 5px;
}
to {
width: 77.5%;
}
/* no semicolon here */
}
Updated fiddle http://jsfiddle.net/26tgnrff/8/
Further, on Safari 5 you can't animate width to a percentage value. If you use px values instead of % the animation will work.
However you can achieve a similar effect with scaling instead, and then you don't need the actual values in the keyframes:
#-webkit-keyframes'html5' {
from {
-webkit-transform-origin: 0 0;
-webkit-transform: scale(0,1);
}
to {
-webkit-transform-origin: 0 0;
-webkit-transform: scale(1,1);
}
}
Updated fiddle (only animating the first bar as an example) http://jsfiddle.net/26tgnrff/9/
Related
Hello I want to have smooth typing animation in css but my code doesn't work smoothly
My text just appears on the screen suddenly
Here's my css code:
.title-text {
white-space: nowrap;
overflow: hidden;
animation: typing 4s steps(40) 1s 1 normal both;
}
#keyframes typing {
from {
width: 0;
}
to {
width: fit-content;
}
}
Thanks in advance
You have to pass specific width. The fit-content seems to be not working.
.title-text {
white-space: nowrap;
overflow: hidden;
animation: typing 4s steps(40) 1s 1 normal both;
}
#keyframes typing {
from {
width: 0;
}
to {
width: 200px;
}
}
Try this code
.title-text{
white-space: nowrap;
overflow: hidden;
animation: typing 1s steps(40) 1s 4 normal both;
}
#keyframes typing{
from{
width: 0;
}to{
width: 100px;
}
}
You can achieve this with transform: scaleX(n) where n transitions from 0 to 1:
.title-text{
white-space: nowrap;
overflow: hidden;
animation: typing .4s steps(40) 0s 1 normal both;
display:inline-block;
transform-origin:left;
}
#keyframes typing{
from{
transform: scaleX(0);
}to{
transform: scaleX(1)
}
}
<div class="title-text">This is the title</div>
Maybe you can try with this:
.title-text h1 {
overflow: hidden;
border-right: .15em solid orange;
white-space: nowrap;
margin: 0 auto;
letter-spacing: .15em;
animation:
typing 3.5s steps(30, end),
blink-caret .5s step-end infinite;
}
#keyframes typing {
from { width: 0 }
to { width: 100% }
}
#keyframes blink-caret {
from, to { border-color: transparent }
50% { border-color: orange }
}
HTML:
<div class="title-text">
<h1>This is a Heading.</h1>
</div>
I have a CSS class for flickering animation and can't find a way to not apply it on child buttons inside.
Tried animation: none !importnant but had no luck.
#keyframes blinker {
50% {
opacity: 0;
}
}
.useBliinker {
border: 0.1em dashed #ff6a00;
animation: blinker 1s linear infinite;
}
.useBliinker>button {
animation: none !important;
transition: none !important;
}
<div class="useBliinker">
<button>Button</button>
</div>
You can't exclude children from an animation, since you're animating their container as a whole; it's the same as opacity, etc.
You can just animate the border-color instead:
#keyframes blinker {
50% {
border-color: #ff6a00;
}
}
.useBliinker {
border: 0.1em dashed transparent;
animation: blinker 1s linear infinite;
}
<div class="useBliinker">
<button>Button</button>
</div>
Alternatively, you can also animate a psuedo-element instead:
#keyframes blinker {
50% {
opacity: 0;
}
}
.useBliinker {
padding: .1em;
position: relative;
}
.useBliinker::after {
animation: blinker 1s linear infinite;
border: .1em dashed #ff6a00;
bottom: 0;
content: '';
display: block;
left: 0;
position: absolute;
right: 0;
top: 0;
}
<div class="useBliinker">
<button>Button</button>
</div>
you can only do it with border
#keyframes btnBorder {
50% {
border-color:transparent;
}
}
.useBliinker {
padding: .1em;
animation: btnBorder 1s linear infinite;
border: .1em dashed #ff6a00;
}
<div class="useBliinker">
<button>Button</button>
</div>
I am trying to get the typing animation effect to continue one line at a time when the size of parent container forces the text to span multiple lines.
/* The typing effect */
#keyframes typing {
from {
width: 0;
}
to {
width: 100%;
}
}
/* The typewriter cursor effect */
#keyframes blink-caret {
from,
to {
border-color: transparent;
}
50% {
border-color: green;
}
}
.animated-text {
font: bold 1.45em monospace;
color: black;
border-right: 0.6em solid;
overflow: hidden; /* Ensures the content is not revealed until the animation */
margin: 0 auto; /* Gives that scrolling effect as the typing happens */
animation: typing 3.5s steps(40, end), blink-caret 0.9s step-end infinite;
}
.container {
border: 10px solid;
position: absolute;
width: 25%;
height: 32%;
left: 35%
}
<div class='container'>
<h1 class='animated-text'>The typing effect should continue line by line at a time when the text needs to wrap</h1>
</div>
I've been searching for the answer to this question as well.
The closest I could find was this - multiline typewriter effect. However, you have to manually set the width of each p tag. I've yet to find a way to dynamically set the width of each line.
All lines except for the last line uses border-right to display the typewriter effect, only the last line has blink animation which is the typewriter cursor.
<div class="css-typing">
<p>
Hi I'm Jenssen Lee! Looking to start my career as a Front-End Developer in Singapore.
</p>
<p>
I have experience with HTML, SASS, Bootstrap, JavaScript, jQuery, React, Node.js, Express.
</p>
<p>
This site was designed and built by me - the code is available on Github.
</p>
</div>
.css-typing p {
border-right: .15em solid orange;
font-family: "Courier";
font-size: 14px;
white-space: nowrap;
overflow: hidden;
}
.css-typing p:nth-child(1) {
width: 780px; /* manually set width */
-webkit-animation: type 2s steps(40, end);
animation: type 2s steps(40, end);
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}
.css-typing p:nth-child(2) {
width: 780px; /* manually set width */
opacity: 0;
-webkit-animation: type2 2s steps(40, end);
animation: type2 2s steps(40, end);
-webkit-animation-delay: 2s;
animation-delay: 2s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}
.css-typing p:nth-child(3) {
width: 620px; /* manually set width */
opacity: 0;
-webkit-animation: type3 5s steps(20, end), blink .5s step-end infinite alternate;
animation: type3 2s steps(20, end), blink .5s step-end infinite alternate;
-webkit-animation-delay: 4s;
animation-delay: 4s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}
#keyframes type {
0% {
width: 0;
}
99.9% {
border-right: .15em solid orange;
}
100% {
border: none;
}
}
#-webkit-keyframes type {
0% {
width: 0;
}
99.9% {
border-right: .15em solid orange;
}
100% {
border: none;
}
}
#keyframes type2 {
0% {
width: 0;
}
1% {
opacity: 1;
}
99.9% {
border-right: .15em solid orange;
}
100% {
opacity: 1;
border: none;
}
}
#-webkit-keyframes type2 {
0% {
width: 0;
}
1% {
opacity: 1;
}
99.9% {
border-right: .15em solid orange;
}
100% {
opacity: 1;
border: none;
}
}
#keyframes type3 {
0% {
width: 0;
}
1% {
opacity: 1;
}
100% {
opacity: 1;
}
}
#-webkit-keyframes type3 {
0% {
width: 0;
}
1% {
opacity: 1;
}
100% {
opacity: 1;
}
}
#keyframes blink {
50% {
border-color: transparent;
}
}
#-webkit-keyframes blink {
50% {
border-color: tranparent;
}
}
I have an ul. With javascript I add the li's to it. I need the added li with background-color #E4F3D6 then 10 seconds later change to #DDD as final color.
I know this is possible with animation and transition-delay but I don't figure out how.
I wrote this but doesn't work properly:
#-webkit-keyframes change-color {
0% {
background-color: #E4F3D6;
/*-webkit-transition-delay: 5s;*/
}
100% { background-color: transparent; }
}
#-moz-keyframes change-color {
0% {
background-color: #E4F3D6;
/*-moz-transition-delay: 5s;*/
}
100% { background-color: transparent; }
}
#keyframes change-color {
0% {
background-color: #E4F3D6;
/*transition-delay: 5s;*/
}
100% { background-color: transparent; }
}
.test {
height: 25px;
background-color: #E4F3D6;
-webkit-animation: change-color 2s ease;
-moz-animation: change-color 2s ease;
animation: change-color 2s ease;
}
Here a demo: https://jsfiddle.net/junihh/a657pd6q/4/
Anyone help me, please.
Set the transition-delay property in the CSS for the element itself:
.test {
height: 25px;
background-color: #E4F3D6;
-webkit-animation: change-color 2s ease 5s forwards;
-moz-animation: change-color 2s ease 5s forwards;
animation: change-color 2s ease 5s forwards;
}
The above uses the shorthand alternative for the animation property:
animation: <animation-name> <animation-duration> <animation-type> <animation-duration> <animation-fill-mode>
The animation-delay property does precisely what its name suggests, it delays the start of the animation by the value specified (here 5s, five seconds); the animation-fill-mode property causes the final values of the animation to persist once the animation has completed:
document.getElementById('add').addEventListener('click', function() {
var li = document.createElement('li');
li.innerHTML = '<div class="test"></div>';
document.getElementById('container').appendChild(li);
}, false);
* {
margin: 0;
padding: 0;
border: 0;
list-style: none;
}
#container {
width: 200px;
margin: 20px auto 0;
padding: 15px;
background-color: #FFF;
border: solid 1px #DDD;
}
#container li {
background-color: #DDD;
margin-bottom: 4px;
}
#container li:last-child {
margin-bottom: 0;
}
.button-box {
margin: 20px auto 0;
width: 100px;
}
#add {
width: 100%;
padding: 10px 0;
background-color: #666;
cursor: pointer;
font-size: 14px;
color: #FFF;
}
#add:active {
background-color: #333;
}
#-webkit-keyframes change-color {
0% {
background-color: #E4F3D6;
}
100% {
background-color: #F90;
}
}
#-moz-keyframes change-color {
0% {
background-color: #E4F3D6;
}
100% {
background-color: #F90;
}
}
#keyframes change-color {
0% {
background-color: #E4F3D6;
}
100% {
background-color: #F90;
}
}
.test {
height: 25px;
background-color: #E4F3D6;
-webkit-animation: change-color 2s ease 5s forwards;
-moz-animation: change-color 2s ease 5s forwards;
animation: change-color 2s ease 5s forwards;
}
<ul id="container">
<!-- li's -->
</ul>
<div class="button-box">
<button type="button" id="add">Add row</button>
</div>
JS Fiddle demo.
Note that, in the demo, I've used a final colour of #f90 instead of #ddd simply to make the animation more obvious (the difference between the start and end colours, otherwise, are easy to miss).
I am trying to implement a spinner only using CSS that looks like on following image, see the picture. Only one piece of the spinner is filled with color at a time.
In the following fiddle, there is a similar spinner, but I need to rotate the whole spinner (22.5°) and also to modify its rays.
http://jsfiddle.net/ucsnaukf/
HTML:
<div class="spinner"><div>Loading…</div></div>
CSS:
#-webkit-keyframes spin {
to { transform: rotate(1turn); }
}
#-moz-keyframes spin {
to { transform: rotate(1turn); }
}
#-ms-keyframes spin {
to { transform: rotate(1turn); }
}
#keyframes spin {
to { transform: rotate(1turn); }
}
.spinner {
position: relative;
display: inline-block;
width: 5em;
height: 5em;
margin: 0 .5em;
font-size: 12px;
text-indent: 999em;
overflow: hidden;
-webkit-animation: spin 0.8s infinite steps(8);
-moz-animation: spin 0.8s infinite steps(8);
-ms-animation: spin 0.8s infinite steps(8);
-o-animation: spin 0.8s infinite steps(8);
animation: spin 0.8s infinite steps(8);
}
.spinner:before,
.spinner:after,
.spinner > div:before,
.spinner > div:after {
content: '';
position: absolute;
top: 0;
left: 2.25em; /* (container width - part width)/2 */
width: .5em;
height: 1.5em;
border-radius: .2em;
background: #eee;
box-shadow: 0 3.5em #eee; /* container height - part height */
transform-origin: 50% 2.5em; /* container height / 2 */
}
.spinner:before {
background: blue;
}
.spinner:after {
transform: rotate(-45deg);
}
.spinner > div:before {
transform: rotate(-90deg);
}
.spinner > div:after {
transform: rotate(-135deg);
}
Can anyone help?
Here's a start for you (http://jsfiddle.net/ucsnaukf/73/):
<--! HTML -->
<div class="wrapper">
<div class="spinner">
<div>Loading…
</div>
</div>
<div class="circ"></div>
</div>
/* CSS */
#-webkit-keyframes spin {
to { transform: rotate(1turn); }
}
#-moz-keyframes spin {
to { transform: rotate(1turn); }
}
#-ms-keyframes spin {
to { transform: rotate(1turn); }
}
#keyframes spin {
to { transform: rotate(1turn); }
}
.wrapper{
border:1px solid white;
border-radius:100%;
position:relative;
width: 5em;
height: 5em;
border-radius:999px;
overflow:hidden;
}
/* Circular mask */
.circ{
border:1px solid WHITE;
position:absolute;
top:10%;
left:10%;
right:0;
bottom:0;
width:55%;
height:55%;
background-color:#fff;
border-radius:999px;
}
.spinner {
border:1px solid white;
border-radius:100%;/* Round the border */
position: absolute;
display: inline-block;
width: 5em;
height: 5em;
font-size: 12px;
text-indent: 999em;
overflow: hidden;
-webkit-animation: spin 0.8s infinite steps(8);
-moz-animation: spin 0.8s infinite steps(8);
-ms-animation: spin 0.8s infinite steps(8);
-o-animation: spin 0.8s infinite steps(8);
animation: spin 0.8s infinite steps(8);
}
.spinner:before,
.spinner:after,
.spinner > div:before,
.spinner > div:after {
content: '';
position: absolute;
top: 0;
left: 1.8em; /* (container width - part width)/2 */
width: 1.4em; /* longer */
height: .8em; /* shorter */
background: #eee;
box-shadow: 0 4.2em #eee; /* container height - part height */
transform-origin: 50% 2.5em; /* container height / 2 */
}
.spinner:before {
background: purple;
}
.spinner:after {
transform: rotate(-45deg);
}
.spinner > div:before {
transform: rotate(-90deg);
}
.spinner > div:after {
transform: rotate(-135deg);
}
Looks a bit flower like, but continue playing with it and you'll get it the way you want.
You may want to consider used one of the many, great looking, free to use spinners available on the web... check out this massive collection for example: http://codepen.io/collection/HtAne/