I'm trying to play different css animations one after another but I can't figure out how to.
Basically what I'm trying to do is play one Animation, have it on screen for 15 seconds, then play the next one, show it for 15 seconds and on to the next one and when the last one has been played, it should start again from the top.
Here's an example of the first one it should play, show for 15 seconds and then move on to the next one and do the same.
<style> #animated-example {
width: 300px;
height: 200px;
border: solid 1px #1A7404;
position: absolute;
background-color: #62A80A;
}
.animated {
-webkit-animation-duration: 2s;
animation-duration: 2s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
#-webkit-keyframes bounceInLeft {
0% {
opacity: 0;
-webkit-transform: translateX(-2000px);
}
60% {
opacity: 1;
-webkit-transform: translateX(30px);
}
80% {
-webkit-transform: translateX(-10px);
}
100% {
-webkit-transform: translateX(0);
}
}
#keyframes bounceInLeft {
0% {
opacity: 0;
transform: translateX(-2000px);
}
60% {
opacity: 1;
transform: translateX(30px);
}
80% {
transform: translateX(-10px);
}
100% {
transform: translateX(0);
}
}
.bounceInLeft {
-webkit-animation-name: bounceInLeft;
animation-name: bounceInLeft;
}
</style>
<img id="animated-example" class="animated bounceInLeft" src="http://webmarketingtoday.com/wp-content/uploads/Screen-Shot-2012-05-24-at-7.31.54-AM-288x216.png">
And then run another one, show it for 15 seconds and move on.
<style> #animated-example {
width: 300px;
height: 200px;
border: solid 1px #1A7404;
position: absolute;
background-color: #62A80A;
}
.animated {
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
#-webkit-keyframes bounceInDown {
0% {
opacity: 0;
-webkit-transform: translateY(-2000px);
}
60% {
opacity: 1;
-webkit-transform: translateY(30px);
}
80% {
-webkit-transform: translateY(-10px);
}
100% {
-webkit-transform: translateY(0);
}
}
#keyframes bounceInDown {
0% {
opacity: 0;
transform: translateY(-2000px);
}
60% {
opacity: 1;
transform: translateY(30px);
}
80% {
transform: translateY(-10px);
}
100% {
transform: translateY(0);
}
}
.bounceInDown {
-webkit-animation-name: bounceInDown;
animation-name: bounceInDown;
}
</style>
<img id="animated-example" class="animated bounceInDown" src="https://www.facebookbrand.com/img/fb-art.jpg">
The only way to achieve that in pure CSS is to run all the animations at the same time and do some calculations:
the length of each animation should be the same and equal to the total length of desired animations (meaning if you want two 15-second animations, the CSS animations should be set to length of 30 seconds, no delays)
to control the start/end point of each animation, you need to modify the percentages accordingly - in the above case, it means that the first animation ends at 50% and that's when the second animation starts. Also, all in-between values need to be interpolated. It's easy for two animations, but you might need to use a calculator as the total number of animations increases. This is if we don't take the delays into account - the numbers change when we have a 15-second animation that will finish animation after 5 seconds, which now equals 33%, etc...
It will be more clear once you see it in action here:
.animated-example {
width: 300px;
height: 200px;
border: solid 1px #1A7404;
position: absolute;
background-color: #62A80A;
}
.animated {
animation-duration: 20s;
animation-fill-mode: both;
animation-iteration-count: infinite;
}
.bounceInLeft {
-webkit-animation-name: bounceInLeft;
animation-name: bounceInLeft;
}
.bounceInDown {
-webkit-animation-name: bounceInDown;
animation-name: bounceInDown;
}
#keyframes bounceInLeft {
0% {
opacity: 0;
transform: translateX(-2000px);
}
6% {
opacity: 1;
transform: translateX(30px);
}
8% {
transform: translateX(-10px);
}
10% {
transform: translateX(0);
}
40% {
opacity: 1;
transform: translateX(0);
}
42% {
opacity: 1;
transform: translateX(30px);
}
55% {
opacity: 0;
transform: translateX(-2000px);
}
100% {
opacity: 0;
transform: translateX(-2000px);
}
}
#keyframes bounceInDown {
0% {
opacity: 0;
transform: translateY(-2000px);
}
50% {
opacity: 0;
transform: translateY(-2000px);
}
56% {
opacity: 1;
transform: translateY(30px);
}
58% {
transform: translateY(-10px);
}
60% {
transform: translateY(0);
}
90% {
transform: translateY(0);
}
92% {
opacity: 1;
transform: translateY(30px);
}
100% {
opacity: 0;
transform: translateY(-2000px);
}
}
<img class="animated-example animated bounceInLeft" src="http://webmarketingtoday.com/wp-content/uploads/Screen-Shot-2012-05-24-at-7.31.54-AM-288x216.png">
<img class="animated-example animated bounceInDown" src="https://www.facebookbrand.com/img/fb-art.jpg">
Using animation-delay.
animation: a, b;
animation-duration: 2s, 2s;
animation-delay: 0s, 4s;
The animation b will start after 4s while animation a will start without any delay.
animation-delay would do exactly what you're looking for except for the fact that you want the animations to repeat after the last one has been completed; unfortunately there is (currently) no way to specify a delay between iterations of a looping animation.
You could, however, achieve what you're looking to do using a little bit of JavaScript, like the following. To add more animations, simply add their class names to the animations array at the start of the code.
var animations=["bounceInLeft","bounceInDown"],
count=animations.length,
classlist=document.querySelector("img").classList,
holder=document.createElement("div"),
style=window.getComputedStyle(holder),
delay=15,
current,wait,x;
holder.style.display="none";
document.body.appendChild(holder);
animate();
function animate(){
wait=0;
x=0;
while(x<count){
setTimeout(function(a){
classlist.remove(current);
classlist.add(a);
current=a;
},wait*1000,animations[x]);
holder.className=animations[x];
wait+=delay+parseInt(style.getPropertyValue("animation-duration"));
x++;
}
setTimeout(animate,wait*1000);
};
img{
animation-fill-mode:both;
height:200px;
width:300px;
}
.bounceInDown{
animation-duration:1s;
animation-name:bounceInDown;
}
.bounceInLeft{
animation-duration:2s;
animation-name:bounceInLeft;
}
#keyframes bounceInDown{
0%{
opacity:0;
transform:translateY(-2000px);
}
60%{
opacity:1;
transform:translateY(30px);
}
80%{
transform:translateY(-10px);
}
100%{
transform:translateY(0);
}
}
#keyframes bounceInLeft{
0%{
opacity:0;
transform:translateX(-2000px);
}
60%{
opacity:1;
transform:translateX(30px);
}
80%{
transform:translateX(-10px);
}
100%{
transform:translateX(0);
}
}
<img src="http://webmarketingtoday.com/wp-content/uploads/Screen-Shot-2012-05-24-at-7.31.54-AM-288x216.png">
I have managed to achieve something similar by adapting this concept by Noah Addy: http://digitalfio.github.io/Stagger.css/
You will need to work on the timings a bit to get the 15sec delay you want, but other than that it should be fairly straightforward.
i want to rotate the cube and its faces expanded. i have tried something like below,
.wrapper{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.cube-wrap {
width: 40px;
height: 40px;
-webkit-perspective: 2000px;
-webkit-perspective-origin: 50% -500px;
}
.single-box {
background-size: cover;
display: block;
position: absolute;
width: 40px;
height: 40px;
background-color: #60c2ef;
-webkit-transform: rotateY(45deg) translateZ(-200px) rotateX(15deg);
-webkit-transform-origin: 50% 50% 0;
}
.box {
-webkit-transform-style: preserve-3d;
-webkit-animation: rotate 1.5s infinite ease;
}
.side-front {
animation: side-front-animation 3s ease infinite;
animation-delay: 100ms;
transform: rotateY(0deg) translateZ(150px);
animation-fill-mode: forwards;
transform-origin: 50% 50%;
background-color: #007dc5;
-webkit-transform: translateZ(20px);
}
.side-back {
animation: side-back-animation 3s ease infinite;
animation-delay: 100ms;
transform: rotateY(-180deg) translateZ(150px);
animation-fill-mode: forwards;
transform-origin: 50% 50%;
background-color: #007dc5;
border: #ffffff;
-webkit-transform: rotateY(180deg) translateZ(20px);
}
.side-top {
animation: side-top-animation 3s ease infinite;
animation-delay: 0;
transform: rotateX(90deg) translateZ(150px);
animation-fill-mode: forwards;
transform-origin: 50% 50%;
background-color: #007dc5;
-webkit-transform: rotateX(90deg) translateZ(20px);
}
.side-bottom {
animation: side-bottom-animation 3s ease infinite;
animation-delay: 0;
transform: rotateX(-90deg) translateZ(150px);
animation-fill-mode: forwards;
transform-origin: 50% 50%;
background-color: #007dc5;
-webkit-transform: rotateX(-90deg) translateZ(20px);
}
.side-left {
animation: side-left-animation 3s ease infinite;
animation-delay: 100ms;
transform: rotateY(-90deg) translateZ(150px);
animation-fill-mode: forwards;
transform-origin: 50% 50%;
background-color: #007dc5;
-webkit-transform: rotateY(-90deg) translateZ(20px);
}
.side-right {
animation: side-right-animation 3s ease infinite;
animation-delay: 100ms;
transform: rotateY(90deg) translateZ(150px);
animation-fill-mode: forwards;
transform-origin: 50% 50%;
background-color: #007dc5;
-webkit-transform: rotateY(90deg) translateZ(20px);
}
#-webkit-keyframes rotate {
0% { -webkit-transform: rotateY(0); }
100% { -webkit-transform: rotateY(360deg); }
}
#-webkit-keyframes side-top-animation {
0% { opacity: 1; transform: rotateX(90deg) translateZ(150px)}
20% { opacity: 1; transform: rotateX(90deg) translateZ(75px)}
70% { opacity: 1; transform: rotateX(90deg) translateZ(75px) }
90% { opacity: 1; transform: rotateX(90deg) translateZ(150px) }
100% { opacity: 1; transform: rotateX(90deg) translateZ(150px) }
}
#-webkit-keyframes side-bottom-animation {
0% { opacity: 1; transform: rotateX(-90deg) translateZ(150px)}
20% { opacity: 1; transform: rotateX(-90deg) translateZ(75px)}
70% { opacity: 1; transform: rotateX(-90deg) translateZ(75px) }
90% { opacity: 1; transform: rotateX(-90deg) translateZ(150px) }
100% { opacity: 1; transform: rotateX(-90deg) translateZ(150px) }
}
#-webkit-keyframes side-front-animation {
0% { opacity: 1; transform: rotateY(0deg) translateZ(150px)}
20% { opacity: 1; transform: rotateY(0deg) translateZ(75px)}
70% { opacity: 1; transform: rotateY(0deg) translateZ(75px) }
90% { opacity: 1; transform: rotateY(0deg) translateZ(150px) }
100% { opacity: 1; transform: rotateY(0deg) translateZ(150px) }
}
#-webkit-keyframes side-back-animation {
0% { opacity: 1; transform: rotateY(-180deg) translateZ(150px)}
20% { opacity: 1; transform: rotateY(-180deg) translateZ(75px)}
70% { opacity: 1; transform: rotateY(-180deg) translateZ(75px) }
90% { opacity: 1; transform: rotateY(-180deg) translateZ(150px) }
100% { opacity: 1; transform: rotateY(-180deg) translateZ(150px) }
}
#-webkit-keyframes side-left-animation {
0% { opacity: 1; transform: rotateY(-90deg) translateZ(150px)}
20% { opacity: 1; transform: rotateY(-90deg) translateZ(75px)}
70% { opacity: 1; transform: rotateY(-90deg) translateZ(75px) }
90% { opacity: 1; transform: rotateY(-90deg) translateZ(150px) }
100% { opacity: 1; transform: rotateY(-90deg) translateZ(150px) }
}
#-webkit-keyframes side-right-animation {
0% { opacity: 1; transform: rotateY(90deg) translateZ(150px)}
20% { opacity: 1; transform: rotateY(90deg) translateZ(75px)}
70% { opacity: 1; transform: rotateY(90deg) translateZ(75px) }
90% { opacity: 1; transform: rotateY(90deg) translateZ(150px) }
100% { opacity: 1; transform: rotateY(90deg) translateZ(150px) }
}
<div class="wrapper">
<div class="cube-wrap">
<div class="box">
<div class="single-box side-back"></div>
<div class="single-box side-top"></div>
<div class="single-box side-bottom"></div>
<div class="single-box side-left"></div>
<div class="single-box side-right"></div>
<div class="single-box side-front"></div>
</div>
</div>
</div>
The above code works. it rotates and spins but the faces are not close enough to look like a cube. how can i fix this.
could someone help me with this. thanks.
I am not knowing how to add the animations to the cube faces. and the cube should like in image below.
In your code change the height and width of .single-box to 150px to match make a box, then to compensate the changes in the animation also change the height and width of .cube-wrap to the same value of .single-box.
So you get something like this
.wrapper{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.cube-wrap {
width: 130px;
height: 130px;
-webkit-perspective: 2000px;
-webkit-perspective-origin: 50% -500px;
}
.single-box {
background-size: cover;
display: block;
position: absolute;
width: 130px;
height: 130px;
background-color: #60c2ef;
-webkit-transform: rotateY(45deg) translateZ(-200px) rotateX(15deg);
-webkit-transform-origin: 50% 50% 0;
}
.box {
-webkit-transform-style: preserve-3d;
-webkit-animation: rotate 1.5s infinite ease;
}
.side-front {
animation: side-front-animation 3s ease infinite;
animation-delay: 100ms;
transform: rotateY(0deg) translateZ(300px);
animation-fill-mode: forwards;
transform-origin: 50% 50%;
background-color: #007dc5;
-webkit-transform: translateZ(20px);
}
.side-back {
animation: side-back-animation 3s ease infinite;
animation-delay: 100ms;
transform: rotateY(-180deg) translateZ(150px);
animation-fill-mode: forwards;
transform-origin: 50% 50%;
background-color: #007dc5;
border: #ffffff;
-webkit-transform: rotateY(180deg) translateZ(20px);
}
.side-top {
animation: side-top-animation 3s ease infinite;
animation-delay: 0;
transform: rotateX(90deg) translateZ(150px);
animation-fill-mode: forwards;
transform-origin: 50% 50%;
background-color: #007dc5;
-webkit-transform: rotateX(90deg) translateZ(20px);
}
.side-bottom {
animation: side-bottom-animation 3s ease infinite;
animation-delay: 0;
transform: rotateX(-90deg) translateZ(150px);
animation-fill-mode: forwards;
transform-origin: 50% 50%;
background-color: #007dc5;
-webkit-transform: rotateX(-90deg) translateZ(20px);
}
.side-left {
animation: side-left-animation 3s ease infinite;
animation-delay: 100ms;
transform: rotateY(-90deg) translateZ(150px);
animation-fill-mode: forwards;
transform-origin: 50% 50%;
background-color: #007dc5;
-webkit-transform: rotateY(-90deg) translateZ(20px);
}
.side-right {
animation: side-right-animation 3s ease infinite;
animation-delay: 100ms;
transform: rotateY(90deg) translateZ(150px);
animation-fill-mode: forwards;
transform-origin: 50% 50%;
background-color: #007dc5;
-webkit-transform: rotateY(90deg) translateZ(20px);
}
#-webkit-keyframes rotate {
0% { -webkit-transform: rotateY(0); }
100% { -webkit-transform: rotateY(360deg); }
}
#-webkit-keyframes side-top-animation {
0% { opacity: 1; transform: rotateX(90deg) translateZ(150px)}
20% { opacity: 1; transform: rotateX(90deg) translateZ(75px)}
70% { opacity: 1; transform: rotateX(90deg) translateZ(75px) }
90% { opacity: 1; transform: rotateX(90deg) translateZ(150px) }
100% { opacity: 1; transform: rotateX(90deg) translateZ(150px) }
}
#-webkit-keyframes side-bottom-animation {
0% { opacity: 1; transform: rotateX(-90deg) translateZ(150px)}
20% { opacity: 1; transform: rotateX(-90deg) translateZ(75px)}
70% { opacity: 1; transform: rotateX(-90deg) translateZ(75px) }
90% { opacity: 1; transform: rotateX(-90deg) translateZ(150px) }
100% { opacity: 1; transform: rotateX(-90deg) translateZ(150px) }
}
#-webkit-keyframes side-front-animation {
0% { opacity: 1; transform: rotateY(0deg) translateZ(150px)}
20% { opacity: 1; transform: rotateY(0deg) translateZ(75px)}
70% { opacity: 1; transform: rotateY(0deg) translateZ(75px) }
90% { opacity: 1; transform: rotateY(0deg) translateZ(150px) }
100% { opacity: 1; transform: rotateY(0deg) translateZ(150px) }
}
#-webkit-keyframes side-back-animation {
0% { opacity: 1; transform: rotateY(-180deg) translateZ(150px)}
20% { opacity: 1; transform: rotateY(-180deg) translateZ(75px)}
70% { opacity: 1; transform: rotateY(-180deg) translateZ(75px) }
90% { opacity: 1; transform: rotateY(-180deg) translateZ(150px) }
100% { opacity: 1; transform: rotateY(-180deg) translateZ(150px) }
}
#-webkit-keyframes side-left-animation {
0% { opacity: 1; transform: rotateY(-90deg) translateZ(150px)}
20% { opacity: 1; transform: rotateY(-90deg) translateZ(75px)}
70% { opacity: 1; transform: rotateY(-90deg) translateZ(75px) }
90% { opacity: 1; transform: rotateY(-90deg) translateZ(150px) }
100% { opacity: 1; transform: rotateY(-90deg) translateZ(150px) }
}
#-webkit-keyframes side-right-animation {
0% { opacity: 1; transform: rotateY(90deg) translateZ(150px)}
20% { opacity: 1; transform: rotateY(90deg) translateZ(75px)}
70% { opacity: 1; transform: rotateY(90deg) translateZ(75px) }
90% { opacity: 1; transform: rotateY(90deg) translateZ(150px) }
100% { opacity: 1; transform: rotateY(90deg) translateZ(150px) }
}
<div class="wrapper">
<div class="cube-wrap">
<div class="box">
<div class="single-box side-back"></div>
<div class="single-box side-top"></div>
<div class="single-box side-bottom"></div>
<div class="single-box side-left"></div>
<div class="single-box side-right"></div>
<div class="single-box side-front"></div>
</div>
</div>
</div>
I'm wondering if it is possible to reverse a keyframes animation on mouse out after hover without using JavaScript (that's a requirement for a project I'm working on). I have tried animation-direction: alternate; and animation-direction: reverse on the original .molehill selector and on the .molehill:hover > img selector without any luck. See JSFiddle for current status, but essentially the mole is animated to come out of the molehill on hover. When you remove the mouse, he disappears, but I would rather have the animation reverse so it looks like he's slowly going back in.
HTML:
<div class="molehill">
<div>
<img id="m1" src="http://uf.heatherlaude.com/img_directory/molehill-1.png" alt="mole">
</div>
<img id="m2" src="http://uf.heatherlaude.com/img_directory/molehill-2.png" alt="mole">
<img id="m3" src="http://uf.heatherlaude.com/img_directory/molehill-3.png" alt="mole">
<img id="m4" src="http://uf.heatherlaude.com/img_directory/molehill-4.png" alt="mole">
<img id="m5" src="http://uf.heatherlaude.com/img_directory/molehill-5.png" alt="mole">
<img id="m6" src="http://uf.heatherlaude.com/img_directory/molehill-6.png" alt="mole">
<img id="m7" src="http://uf.heatherlaude.com/img_directory/molehill-7.png" alt="mole">
<img id="m8" src="http://uf.heatherlaude.com/img_directory/molehill-8.png" alt="mole">
</div>
CSS:
.molehill {
width: 359px;
height:250px;
position: relative;
}
.molehill > img {
transition: 1s;
}
#m1, #m2, #m3, #m4, #m5, #m6, #m7, #m8 {
position: absolute;
width: 100%
height: 100%;
}
#m2, #m3, #m4, #m5, #m6, #m7, #m8 {
opacity: 0;
}
.molehill:hover > img {
animation-name: molehill_test;
-webkit-animation-name: molehill_test;
animation-duration: 3.25s;
-webkit-animation-duration: 3.25s;
animation-fill-mode: forwards;
-webkit-animation-fill-mode: forwards;
animation-iteration-count: 1;
-webkit-animation-iteration-count: 1;
}
#m2 {
animation-delay:.25s;
-webkit-animation-delay:.25s
}
#m3 {
animation-delay:.75s;
-webkit-animation-delay:.75s
}
#m4 {
animation-delay:1.25s;
-webkit-animation-delay:1.25s
}
#m5 {
animation-delay:1.75s;
-webkit-animation-delay:1.75s
}
#m6 {
animation-delay:2.25s;
-webkit-animation-delay:2.25s
}
#m7 {
animation-delay:2.75s;
-webkit-animation-delay:2.75s
}
#m8 {
animation-delay:3.25s;
-webkit-animation-delay:3.25s
}
#keyframes molehill_test {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 1;
}
}
#-webkit-keyframes molehill_test {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 1;
}
}
Full code on JSFiddle:
https://jsfiddle.net/qmgy4133/
it's possible with the help of jquery
$('#trigger').on({
mouseenter: function() {
$('#item').show();
$('#item').addClass('flipped');
},
mouseleave: function() {
$('#item').removeClass('flipped');
}
});
#trigger {
position: relative;
display: inline-block;
padding: 5px 10px;
margin: 0 0 10px 0;
background: teal;
color: white;
font-family: sans-serif;
}
#item {
position: relative;
height: 100px;
width: 100px;
background: red;
display: none;
-webkit-transform: perspective(350px) rotateX(-90deg);
transform: perspective(350px) rotateX(-90deg);
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
animation: flipperUp 0.7s;
animation-fill-mode: forwards;
-webkit-animation: flipperUp 0.7s;
-webkit-animation-fill-mode: forwards;
}
#item.flipped {
animation: flipper 0.7s;
animation-fill-mode: forwards;
-webkit-animation: flipper 0.7s;
-webkit-animation-fill-mode: forwards;
}
#keyframes flipper {
0% {
transform: perspective(350px) rotateX(-90deg);
}
33% {
transform: perspective(350px) rotateX(0deg);
}
66% {
transform: perspective(350px) rotateX(10deg);
}
100% {
transform: perspective(350px) rotateX(0deg);
}
}
#-webkit-keyframes flipper {
0% {
-webkit-transform: perspective(350px) rotateX(-90deg);
}
33% {
-webkit-transform: perspective(350px) rotateX(0deg);
}
66% {
-webkit-transform: perspective(350px) rotateX(10deg);
}
100% {
-webkit-transform: perspective(350px) rotateX(0deg);
}
}
#keyframes flipperUp {
0% {
transform: perspective(350px) rotateX(0deg);
}
33% {
transform: perspective(350px) rotateX(10deg);
}
66% {
transform: perspective(350px) rotateX(0deg);
}
100% {
transform: perspective(350px) rotateX(-90deg);
}
}
#-webkit-keyframes flipperUp {
0% {
-webkit-transform: perspective(350px) rotateX(0deg);
}
33% {
-webkit-transform: perspective(350px) rotateX(10deg);
}
66% {
-webkit-transform: perspective(350px) rotateX(0deg);
}
100% {
-webkit-transform: perspective(350px) rotateX(-90deg);
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='trigger'>Hover Me</div>
<div id='item'></div>
this is only example
Hi guys a while back i posted a question regarding a banner i was making, well i have the animation working now but i cant get -webkit-transform: translateX(-40%) to work when i combine it with position:absolute.
The problem is i have 3 images and 3 bits of text that i need to fly onto the screen one after the other and end up overlapping which is why i was trying to use position:absolute but i cant get -webkit-transform: translateX(-40%) to work when i do this however i can get -webkit-transform: translateX(-40px) to work but that doesn't help me as i want it to be the same on different screen sizes. Does anybody know how i can get my animation to work with -webkit-transform: translateX(-40%) and have multiple images overlapping?
Example Code:
Html:
<div class="text3" id="txt3">
Moving Text
</div>
Css:
#txt3{
position:absolute;
top: 150px;
z-index: 1;
}
.text3 {
-webkit-animation-duration: 15s;
-webkit-animation-iteration-count: 1;
-webkit-animation-timing-function: ease;
-webkit-animation-fill-mode: both;
-moz-animation-duration: 15s;
-moz-animation-iteration-count: 1;
-moz-animation-timing-function: ease;
-moz-animation-fill-mode: both;
-o-animation-duration: 15s;
-o-animation-iteration-count: 1;
-o-animation-timing-function: ease;
-o-animation-fill-mode: both;
animation-duration: 15s;
animation-iteration-count: 1;
animation-timing-function: ease;
animation-fill-mode: both;}
#-webkit-keyframes text3 {
0% {
-webkit-transform: translateX(-40%)
;opacity: 1;
}
3% {
-webkit-transform: translateX(-40%)
}
30% {
-webkit-transform: translateX(20%)
}
37% {
-webkit-transform: translateX(20%)
;opacity: 1;
}
50% {
-webkit-transform: translateX(35%)
;opacity: 0;
}
100% {
opacity: 0;
-webkit-transform: translateX(35%)
}
}
#-moz-keyframes text3 {
0% {
-moz-transform: translateX(-40%)
;opacity: 1;
}
3% {
-moz-transform: translateX(-40%)
}
30% {
-moz-transform: translateX(20%)
}
37% {
-moz-transform: translateX(20%)
;opacity: 1;
}
50% {
-moz-transform: translateX(35%)
;opacity: 0;
}
100% {
opacity: 0;
-moz-transform: translateX(35%)
}
}
#-o-keyframes text3 {
0% {
-o-transform: translateX(-40%)
;opacity: 1;
}
3% {
-o-transform: translateX(-40%)
}
30% {
-o-transform: translateX(20%)
}
37% {
-o-transform: translateX(20%)
;opacity: 1;
}
50% {
-o-transform: translateX(35%)
;opacity: 0;
}
100% {
opacity: 0;
-o-transform: translateX(35%)
}
}
#keyframes text3 {
0% {
transform: translateX(-40%)
;opacity: 1;
}
3% {
transform: translateX(-40%)
}
30% {
transform: translateX(20%)
}
37% {
transform: translateX(20%)
;opacity: 1;
}
50% {
transform: translateX(35%)
;opacity: 0;
}
100% {
opacity: 0;
transform: translateX(35%)
}
}
.text3 {
-webkit-animation-name: text3;
-moz-animation-name: text3;
-o-animation-name: text3;
animation-name: text3;
}
Here are some working example of the animation:
-webkit-transform: translateX(-40%)
position:absolute
Any Help would be greatly appreciated.
crackruckles
Is it possible to have 2 #-webkit-keyframes on 1 css? Like
#-webkit-keyframes pulse_one{
0% { -webkit-transform: scale(1); }
30% { -webkit-transform: scale(1); }
40% { -webkit-transform: scale(1.08); }
50% { -webkit-transform: scale(1); background-color: #b81900; }
60% { -webkit-transform: scale(1); }
70% { -webkit-transform: scale(1.05); }
80% { -webkit-transform: scale(1); }
100% { -webkit-transform: scale(1); }
}
#-webkit-keyframes pulse_two{
0% { -webkit-transform: scale(1); }
30% { -webkit-transform: scale(1); }
40% { -webkit-transform: scale(1.08); }
50% { -webkit-transform: scale(1); background-color: #eea236; }
60% { -webkit-transform: scale(1); }
70% { -webkit-transform: scale(1.05); }
80% { -webkit-transform: scale(1); }
100% { -webkit-transform: scale(1); }
}
#pulseOne
{
-webkit-animation-name: 'pulse_one';
-webkit-animation-duration: 5000ms;
-webkit-transform-origin:70% 70%;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
}
#pulseTwo
{
-webkit-animation-name: 'pulse_two';
-webkit-animation-duration: 5000ms;
-webkit-transform-origin:70% 70%;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
}
I got the error saying "Unexpected token WEBKIT_KEYFRAMES_SYM found". But my 2 animation above works perfectly fine on my page. Im just curious and its kinda bug me a little when have a red line on my code. Any help is apreciated. Thanks :)