Reputation: 3
I want to create a banner with 6 frames, without the css stylesheet and use only style tags in html.
I posted the 3rd and 4th since they are different and that can be seen.
My problem is that in firefox it stops on the 4th(1-2-3-4-4-4) frame and doesn't continue to the 5th and 6th and in IE i can see only the 1st,2nd and it jumps to the 5th frame.
3rd frame
<div style="width:1000px; height:120px;top:0px; left:0px; position:absolute; animation: frame3-animation 30s infinite ease-in;">
<img src="img/background2.jpg" style="position: absolute; top:0px; left:0px; " alt="">
<img src="img/white_background.png" style="position: absolute; top:10px; left:36px; " alt="">
<img src="img/logo2.png" style="top:7px; left:18px; position: absolute; background-position: center; background-repeat: no-repeat;" alt="">
<img src="img/frame3_cat_traiesti.png" style="position: absolute; top:20px; left:355px; " alt="">
<style>@-webkit-keyframes frame3-animation {
0% { opacity:1;}
48% { opacity:1;}
49% {opacity:0;}
99% {opacity:0;}
99.99999% {opacity:0;}
}</style>
<style>@-moz-keyframes frame3-animation {
0% { opacity:1;}
48% { opacity:1;}
49% {opacity:0;}
99% {opacity:0;}
99.99999% {opacity:0;}
}</style>
<style>@-oz-keyframes frame3-animation {
0% { opacity:1;}
48% { opacity:1;}
49% {opacity:0;}
99% {opacity:0;}
99.99999% {opacity:0;}
}</style>
<style>@-ms-keyframes frame3-animation {
0% { opacity:1;}
48% { opacity:1;}
49% {opacity:0;}
99% {opacity:0;}
99.99999% {opacity:0;}
}</style>
This is the 4th frame. I used z-index in the animation because it has the clickable button and without z-index it just wouldn't be clickable
<div style="width:1000px; height:120px; top:0px; left:0px; position:absolute; animation: frame4-animation 30s infinite ease-in;">
<img src="img/background2.jpg" style="position: absolute; top:0px; left:0px; overflow: visible;" alt="">
<img src="img/white_background2.png" style="position: absolute; top:8px; left:35px; overflow: visible;" alt="">
<img src="img/frame4_cat_traiesti.png" style="position: absolute; top:30px; left:140px; overflow: visible;" alt="">
<img src="img/frame4_circle.png" style="position: absolute; top:11px; left:470px; overflow: visible;" alt="">
<img src="img/frame4_1x.png" style="position: absolute; top:17px; left:596px; overflow: visible;" alt="">
<img src="img/logo2.png" style="position: absolute; top:7px; left:18px; overflow: visible; background-position: center; background-repeat: no-repeat;" alt="">
<a href="INSERT LINK" target="_blank" style="position: absolute; top:44px; left:768px; "><img src="img/promotie.png" style="overflow: visible;" alt=""></a><!-- Insert Link-->
<style>@-webkit-keyframes frame4-animation {
0% {opacity:1;}
65% {opacity:1;}
66% {z-index:2;}
99% {z-index:2;}
99.99999% {z-index:2;}
}</style>
<style>@-moz-keyframes frame4-animation {
0% {opacity:1;}
65% {opacity:1;}
66% {z-index:2;}
99% {z-index:2;}
99.99999% {z-index:2;}
}</style>
<style>@-oz-keyframes frame4-animation {
0% {opacity:1;}
65% {opacity:1;}
66% {z-index:2;}
99% {z-index:2;}
99.99999% {z-index:2;}
}</style>
<style>@-ms-keyframes frame4-animation {
0% {opacity:1;}
65% {opacity:1;}
66% {z-index:2;}
99% {z-index:2;}
99.99999% {z-index:2;}
}</style>
And this is the style from 5th frame (to see the difference from the 4th)
<style>@-webkit-keyframes frame5-animation {
0% { opacity:1;}
81% { opacity:1;}
82% {z-index:9;}
99% {z-index:9;}
99.99999% {z-index:9;}
}</style>
<style>@-moz-keyframes frame5-animation {
0% { opacity:1;}
81% { opacity:1;}
82% {z-index:9;}
99% {z-index:9;}
99.99999% {z-index:9;}
}</style>
<style>@-oz-keyframes frame5-animation {
0% { opacity:1;}
81% { opacity:1;}
82% {z-index:9;}
99% {z-index:9;}
99.99999% {z-index:9;}
}</style>
<style>@-ms-keyframes frame5-animation {
0% { opacity:1;}
81% { opacity:1;}
82% {z-index:9;}
99% {z-index:9;}
99.99999% {z-index:9;}
}</style>
Plus I'd like to have smoother transitions. The first 3 go quite smooth, but are slower that I'd like and 4-6 are instant transitions. I'd like to have "a middle way" between these 2.
1-3 style transition are the same, 4-5 can be seen and the 6 has just a higher index than 5.
Thanks.
Upvotes: 0
Views: 378
Reputation: 15000
Animation short hand:
animation: NAME, DURATION, TIMING-FUNCTION, DELAY, ITERATIONCOUNT, DIRECTION, FILL-MODE, PLAY-STATE
Your animation:
animation: frame3-animation 30s infinite ease-in;
frame3-animation
= NAME
30s
= DURATION
infinite
= ITERATION-COUNT
ease-in
= TIMING-FUNCTION
Plus I'd like to have smoother transitions.
I do not know what you consider smoother transitions.
What do you want to transition?
What keyframe/frame are you talking about?
What do you consider to be a smooth transition?
The first 3 go quite smooth, but are slower that I'd like
This i can help you with:
If you want a keyframe animation to go faster set a shorter duration on the keyframe:
animation: NAME DURATION ITERATIONCOUNT;
animation: frame3-animation 5s infinite ease-in;
animation: frame3-animation 2s infinite ease-in;
etc.
4-6 are instant transitions. I'd like to have "a middle way" between these 2.
Then you have to set the DURATION of the animation larger then 0s to avoid getting an instant transition and smaller then 30s.
You are using z-index in keyframe-animation and opacity,
So my guess is that you are animating some element to appear and disappear.
When using the z-index in a animation it will happen instantly.
.frame {
display: inline-block;
border: 10px dotted pink;
padding: 50px;
}
.bubble {
position: relative;
display: inline-block;
width: 100px;
height: 100px;
border-radius: 50%;
opacity: 1;
}
.red {
left: 10%;
background-color: red;
animation: shuffle 2s infinite;
}
.blue {
left: -10%;
background-color: blue;
animation: shuffle2 2s infinite;
}
@keyframes shuffle {
0% {
opacity: 1;
z-index: 10;
}
50% {
opacity: 0.5;
z-index: 0;
}
100% {
opacity: 1;
z-index: 10;
}
}
@keyframes shuffle2 {
0% {
z-index: 0;
}
50% {
z-index: 10;
}
100% {
z-index: 0;
}
}
<div class="frame">
<div class="bubble red"></div>
<div class="bubble blue"></div>
</div>
In the example above i adjusted the keyframe so that exactly when the red circle becomes transparent the z-index changes. When this is done you can see that the blue circle jumps behind the red one. And having the z-index higher will make it clickable eg. pointer-events will work on the element.
For future reference here are some points from How do i ask good questions:
Upvotes: 1