CSS3 animation not running in Chrome on MY site - css

I'm trying to animate an SVG with CSS3. You can see an example here -
http://codepen.io/MyXoToD/pen/vBlfs
However this example works exactly as it should in Chrome, however when I implement the code on my site, it doesn't run the code. Yet it works perfectly fine in Firefox. When i Inspect element in Chrome it's putting a line through the animation properties and displaying an error saying 'Invalid property value'. Yet when I look at the example I do the same thing and I don't get the same error.
I'm a little confused and I've been debugging this for a while. It can't be my version of Chrome (which is Version 39.0.2171.95 m).
Although my code is almost exactly the same after some small modifications, here is my snippet:
img {
max-width: 80%;
width: 100%;
//position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
opacity: 0;
animation-name: show;
animation-delay: 6s;
animation-duration: 1s;
animation-fill-mode: forwards;
animation-iteration-count: 1;
animation-timing-function: linear;
}
svg {
max-width: 80%;
width: 100%;
//position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
path {
stroke-width: 2;
stroke: black;
animation-fill-mode: forwards;
animation-iteration-count: 1;
animation-name: draw;
animation-timing-function: linear;
animation-duration: 3s;
&.bird {
stroke: black;
stroke-dasharray: 2810;
stroke-dashoffset: 2810;
}
}
}
}
#keyframes draw {
to {
stroke-dashoffset: 0;
}
}
#keyframes show {
to {
opacity: 1;
}
}

You've enabled the -prefix-free mode on Codepen. It lets you use only unprefixed CSS properties everywhere. It works behind the scenes, adding the current browser’s prefix to any CSS code, only when it’s needed.
For example, on Codepen you will see:
animation-name: show;
instead of:
animation-name: show;
-webkit-animation-name: show;
-moz-animation-name: show;

Related

css browser compatibility firefox not working

I am working on a new website, but when my friend tested it on firefox one of the features was not working.
We found out the css is not working in firefox but it does work in Chrome.
The whole code: https://jsfiddle.net/wvkL6d2b/
We tried
-webkit- and -ms-
#separator{ width: 10px!important; max-width: 60px!important; height: 10px; background:red;}
#keyframes in-out {
from { width: 10px;
}
10%, 100% {
width: 60px;
}
to{ width: 60px; }
}
#separator {
animation-name: in-out;
animation-duration: 8s;
animation-iteration-count: infinite;
animation-timing-function: linear;
animation-delay: 2s;
}
I am trying to get it to work on both browsers
There are so many mistakes in the CSS properties you have written. Please find the updated code here in fiddle.
These are supposed to be properties to use.
#separator {
height: 10px;
background: red;
-webkit-animation: mymove 5s infinite; /* Safari 4.0 - 8.0 */
animation: mymove 5s infinite;
}
#-webkit-keyframes mymove {
0% { width: 10px; }
100% { width: 100px; }
}
/* Standard syntax */
#keyframes mymove {
0% { width: 10px; }
100% { width: 100px; }
}
It's not working because you have declared the wrong property.
The declaration you need for firefox is just animation. Only Chrome and Safari need the -webkit- prefix for this CSS3 effect.
So your code would be:
-webkit-animation:slideshow 21s infinite;
animation:slideshow 21s infinite;
Ref:
http://www.w3schools.com/css3/css3_animations.asp

Animation sprite sheet

I am trying to animate some characters for a school project but I am running into problems. As I am totally new to this world so I am looking for some guidance and I was hoping this would be the right place.
My first question:
I've made a sprite sheet in illustrator for one of my characters. http://gryfaberbay.dk/kea/forhelp/spritesheet.png (I've made it into a png file so you guys can see) When I try to animate my character and make her walk by using my sprite sheet the feet from the overlying sprite show.
Here's my code:
#princess_sprite {
background-image: url(img/spritesheet_prinsesse.svg);
width: 18vw;
height: 45vw;
background-size: 300%;
/* - mod venstre. */
}
.princess_walkcycle {
animation-name: princess_walkcycle_kf;
animation-duration: 2s;
animation-fill-mode: forwards;
animation-iteration-count: infinite;
animation-timing-function: steps(3);
}
#keyframes princess_walkcycle_kf {
0% {
background-position: 0%;
}
100% {
background-position: -300%;
}
}
#princess_container {
position: absolute;
top: 8%;
left: 50%;
}
.princess_move_left {
animation-name: princess_move_left_kf;
animation-duration: 4s;
animation-iteration-count: infinite;
animation-fill-mode: forwards;
/*animation-timing-function: ease;*/
}
#keyframes princess_move_left_kf {
0% {
left: 100%;
}
100% {
left: 71.31%;
}
}
I am hoping you guys are willing to help me! Thanks so much :)
Sincerely,
Gry
You need to adjust the height and width of #princess_sprite in conjunction with background-size property.
Here is a simplified version of your code:
#princess_sprite {
width: 100px;
height: 200px;
background-image: url(http://gryfaberbay.dk/kea/forhelp/spritesheet.png);
background-size: 300%;
animation-name: princess_walkcycle_kf;
animation-duration: 2s;
animation-fill-mode: forwards;
animation-iteration-count: infinite;
animation-timing-function: steps(3);
}
#keyframes princess_walkcycle_kf {
0% {
background-position: 0%;
}
100% {
background-position: -300%;
}
}
<div id="princess_sprite">
</div>

