CSS animation:How to make the image object bounce back seamlessly? - html

Demo:
http://www.suanle.lol/move.php
In the animation demo you can see that when the egg just at the point of bouncing back, it flashes out for a second then flashed in. This makes the animation broken. So I wondered why this is happening and how I could fix it?
If you want to check the Gif:
Actually not just limited to the .gif, the problem occurs for any format of picture.
code is below:
#egg {
z-index: 2;
margin-left: 50px;
/*display: none;*/
position: absolute;
animation-duration: 6.4s;
animation-name: slide;
animation-iteration-count: infinite;
/*animation: pulse 5s infinite;*/
}
#keyframes slide {
0% {
margin-left: 10px;
/*width: 300%; */
}
49% {
-moz-transform: scaleX(1);
-o-transform: scaleX(1);
-webkit-transform: scaleX(1);
transform: scaleX(1);
filter: FlipH;
-ms-filter: "FlipH";
}
50% {
margin-left: 350px;
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
100% {
margin-left: 10px;
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
}
<img id="egg" src="http://i.stack.imgur.com/Ke7wO.gif">

Ok , This looks much better, changed 49% to 49.9% and it enhanced it a bit, the problem was this 1% of the 6.4s duration of animation is still noticeable which makes it "flashes".
by reducing this difference from 1% to 0.1% the period needed to transform from scaleX(1) to scaleX(-1) is not noticeable
jsFiddle
#container {
position: absolute;
background-color: rgb(231, 143, 128);
width: 310px;
height: 42px;
margin-left: 50px;
z-index: 1;
}
#egg {
z-index: 2;
margin-left: 50px;
/*display: none;*/
position: absolute;
animation-duration: 6.4s;
animation-name: slide;
animation-iteration-count: infinite;
/*animation: pulse 5s infinite;*/
}
#keyframes slide {
0% {
margin-left: 10px;
/*width: 300%; */
}
49.9% {
-moz-transform: scaleX(1);
-o-transform: scaleX(1);
-webkit-transform: scaleX(1);
transform: scaleX(1);
filter: FlipH;
-ms-filter: "FlipH";
}
50% {
margin-left: 350px;
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
100% {
margin-left: 10px;
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
}
<img id="egg" src="http://i.stack.imgur.com/Ke7wO.gif">

Related

css animation didnt work on ie

first i must Apology for my bad English, i made it like this below code:
CSS:
#charset "utf-8";
#media screen and (min-width: 320px) {
body {
font-family:'BebasRegular';
text-align:center;
background-color: #d0d2d0;
background-image:url(../Image/Back_pattern.png);
width: 95%;
height: 95%;
margin:auto;
}
div#main {
font-size: 3vw;
}
#content {
margin:auto;
height:100vh;
width:100vw;
}
}
#font-face {
font-family: 'BebasRegular';
src: url('../Fonts/BEBAS___-webfont.eot');
src: url('../Fonts/BEBAS___-webfont.eot?#iefix') format('embedded-opentype'),
url('../Fonts/BEBAS___-webfont.woff') format('woff'),
url('../Fonts/BEBAS___-webfont.ttf') format('truetype'),
url('../Fonts/BEBAS___-webfont.svg#BebasRegular') format('svg');
font-weight: normal;
font-style: normal;
}
#media only screen and (orientation: landscape) {
#item1_placeholder{
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 7%;
content: "";
display: block;
padding-bottom: 7%;
}
#AHCube div {
position: absolute;
width: 7vw;
height: 7vw;
border: 1px solid rgba(0,0,0,0.3);
background: rgba(255,255,255,1);
box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
text-align: center;
line-height: 120px;
}
#AHCube .Front {
-webkit-transform: translateZ(3.5vw);
transform: translateZ(3.5vw);
-moz-transform: translateZ(3.5vw);
-o-transform: translateZ(3.5vw);
}
#AHCube .Right {
-webkit-transform: rotateY(90deg) translateZ(3.5vw);
transform: rotateY(90deg) translateZ(3.5vw);
-moz-transform: rotateY(90deg) translateZ(3.5vw);
-o-transform: rotateY(90deg) translateZ(3.5vw);
}
#AHCube .Top {
-webkit-transform: rotateY(90deg) rotateX(90deg) translateZ(3.5vw);
transform: rotateY(90deg) rotateX(90deg) translateZ(3.5vw);
-moz-transform: rotateY(90deg) rotateX(90deg) translateZ(3.5vw);
-o-transform: rotateY(90deg) rotateX(90deg) translateZ(3.5vw);
}
#AHCube .Back {
-webkit-transform: rotateY(180deg) rotateZ(90deg) translateZ(3.5vw);
transform: rotateY(180deg) rotateZ(90deg) translateZ(3.5vw);
-moz-transform: rotateY(180deg) rotateZ(90deg) translateZ(3.5vw);
-o-transform: rotateY(180deg) rotateZ(90deg) translateZ(3.5vw);
}
#AHCube .Left {
-webkit-transform: rotateY(-90deg) rotateZ(90deg) translateZ(3.5vw);
transform: rotateY(-90deg) rotateZ(90deg) translateZ(3.5vw);
-moz-transform: rotateY(-90deg) rotateZ(90deg) translateZ(3.5vw);
-o-transform: rotateY(-90deg) rotateZ(90deg) translateZ(3.5vw);
}
#AHCube .Below {
-webkit-transform: rotateX(-90deg) translateZ(3.5vw);
transform: rotateX(-90deg) translateZ(3.5vw);
-moz-transform: rotateX(-90deg) translateZ(3.5vw);
-o-transform: rotateX(-90deg) translateZ(3.5vw);
background:rgba(3,76,244,1.00);
}
.AH_Ani1 {
-webkit-animation-name: spin1;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: 1;
-webkit-animation-duration: 5s;
-webkit-animation-fill-mode: forwards;
-webkit-transform-style: preserve-3d;
-webkit-transform-origin: 3.5vw 3.5vw 0;
animation-name: spin1;
animation-timing-function: ease-in-out;
animation-iteration-count: 1;
animation-duration: 5s;
animation-fill-mode: forwards;
transform-style: preserve-3d;
transform-origin: 3.5vw 3.5vw 0;
-moz-animation-name: spin1;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: 1;
-moz-animation-duration: 5s;
-moz-animation-fill-mode: forwards;
-moz-transform-style: preserve-3d;
-moz-transform-origin: 3.5vw 3.5vw 0;
-o-animation-name: spin1;
-o-animation-timing-function: ease-in-out;
-o-animation-iteration-count: 1;
-o-animation-duration: 5s;
-o-animation-fill-mode: forwards;
-o-transform-style: preserve-3d;
-o-transform-origin: 3.5vw 3.5vw 0;
}
.ICO_Hold1 {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
filter: drop-shadow(5% 5% 5% #222);
width: 80%;
height: auto;
display:block;
}
#-webkit-keyframes spin1 {
from,to { -webkit-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
0% { -webkit-transform:scale(0,0); }
10% { -webkit-transform:scale(1,1); }
28% { -webkit-transform: rotateY(-90deg); }
46% { -webkit-transform: rotateY(-90deg) rotateZ(90deg); }
64% { -webkit-transform: rotateY(-180deg) rotateZ(90deg); }
82% { -webkit-transform: rotateY(90deg) rotateX(90deg); }
100% { -webkit-transform: rotateX(90deg); }
}
#keyframes spin1 {
from,to { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
0% { transform:scale(0,0); }
10% { transform:scale(1,1); }
28% { transform: rotateY(-90deg); }
46% { transform: rotateY(-90deg) rotateZ(90deg); }
64% { transform: rotateY(-180deg) rotateZ(90deg); }
82% { transform: rotateY(90deg) rotateX(90deg); }
100% { transform: rotateX(90deg); }
}
#-moz-keyframes spin1 {
from,to { -moz-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
0% { -moz-transform:scale(0,0); }
10% { -moz-transform:scale(1,1); }
28% { -moz-transform: rotateY(-90deg); }
46% { -moz-transform: rotateY(-90deg) rotateZ(90deg); }
64% { -moz-transform: rotateY(-180deg) rotateZ(90deg); }
82% { -moz-transform: rotateY(90deg) rotateX(90deg); }
100% { -moz-transform: rotateX(90deg); }
}
#-o-keyframes spin1 {
from,to { -o-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
0% { -o-transform:scale(0,0); }
10% { -o-transform:scale(1,1); }
28% { -o-transform: rotateY(-90deg); }
46% { -o-transform: rotateY(-90deg) rotateZ(90deg); }
64% { -o-transform: rotateY(-180deg) rotateZ(90deg); }
82% { -o-transform: rotateY(90deg) rotateX(90deg); }
100% { -o-transform: rotateX(90deg); }
}
}
#media only screen and (orientation: portrait) {
#item1_placeholder{
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 0%;
content: "";
display: block;
padding-bottom: 0%;
}
#AHCube div {
position: absolute;
width: 0vw;
height: 0vw;
border: 1px solid rgba(0,0,0,0.3);
background: rgba(255,255,255,1);
box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
text-align: center;
line-height: 120px;
}
.ICO_Hold1 {
position: fixed;
top: 0%;
left: 0%;
transform: translate(-50%, -50%);
-webkit-filter: drop-shadow(50% 50% 50% #222 );
filter: drop-shadow(5% 5% 5% #222);
width: 0%;
height: auto;
display:none;
}
}
HTML:
<div id="item1_placeholder" >
<div id="AHCube" class="AH_Ani1">
<div class="Front"><img class="ICO_Hold1" src="Image/1-1.png" /></div>
<div class="Right"><img class="ICO_Hold1" src="Image/1-2.png" /></div>
<div class="Top"><img class="ICO_Hold1" src="Image/1-3.png" /></div>
<div class="Back"><img class="ICO_Hold1" src="Image/1-4.png" /></div>
<div class="Left"><img class="ICO_Hold1" src="Image/1-5.png" /></div>
<div class="Below"><img class="ICO_Hold1" src="Image/1-6.png" /></div>
</div>
</div>
it work fine in chrome and Mozilla but it is not fine IE or Microsoft Edge, and i didn't check it in portable device
another problem is in portrait view , the cube's image background didn't hide in portrait view.
can any one check this and hint me to correct/fix this please?

How to make ul span margin correctly in before and same line?

Here is my CSS and HTML code:
.route-list {
padding: 0;
margin: 0;
color: #fff;
text-align: center;
padding: 6px 9px 7px;
background: #0097d6;
}
.plane-icon-wrapper {
display: inline-block;
width: 100px;
margin: 0 12px 0 10px;
position: relative;
}
.plane-icon {
-moz-transform: rotate(225deg);
-ms-transform: rotate(225deg);
-o-transform: rotate(225deg);
-webkit-transform: rotate(225deg);
transform: rotate(225deg);
-moz-animation: plane 5s infinite;
-o-animation: plane 5s infinite;
-webkit-animation: plane 5s infinite;
animation: plane 5s infinite;
position: absolute;
top: -12px;
margin-right: -10px;
padding: 0;
}
#-webkit-keyframes plane {
0% {
right: 0px;
opacity: 0;
}
25% {
right: 100%;
opacity: 1;
-moz-transform: rotate(225deg);
-ms-transform: rotate(225deg);
-o-transform: rotate(225deg);
-webkit-transform: rotate(225deg);
transform: rotate(225deg);
}
50% {
right: 100%;
opacity: 0;
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
75% {
right: 0;
opacity: 1;
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
100% {
right: 0;
opacity: 0;
-moz-transform: rotate(225deg);
-ms-transform: rotate(225deg);
-o-transform: rotate(225deg);
-webkit-transform: rotate(225deg);
transform: rotate(225deg);
}
}
#keyframes plane {
0% {
right: 0px;
opacity: 0;
}
25% {
right: 100%;
opacity: 1;
-moz-transform: rotate(225deg);
-ms-transform: rotate(225deg);
-o-transform: rotate(225deg);
-webkit-transform: rotate(225deg);
transform: rotate(225deg);
}
50% {
right: 100%;
opacity: 0;
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
75% {
right: 0;
opacity: 1;
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
100% {
right: 0;
opacity: 0;
-moz-transform: rotate(225deg);
-ms-transform: rotate(225deg);
-o-transform: rotate(225deg);
-webkit-transform: rotate(225deg);
transform: rotate(225deg);
}
}
.route-list span + span:before {
font-size: 16px;
line-height: 20px;
display: inline-block;
vertical-align: top;
content: "\f072";
font-family: "FontAwesome";
-moz-transform: rotate(225deg);
-ms-transform: rotate(225deg);
-o-transform: rotate(225deg);
-webkit-transform: rotate(225deg);
transform: rotate(225deg);
-moz-animation: plane 5s infinite;
-o-animation: plane 5s infinite;
-webkit-animation: plane 5s infinite;
animation: plane 5s infinite;
}
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" media="screen" />
<ul class="list-inline route-list same-height-right" style="height: 33px;">
Manila
<span class="plane-icon-wrapper"><i class="fa fa-plane plane-icon"></i></span>
<span>Kuala Lumpur</span>
<span>Singapore</span>
<span>Bali</span>
</ul>
I tried to solve margin between before, but it seems there's something that I can't fix it correctly.
I want to make it in same line, and auto width between cities and plane icon animated.
How to make in same line and auto width between cities? ((SAME LINE))
I'm also using bootstrap css, how to solve it even in mobile view small screen sizes?
Here is what I want :
1: single line 2: responsive 3: auto width between cities 4: fixed
width in even in narrow size, texts will be resized based on
width. so how to make it?
Thanks in advance

Image doesn't flip with css

When I apply the class prev it doesn't flip the image.
I'm kinda stuck on why it does not work, I tried it with Chrome, Firefox and IE and none of them work.
.pbtn {
background-image: url('../../images/linkpil.png');
background-repeat: no-repeat;
display: inline-block;
float: left;
background-position: center center;
&.first {
display: none;
}
&.next {
background-color: #C9E2E5;
}
.prev {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
a {
overflow: hidden;
text-indent: -9999px; //hide text
height: 15px;
width: 15px;
display: inline-block;
}
}
<div class="pbtn">
</div>
From your less code, it looks like your html has to be this.
<div class="pbtn next">
</div>
<div class="pbtn prev">
</div>
and replace
&.next {
background-color: #C9E2E5;
}
.prev {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
With:
&.next {
background-color: #C9E2E5;
}
&.prev {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
Your css will do nothing because there is nothing in a to transform.
The background image is on the parent, and there is no content or image in the a. For all we know the transform is working fine but we can't see anything.

css animation doesn't work in firefox

My code doesnt work in Firefox and I dont know why. Any advices? It works fine in Chrome, IE and Opera. I tried almost all prefixes combinations but still it wont work. Is it possible that something is wrong with my PC or Firefox browser?
.span-accent {
color: rgb(60, 185, 120);
-webkit-animation: breath 2s infinite;
-moz-animation: breath 2s infinite;
animation: breath 2s infinite;
}
#-webkit-keyframes breath {
0% {
-webkit-transform: scale(1);
transform: scale(1);
}
25% {
-webkit-transform: scale(1.2);
transform: scale(1.2);
}
50% {
-webkit-transform: scale(1);
transform: scale(1);
}
75% {
-webkit-transform: scale(1.2);
transform: scale(1.2);
}
100% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
#-moz-keyframes breath {
0% {
-moz-transform: scale(1);
transform: scale(1);
}
25% {
-moz-transform: scale(1.2);
transform: scale(1.2);
}
50% {
-moz-transform: scale(1);
transform: scale(1);
}
75% {
-moz-transform: scale(1.2);
transform: scale(1.2);
}
100% {
-moz-transform: scale(1);
transform: scale(1);
}
}
#keyframes breath {
0% {
-webkit-transform: scale(1);
transform: scale(1);
}
25% {
-webkit-transform: scale(1.2);
transform: scale(1.2);
}
50% {
-webkit-transform: scale(1);
transform: scale(1);
}
75% {
-webkit-transform: scale(1.2);
transform: scale(1.2);
}
100% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
<h1>LAKA</h1>
<h2>architecture that <span class="span-accent">reacts.</span></h2>
Ok guys, I found it.
Problem is in <span> element. For some reason Firefox doesnt animate inline elements.
So what I did is change a <span> atribute to display: inline-block.
It just wont work strictly for any inline element.

CSS Animation Not Working in Firefox

This has really been killing me, not sure what the issue is because I have all the -moz- options.
Animation works fine in webkit but not Firefox.
Here's my CSS:
#-webkit-keyframes flip {
from {
-moz-transform: scaleX(0);
-o-transform: scaleX(0);
-webkit-transform: scaleX(0);
transform: scaleX(0);
}
to {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
}
#keyframes flip {
0% {
-moz-transform: scaleX(0);
-o-transform: scaleX(0);
-webkit-transform: scaleX(0);
transform: scaleX(0);
}
100% {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
}
.jig-loaded img {
-webkit-animation: flip 1.0s !important;
animation: flip 1.0s !important;
-moz-animation: flip 10.0s !important;
}
Thanks so much!
#user3154772: As per my understanding. I have resolve below code.Please check and try it.
#-webkit-keyframes flip {
from {
-moz-transform: scaleX(0);
-o-transform: scaleX(0);
-webkit-transform: scaleX(0);
transform: scaleX(0);
}
to {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
}
#-moz-keyframes flip {
from {
-moz-transform: scaleX(0);
-o-transform: scaleX(0);
-webkit-transform: scaleX(0);
transform: scaleX(0);
}
to {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
}
#keyframes flip {
0% {
-moz-transform: scaleX(0);
-o-transform: scaleX(0);
-webkit-transform: scaleX(0);
transform: scaleX(0);
}
100% {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
}
.jig-loaded img {
-webkit-animation: flip 1.0s !important;
animation: flip 1.0s !important;
-moz-animation: flip 10.0s !important;
}