I am trying to create a CSS animation where I have a frame with a background image, then I have a crane that needs to slide into the frame from the bottom, so for that I would need overflow:hidden; so that you can't see the crane sliding into the frame. But then after it slides up into the frame, I need the arm of the crane to rotate down and extend out of the frame. However, since I have overflow:hidden; for the first part of the animation, I'm not sure how to make the second part work. Here's what I have so far:
.frame {
width:600px;
height:300px;
background:url('http://placehold.it/600x300');
overflow:hidden;
}
.crane-container {
position:relative;
}
.crane {
position:absolute;
bottom:-500px;
right:100px;
height:200px;
width:50px;
animation:slideUp 3s ease-in-out;
animation-fill-mode: forwards;
}
.arm {
height:200px;
width:50px;
background:#000;
animation:rotateArm 4s ease-in-out;
animation-fill-mode: forwards;
animation-delay: 3s;
transform-origin:bottom left;
}
#keyframes slideUp {
0% {
bottom: -500px;
}
100% {
bottom: -300px;
}
}
#keyframes rotateArm {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(-120deg);
}
}
<div class="frame">
<div class="crane-container">
<div class="crane">
<div class="arm"></div>
</div>
</div>
</div>
Think differently and instead of animating position you can animate the height and you don't need the overflow.
Have a look:
.frame {
width: 600px;
height: 300px;
background: url('http://placehold.it/600x300');
overflow: visible;
}
.crane-container {
position: relative;
height:100%;
}
.crane {
position: absolute;
bottom: 0;
right: 100px;
height: 0;
width: 50px;
animation: slideUp 3s ease-in-out;
animation-fill-mode: forwards;
}
.arm {
height: 100%;
width: 100%;
background: #000;
animation: rotateArm 4s ease-in-out;
animation-fill-mode: forwards;
animation-delay: 3s;
transform-origin: bottom left;
}
#keyframes slideUp {
0% {
height: 0;
}
100% {
height: 200px;
}
}
#keyframes rotateArm {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(-120deg);
}
}
#keyframes over {
0%,100% {
overflow:visible;
}
}
<div class="frame">
<div class="crane-container">
<div class="crane">
<div class="arm"></div>
</div>
</div>
</div>
I am trying to show or hide the title of sidepanel while collapsing it to width:50%
I am using display: block to display:none;
Somehow I am not able to use the animation on it
Here is the code I am using
.fade-in {
animation: fade-in 0.5s ease-in-out both;
}
.fade-out {
animation: fade-out 0.6s ease-in-out both;
}
#keyframes fade-in {
0% {
opacity: 1;
display: block;
}
100% {
opacity: 0;
display: none;
}
}
#keyframes fade-out {
0% {
opacity: 0;
display: none;
}
100% {
opacity: 1;
display: block;
}
}
Any idea why display is not working
.fade-in {
animation: fade-in 0.5s ease-in-out both;
background:black;
height:200px;
width:200px;
margin-bottom:10px;
}
.fade-out {
animation: fade-out 0.6s ease-in-out both;
background:red;
height:200px;
width:200px;
}
#keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes fade-out {
0% {
opacity: 1;
display: none;
}
100% {
opacity: 0;
}
}
<div class="fade-in"></div>
<div class="fade-out"></div>
So i'm trying to use this CSS slider and it works perfect in IE and firefox, but not for chrome. When the first image loads it looks normal but when the second image has filled the box i get a white box in the bottom of the page. Image
I found this code at Pure CCS3 Cycling Slideshow but this problem occurred when i tried to customize it for my school project.
HTML:
<div id="slider">
<div id="mask">
<ul>
<li id="first" class="firstanimation">
<img src="images/turtleSlider/tur1.jpg" alt="Turtle"/>
<div class="tooltip"> <h1>Turtle</h1> </div>
</li>
<li id="second" class="secondanimation">
<img src="images/turtleSlider/tur2.jpg" alt="Turtle"/>
<div class="tooltip"> <h1>My Dad Tomas & A Turtle</h1> </div>
</li>
<li id="third" class="thirdanimation">
<img src="images/turtleSlider/tur3.jpg" alt="Turtle"/>
<div class="tooltip"> <h1>Turtle</h1> </div>
</li>
<li id="fourth" class="fourthanimation">
<img src="images/turtleSlider/tur4.jpg" alt="Turtle"/>
<div class="tooltip"> <h1>Me & A Turtle</h1> </div>
</li>
<li id="fifth" class="fifthanimation">
<img src="images/turtleSlider/tur5.jpg" alt="Turtle"/>
<div class="tooltip"> <h1>Turtle</h1> </div>
</li>
</ul>
</div>
<div class="progress-bar"></div>
</div>
</div>
CSS:
html{
background: url(../images/background.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
body{
font-family:"Open Sans", serif;
margin: 30px 15% 20px 15%;
min-width: 1010px;
}
#slider {
border: 5px solid #eaeaea;
box-shadow: 1px 1px 5px rgba(0,0,0,0.7);
height: 500px;
width: 667px;
overflow: visible;
position: relative;
float: left;
}
#mask {
overflow: hidden;
height: 500px;
}
#slider ul {
margin: 0;
padding: 0;
position: relative;
}
#slider li {
width: 667px; /* Width Image */
height: 500px; /* Height Image */
position: absolute;
top: -505px; /* Original Position - Outside of the Slider */
list-style: none;
}
#slider li.firstanimation {
-webkit-animation: cycle 25s linear infinite;
-moz-animation: cycle 25s linear infinite;
animation: cycle 25s linear infinite;
}
#slider li.secondanimation {
-webkit-animation: cycletwo 25s linear infinite;
-moz-animation: cycletwo 25s linear infinite;
animation: cycletwo 25s linear infinite;
}
#slider li.thirdanimation {
-webkit-animation: cyclethree 25s linear infinite;
-moz-animation: cyclethree 25s linear infinite;
animation: cyclethree 25s linear infinite;
}
#slider li.fourthanimation {
-webkit-animation: cyclefour 25s linear infinite;
-moz-animation: cyclefour 25s linear infinite;
animation: cyclefour 25s linear infinite;
}
#slider li.fifthanimation {
-webkit-animation: cyclefive 25s linear infinite;
-moz-animation: cyclefive 25s linear infinite;
animation: cyclefive 25s linear infinite;
}
#-webkit-keyframes cycle {
0% { top:0px; }
4% { top:0px; }
16% { top:0px; opacity:1; z-index:0; }
20% { top:505px; opacity:0; z-index:0; }
21% { top:-505px; opacity:0; z-index:-1; }
50% { top:-505px; opacity:0; z-index:-1; }
92% { top:-505px; opacity:0; z-index:0; }
96% { top:-505px; opacity:0; }
100%{ top:0px; opacity:1; }
}
#-webkit-keyframes cycletwo {
0% { top:-505px; opacity:0; }
16% { top:-505px; opacity:0; }
20% { top:0px; opacity:1; }
24% { top:0px; opacity:1; }
36% { top:0px; opacity:1; z-index:0; }
40% { top:505px; opacity:0; z-index:0; }
41% { top:-505px; opacity:0; z-index:-1; }
100%{ top:-505px; opacity:0; z-index:-1; }
}
#-webkit-keyframes cyclethree {
0% { top:-505px; opacity:0; }
36% { top:-505px; opacity:0; }
40% { top:0px; opacity:1; }
44% { top:0px; opacity:1; }
56% { top:0px; opacity:1; z-index:0; }
60% { top:505px; opacity:0; z-index:0; }
61% { top:-505px; opacity:0; z-index:-1; }
100%{ top:-505px; opacity:0; z-index:-1; }
}
#-webkit-keyframes cyclefour {
0% { top:-505px; opacity:0; }
56% { top:-505px; opacity:0; }
60% { top:0px; opacity:1; }
64% { top:0px; opacity:1; }
76% { top:0px; opacity:1; z-index:0; }
80% { top:505px; opacity:0; z-index:0; }
81% { top:-505px; opacity:0; z-index:-1; }
100%{ top:-505px; opacity:0; z-index:-1; }
}
#-webkit-keyframes cyclefive {
0% { top:-505px; opacity:0; }
76% { top:-505px; opacity:0; }
80% { top:0px; opacity:1; }
84% { top:0px; opacity:1; }
96% { top:0px; opacity:1; z-index:0; }
100%{ top:505px; opacity:0; z-index:0; }
}
#-moz-keyframes cycle {
0% { top:0px; }
4% { top:0px; }
16% { top:0px; opacity:1; z-index:0; }
20% { top:505px; opacity:0; z-index:0; }
21% { top:-505px; opacity:0; z-index:-1; }
92% { top:-505px; opacity:0; z-index:0; }
96% { top:-505px; opacity:0; }
100%{ top:0px; opacity:1; }
}
#-moz-keyframes cycletwo {
0% { top:-505px; opacity:0; }
16% { top:-505px; opacity:0; }
20% { top:0px; opacity:1; }
24% { top:0px; opacity:1; }
36% { top:0px; opacity:1; z-index:0; }
40% { top:505px; opacity:0; z-index:0; }
41% { top:-505px; opacity:0; z-index:-1; }
100%{ top:-505px; opacity:0; z-index:-1; }
}
#-moz-keyframes cyclethree {
0% { top:-505px; opacity:0; }
36% { top:-505px; opacity:0; }
40% { top:0px; opacity:1; }
44% { top:0px; opacity:1; }
56% { top:0px; opacity:1; }
60% { top:505px; opacity:0; z-index:0; }
61% { top:-505px; opacity:0; z-index:-1; }
100%{ top:-505px; opacity:0; z-index:-1; }
}
#-moz-keyframes cyclefour {
0% { top:-505px; opacity:0; }
56% { top:-505px; opacity:0; }
60% { top:0px; opacity:1; }
64% { top:0px; opacity:1; }
76% { top:0px; opacity:1; z-index:0; }
80% { top:505px; opacity:0; z-index:0; }
81% { top:-505px; opacity:0; z-index:-1; }
100%{ top:-505px; opacity:0; z-index:-1; }
}
#-moz-keyframes cyclefive {
0% { top:-505px; opacity:0; }
76% { top:-505px; opacity:0; }
80% { top:0px; opacity:1; }
84% { top:0px; opacity:1; }
96% { top:0px; opacity:1; z-index:0; }
100%{ top:505px; opacity:0; z-index:0; }
}
#keyframes cycle {
0% { top: 0px; } /* When you start the slide, the first image is already visible */
4% { top: 0px; } /* Original Position */
16% { top: 0px; opacity:1; z-index:0; } /* From 4% to 16 % = for 3 seconds the image is visible */
20% { top: 505px; opacity: 0; z-index: 0; } /* From 16% to 20% = for 1 second exit image */
21% { top: -505px; opacity: 0; z-index: -1; } /* Return to Original Position */
92% { top: -505px; opacity: 0; z-index: 0; }
96% { top: -505px; opacity: 0; } /* From 96% to 100% = for 1 second enter image*/
100%{ top: 0px; opacity: 1; }
}
#keyframes cycletwo {
0% { top: -505px; opacity: 0; } /* Original Position */
16% { top: -505px; opacity: 0; }/* Starts moving after 16% to this position */
20% { top: 0px; opacity: 1; }
24% { top: 0px; opacity: 1; } /* From 20% to 24% = for 1 second enter image*/
36% { top: 0px; opacity: 1; z-index: 0; } /* From 24% to 36 % = for 3 seconds the image is visible */
40% { top: 505px; opacity: 0; z-index: 0; } /* From 36% to 40% = for 1 second exit image */
41% { top: -505px; opacity: 0; z-index: -1; } /* Return to Original Position */
100%{ top: -505px; opacity: 0; z-index: -1; }
}
#keyframes cyclethree {
0% { top: -505px; opacity: 0; }
36% { top: -505px; opacity: 0; }
40% { top: 0px; opacity: 1; }
44% { top: 0px; opacity: 1; }
56% { top: 0px; opacity: 1; }
60% { top: 505px; opacity: 0; z-index: 0; }
61% { top: -505px; opacity: 0; z-index: -1; }
100%{ top: -505px; opacity: 0; z-index: -1; }
}
#keyframes cyclefour {
0% { top: -505px; opacity: 0; }
56% { top: -505px; opacity: 0; }
60% { top: 0px; opacity: 1; }
64% { top: 0px; opacity: 1; }
76% { top: 0px; opacity: 1; z-index: 0; }
80% { top: 505px; opacity: 0; z-index: 0; }
81% { top: -505px; opacity: 0; z-index: -1; }
100%{ top: -505px; opacity: 0; z-index: -1; }
}
#keyframes cyclefive {
0% { top: -505px; opacity: 0; }
76% { top: -505px; opacity: 0; }
80% { top: 0px; opacity: 1; }
84% { top: 0px; opacity: 1; }
96% { top: 0px; opacity: 1; z-index: 0; }
100%{ top: 505px; opacity: 0; z-index: 0; }
}
.progress-bar {
position: relative;
top: -5px;
width: 750px;
height: 5px;
background: #000;
-webkit-animation: fullexpand 25s ease-out infinite;
-moz-animation: fullexpand 25s ease-out infinite;
animation: fullexpand 25s ease-out infinite;
}
#-webkit-keyframes fullexpand {
0%, 20%, 40%, 60%, 80%, 100% { width: 0%; opacity: 0; }
4%, 24%, 44%, 64%, 84% { width: 0%; opacity: 0.3; }
16%, 36%, 56%, 76%, 96% { width: 100%; opacity: 0.7; }
17%, 37%, 57%, 77%, 97% { width: 100%; opacity: 0.3; }
18%, 38%, 58%, 78%, 98% { width: 100%; opacity: 0; }
}
#-moz-keyframes fullexpand {
0%, 20%, 40%, 60%, 80%, 100% { width: 0%; opacity: 0; }
4%, 24%, 44%, 64%, 84% { width: 0%; opacity: 0.3; }
16%, 36%, 56%, 76%, 96% { width: 100%; opacity: 0.7; }
17%, 37%, 57%, 77%, 97% { width: 100%; opacity: 0.3; }
18%, 38%, 58%, 78%, 98% { width: 100%; opacity: 0; }
}
#keyframes fullexpand {
/* In these keyframes, the progress-bar is stationary */
0%, 20%, 40%, 60%, 80%, 100% { width: 0%; opacity: 0; }
/* In these keyframes, the progress-bar starts to come alive */
4%, 24%, 44%, 64%, 84% { width: 0%; opacity: 0.3; }
/* In these keyframes, the progress-bar moves forward for 3 seconds */
16%, 36%, 56%, 76%, 96% { width: 100%; opacity: 0.7; }
/* In these keyframes, the progress-bar has finished his path */
17%, 37%, 57%, 77%, 97% { width: 100%; opacity: 0.3; }
/* In these keyframes, the progress-bar will disappear and then resume the cycle */
18%, 38%, 58%, 78%, 98% { width: 100%; opacity: 0; }
}
#slider:hover .progress-bar {
-webkit-animation-play-state: paused;
-moz-animation-play-state: paused;
animation-play-state: paused;
}
#slider .tooltip {
background: rgba(0,0,0,0.7);
width: 300px;
height: 60px;
position: relative;
bottom: 75px;
left: -320px;
transition: all 0.3s ease-in-out;
}
#slider .tooltip h1 {
color: #fff;
font-size: 24px;
font-weight: 300;
line-height: 60px;
padding: 0 0 0 10px;
text-align: Right;
margin-right: 10px;
}
#slider li#first:hover .tooltip,
#slider li#second:hover .tooltip,
#slider li#third:hover .tooltip,
#slider li#fourth:hover .tooltip,
#slider li#fifth:hover .tooltip {
left: 0px;
}
Add following code to your CSS file:
html,
body{
height: 100%;
}
This white rectangle is an empty space on the page because document does not cover whole view-port.
I figured it out. I added some credits at the bottom as a <footer> and now it doesn't show up anymore. Thanks for the help though!
I can preview in firefox only.
Please help me.
Link to Fiddle
HTML
<div id="yamaha">
<div class="bg1"></div>
<div class="pic1"></div>
</div>
CSS
body { margin:auto; }
/*yamaha */
#yamaha { width:990px; height:450px; position:relative; opacity:0; -moz-animation: yamaha 40s linear; }
#yamaha div { position:absolute; background: 0 0 no-repeat; }
#yamaha .bg1 { width:990px; height:450px; background:url("../images/bg1.jpg");-webkit-animation: bg1 2s linear;-moz-animation: bg1 2s linear;}
#yamaha .pic1 {
width:990px;
height:142px;
background:url("../images/pic1.png");
z-index:2;
top:308px;
opacity:0;
-moz-animation: pic1 100s linear 2s;
}
/* Safari and Chrome */
#-webkit-keyframes yamaha {
0% { opacity:0; }
1% { opacity:1; }
50% { opacity:1; }
51% { opacity:0; }
100%; { opacity:0; }
}
#-webkit-keyframes bg1 {
0% { opacity:0; }
100%; { opacity:1; }
}
#-webkit-keyframes pic1 {
0% { -webkit-transform:scale(0); opacity:0; }
1% { -webkit-transform:scale(1); opacity:1; }
100%; { -webkit-transform:scale(1); opacity:1; }
}
/* Firefox */
#-moz-keyframes yamaha {
0% { opacity:0; }
1% { opacity:1; }
50% { opacity:1; }
51% { opacity:0; }
100%; { opacity:0; }
}
#-moz-keyframes bg1 {
0% { opacity:0; }
100%; { opacity:1; }
}
#-moz-keyframes pic1 {
0% { -moz-transform:scale(0); opacity:0; }
1% { -moz-transform:scale(1); opacity:1; }
100%; { -moz-transform:scale(1); opacity:1; }
}
Thank a lot.
#yamaha {
width:990px;
height:450px;
position:relative;
opacity:0;
-moz-animation: yamaha 40s linear;
-webkit-animation: yamaha 40s linear; /* Add this */
animation: yamaha 40s linear; /* Add this */
}
#yamaha .bg1 {
width:990px;
height:450px;
background:url("../images/bg1.jpg");
-webkit-animation: bg1 2s linear;
-moz-animation: bg1 2s linear;
animation: bg1 2s linear; /* Add this */
}
/* and add this */
#keyframes yamaha {
0% { opacity:0; }
1% { opacity:1; }
50% { opacity:1; }
51% { opacity:0; }
100%; { opacity:0; }
}
#keyframes bg1 {
0% { opacity:0; }
100%; { opacity:1; }
}
#keyframes pic1 {
0% { -webkit-transform:scale(0); opacity:0; }
1% { -webkit-transform:scale(1); opacity:1; }
100%; { -webkit-transform:scale(1); opacity:1; }
}
I hope this helps
I have a cloud which moves from just inside the screen to off the screen with a CSS3 animation. When the cloud is off the screen, the screen scrolls horizontally which is not ideal. I can hide the scrollbar with CSS, but I'd like to prevent the scroll.
#c-2 {
background:url(clouds.png) no-repeat;
width:161px;
height:94px;
position:absolute;
top:40%;
right:0%;
animation:CloudB 20s 1s infinite alternate ease-in-out;
-moz-animation:CloudB 20s 1s infinite alternate ease-in-out;
-webkit-animation:CloudB 20s 1s infinite alternate ease-in-out;
-o-animation:CloudB 20s 1s infinite alternate ease-in-out;
}
#keyframes CloudB {
0% { right:0%; top:40%; }
100% { right:-10%; top:40%; }
}
#-moz-keyframes CloudB {
0% { right:0%; top:40%; }
100% { right:-10%; top:40%; }
}
#-webkit-keyframes CloudB {
0% { right:0%; top:40%; }
100% { right:-10%; top:40%; }
}
#-o-keyframes CloudB {
0% { right:0%; top:40%; }
100% { right:-10%; top:40%; }
}
http://energycenter.herokuapp.com/
Try this - http://jsfiddle.net/m3af2/
body {
background-color: #99CCE8;
margin: 0;
line-height: 1;
text-rendering: optimizeLegibility;
overflow-x: hidden;
position: relative;
}