html - How can I get around this issue? Two animations on one element? -


so i'm trying somehow 2 animations on 1 element can't able fix it.

here jsfiddle includes important things. full picture, check here. want make alien represents letter l coming in right left (= position at).

so want alien moves right left, moving legs, , image of alien.

i explain of code.

html:

            <div class="letter_l">                  <div class="monster_l">                     <img src="http://googledoodle.lucasdebelder.be/images/l/monster.png">                 </div>                 <div class="benen_l">                     <div class="b_1"></div>                     <div class="b_2"></div>                     <div class="b_1 b_3"></div>                     <div class="b_2 b_4"></div>                 </div>             </div> 

.monster_l represents image of alien

.benen_l represents legs (=benen)

css

/*monster l*/ .monster_l img {     position: absolute;     bottom: 296px;     left: 596px;     z-index: 50;     opacity: 1;     width: 70px; }  /*been1*/ .b_1 {     position: absolute;     bottom: 293px;     left: 597px;     z-index: 40;     opacity: 1;     width: 8px;     height: 50px;     background-color: #297f40;     border-radius: 0 0 15px 15px;      animation-name: animation_b_1;     animation-delay: 0s;     animation-duration: 2s;     animation-iteration-count: infinite;     animation-timing-function: ease-in-out; } /*been2*/ .b_2 {     position: absolute;     bottom: 286px;     left: 605px;     z-index: 40;     opacity: 1;     width: 8px;     height: 50px;     background-color: #297f40;     border-radius: 0 0 15px 15px;      animation-name: animation_b_2;     animation-delay: 0s;     animation-duration: 2s;     animation-iteration-count: infinite;     animation-timing-function: ease-in-out; } /*been3*/ .b_3 {     left: 613px; } /*been4*/ .b_4 {     left: 621px; } @keyframes animation_b_1 {     0%{ bottom: 293px; }     50% { bottom: 286px; }     100%{ bottom: 293px; } } @keyframes animation_b_2 {     0%{ bottom: 286px; }     50% { bottom: 293px; }     100%{ bottom: 286px; } } 

you have apply position: absolute letter_l , apply keyframe translation right property.

however when apply position: absolute or position: relative letter_l, position: absolute elements inside not going relative letter_l. have change top, bottom, left coordinates accordingly.

i have tried solve you.

check updated fiddle.

refer code:

.letter_l {    width: 100px;    position: absolute;    /* z-index: 100000000; */    height: 90px;    animation-name: movertl;    animation-delay: 0s;    animation-duration: 2s;    animation-iteration-count: infinite;    animation-timing-function: ease-in-out;  }      /*monster l*/    .monster_l img {    position: absolute;    top: 0;    left: 0;    z-index: 50;    opacity: 1;    width: 70px;  }      /*been1*/    .b_1 {    position: absolute;    top: 32px;    left: 0;    z-index: 40;    opacity: 1;    width: 8px;    height: 50px;    background-color: #297f40;    border-radius: 0 0 15px 15px;    animation-name: animation_b_1;    animation-delay: 0s;    animation-duration: 2s;    animation-iteration-count: infinite;    animation-timing-function: ease-in-out;  }      /*been2*/    .b_2 {    position: absolute;    top: 32px;    left: 8px;    z-index: 40;    opacity: 1;    width: 8px;    height: 50px;    background-color: #297f40;    border-radius: 0 0 15px 15px;    animation-name: animation_b_2;    animation-delay: 0s;    animation-duration: 2s;    animation-iteration-count: infinite;    animation-timing-function: ease-in-out;  }      /*been3*/    .b_3 {    left: 16px;  }      /*been4*/    .b_4 {    left: 24px;  }    @keyframes animation_b_1 {    0% {      top: 28px;    }    50% {      top: 32px;    }    100% {      top: 28px;    }  }    @keyframes animation_b_2 {    0% {      top: 32px;    }    50% {      top: 28px;    }    100% {      top: 32px;    }  }    @keyframes movertl {    0% {      right: 0;    }    100% {      right: 200px;    }  }
<!-- l letter -->  <div class="letter_l">    <div class="monster_l">      <img src="http://googledoodle.lucasdebelder.be/images/l/monster.png">    </div>    <div class="benen_l">      <div class="b_1"></div>      <div class="b_2"></div>      <div class="b_1 b_3"></div>      <div class="b_2 b_4"></div>    </div>  </div>


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -