我一直在为朋友和家人制作圣诞电子贺卡,其中一部分包括过渡/动画的淡入淡出。我找到了替代解决方案(例如这个: http: //fvsch.com/code/transition-fade/test5.html),但我不知道为什么我现在的代码不起作用 -动画只是不喜欢不透明度吗?
代码:
#ChristmasTree{
position:absolute;
left:750px;
top:20px;
background-image:url(http://i.imgur.com/uk7Z3.png);
opacity:0.0;
animation-play-state:running;
-moz-play-state:running;
-ms-play-state:running;
-o-play-state:running;
-webkit-animation-play-state:running;
animation:treeFadeIn 3s;
-moz-animation:treeFadeIn 3s;
-ms-animation:treeFadeIn 3s;
-o-animation:treeFadeIn 3s;
-webkit-animation:treeFadeIn 3s;
}
@-moz-keyframes treeFadeIn{
from{opacity:0.0}
to{opacity:1}
}
@-webkit-keyframes treeFadeIn{
from{opacity:0.0}
to{opacity:1}
}
@-o-keyframes treeFadeIn{
from{opacity:0.0}
to{opacity:1}
}
@-ms-keyframes treeFadeIn{
from{opacity:0.0;}
to{opacity:1;}
}