CSS animation (position) not smooth

I made a subtle background movement, but the effect isn't that pleasing. While moving it kinda jerks, you can see the image move pixel by pixel.
How can I change this so it becomes a nice smooth animation.
The Code (https://jsfiddle.net/38tf0j21/):
body {
padding:50px;
margin 0;
height:100vh;
}
.landing_img_container {
position: absolute;
right: 0;
width: calc(100% - 100px);
height: 100%;
animation-name: start_animation;
animation-delay: 1s;
animation-direction: normal;
animation-duration: 5s;
animation-iteration-count: infinite;
animation-timing-function: ease;
}
.landing_img {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color:red;
}
#keyframes start_animation {
0% {
left: 100px;
}
100% {
left: 50px;
}
}
<div class="landing_img_container">
<div class="landing_img"></div>
</div>
This should work like you expect it to: https://jsfiddle.net/38tf0j21/2/
This is using the transform property instead of left
For smooth CSS position animations you need use transform: translate3d property.
See this example

Queue the same animation at two seperate times, without duplicating code and giving new name?

I have two animations bounce and squishstretch.
I'd like to have squishstretch animate first, then bounce, then squishstretch again
This doesn't work:
animation-name: squishstretch, bounce, squishstretch;
animation-duration: .15s, .2s, .12s;
animation-delay: 0, .25s, .55s;
animation-iteration-count: 2, 2, 2;
But this does
animation-name: squishstretch, bounce, squishstretch2;
animation-duration: .15s, .2s, .12s;
animation-delay: 0, .25s, .55s;
animation-iteration-count: 2, 2, 2;
But that means I have to copy out all of squishstretch's rules (with the vendor prefixing it's quite a bit) and give the duplicate a new name.
Is there a way to fix it without having to have large chunks of rules duplicated just so animation-name can have unique names?
Demo: http://jsbin.com/ekebun/1/edit
Make it one animation!
#keyframes squishstretchbounce {
0% { height: 100px; width: 100px; margin-left: 0; bottom:0; }
44% { height: 94px; width: 104px; margin-left: -2px; bottom: -6px;}
88% { height: 100px; width: 100px; margin-left: 0; bottom:0; }
89% { bottom: 0; }
95% { bottom: 10px; }
100% { bottom: 0; }
}
Then use animation: squishstretchbounce 1.4s infinite;. The reason why I have more keyframes than yours compiled is so that it animates back to its default state. Make sure to add the browser prefixes as well. On a side note, I believe the unprefixed keyframes needs to be #keyframes

CSS3 Animations different results on Chrome/Safari

I'm working on a CSS3 Keyframe Animation with a skew() transform. I was able to achieve the result I was looking for in Safari 6. However, when I view the page on another Webkit browser, Chrome I am getting a different animation result.
Here is my code:
HTML
<div id="test">
webkit animation test
</div>
CSS
#test {
position: absolute;
left: 200px;
top: 0px;
width: 200px;
height: 200px;
background-color: rgba(0,0,0,0.5);
-webkit-animation-name: testBox;
-webkit-animation-duration: 5s;
-webkit-animation-timing-function: linear;
-webkit-animation-delay: 0s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-direction: alternate; /* alternate, normal */
-webkit-animation-play-state: running;
}
#-webkit-keyframes testBox /* Safari and Chrome */ {
0% {
-webkit-transform: skew(70deg,0deg);
}
100% {
-webkit-transform: skew(-70deg,0deg);
}
}
Anyone else have this issue?

Resources