How to show transitionDuration in css animation? - css

Fiddle A:
I have a gallery of images (there are 4 right now) as shown here in this JSFiddle (lets call as Fiddle A)
in which every single image fades out after 3s second and there is transition delay of 800ms.
I have used JS to make the animation work. In JS, I have used the following constants in my JS.
transitionDuration => is the delay (white flash which we see) which happens on moving from one image to another.
transitionDelay => is the presenation time of an image (meaning the time span for which the image stay at their place).
totalDelay => is only for one image.
Fiddle B:
I also have another gallery of images as shown in this JSFiddle (let's call as Fiddle B) in which a CSS animation is going on.
Presentation time of one image in the fiddle is 3 seconds, and then it moves to another images.
Problem Statement:
I am wondering what changes I need to make in Fiddle B so that it looks like Fiddle A. In Fiddle B there is no transitionDuration. Is there a way we can add a transitionDuration (white flash which we can
see on moving from one image to another)?
In Fiddle B, I have used the following CSS:
a:nth-of-type(4), .featured-block a:nth-of-type(5), .featured-block a:nth-of-type(6) {
position: absolute;
animation: 9s infinite ease-in-out cf4FadeInOut;
opacity: 0;
z-index:1;
}

Adjusting opacity in keyframes to achieve transition duration works, which you have implemented.
Remove opacity: 1 and opacity: 0 so that it becomes
.featured-block a { display: inline-block; }
a:nth-of-type(4), .featured-block a:nth-of-type(5), .featured-block a:nth-of-type(6) {
position: absolute;
animation: 3s infinite ease-in-out cf4FadeInOut;
z-index:1;
}

Related

How to keep zoom effect WHILE transitioning between slides?

Bit of background: ArtStation's pro subscription gives 3D Artists their own website and allows manual customization of the default themes by injecting CSS rules.
I've (successfully) redesigned my website with CSS in 2 days but I have a problem on the homepage.
Please see the homepage at https://viggopaulman.artstation.com.
It has an image slider with an opacity transition between images. The ArtStation menu settings give me an option to set switching time of images: Screenshot 1. Current switch time is set to 3 seconds from this menu.
I have added a zoom-out keyframe animation effect to these slides:
/* Sliders Transition and Zoom Override */
.slide {
transition: opacity 5s;
}
.showing {
animation-fill-mode: forwards;
animation: slide 3s linear 1;
}
#keyframes slide {
0% {
transform: scale(1.125,1.125);
}
100% {
transform: scale(1,1);
}
My problem is the slides zoom out, stop and wait for the next one to transition in. (There is a very short "snap" at the last frames too if you look carefully.) I'd like to make the transition to the next image start before the zoom reaches 100%. Or to force the image to keep zooming in while the next image transitions in and replaces it. I'm basically trying to achieve an optical effect where the slides are in a constant cinematic zoom-out motion without abrupt stops or breaks in the flow.
From what I understand I have to tweak the 3 second menu switch, the animation: slide 3s and the transition: opacity 5s?
Is there a way to achieve this? Thank you.

Issue with delaying CSS

I am trying to delay a CSS transition, but it seems not to be working. Here is what I want to happen:
Start the video
Move the mouse pointer out of the video
The control bar shrinks, but the play-progress gets larger.
Move mouse pointer back in video, the control bar returns to normal.
As you can see in the CodePen pen, the play-progress bar gets larger before I want it to: http://codepen.io/mboles/pen/mJeJOO
Here is the CSS I am currently using:
#myPlayerID.vjs-has-started.vjs-user-inactive .vjs-progress-control {
-webkit-transform: translateY(-25px);
}
#myPlayerID.vjs-has-started.vjs-user-inactive .vjs-play-progress {
-transition-delay: height 3s;
height: 10px;
}
I have tried to change the order of the transition delay and height, but that did not solve the issue.
Many thanks-
Matt
It turns out with transition-delay you cannot put the property with the delay, it must be explicitly stated using transition-property. So the solution is:
#myPlayerID.vjs-has-started.vjs-user-inactive .vjs-play-progress {
height: 10px;
transition-property: height;
-transition-delay: 3s;
-webkit-transition-delay: 3s;
}

Stop Keyframes animation from sliding CSS3

I am using this demo http://cssdeck.com/labs/css-image-sprite-animations-with-steps-function to create a CSS3 animation. However, my image is of a different size so I have:
<div id="boules"></div>
Then the CSS:
#keyframes boules{
from { background-position: 0px; }
to { background-position: -1067px; }
}
#boules {
background: url(../images/boules.png) 0 0 no-repeat;
width: 133px;
height: 108px;
animation: boules 2s steps(10, end) infinite;
}
I want to reproduce the same effect as the example link above but for some reason in my version the frames slide across instead of giving the animation effect of a still image which morphs into a different shape.
I have tried changing the steps, the seconds and positioning of the background but I still get this slide effect instead of an animation. Is this is calculation issue?
Thanks
Your numbers aren't correct
If you say that you have 10 steps...
animation: boules 2s steps(10, end) infinite;
then the offset ...
to { background-position: -1067px; }
must be a number divisible by 10. But 1067 / 10 = 106.7px means your sprites would be a fractional dimension, and this is not possible.
Review what your sprite dimensions are, and check your math.
Yes, it works Vals. Thanks for your help. As it turns out number of sprites is the same as the keyframe width but I get your point. Cheers!

Css3 Animation: Moving Images Top to Bottom

Asked a similar question to this yesterday, where Zeaklous helped me out with a good answer that worked for animating water moving seamlessly left to right.
so i tried to apply the same thing to a image moving top to bottom seamlessly, thought using the same method would work but i feel like im missing something.
the html is:
<div id="waterfall"></div>
the css is:
#waterfall {
background: url(img/waterfall.png);
background-repeat: no-repeat;
width: 100%;
height: 1200px;
position: absolute;
top: 1150px;
right: 870px;
z-index: 5;
-webkit-transition: flow 3s ease-out;
-moz-transition: flow 3s ease-out;
-o-transition: flow 3s ease-out;
transition: flow 3s ease-out;
animation: flow 2000s linear infinite;
}
#keyframes flow {
100% {background-position: 0 0;}
0% {background-position: 0 100000%;}
}
had some problems when i made the width a set 45px, cant get any animations to work. so i set it to 100% but then it just disappears and i cant find it again.
if i change the animation to horizontal, it works but only with width:100%, the moment i try make it vertical movement is wont work.
what am i missing here that is different for vertical animations?
any help is greatly appreciated.
I believe much of the issue you're having has to do with background-repeat: no-repeat;. The way the animation is set up, it uses repeats to create the flow. When you have no-repeat on, it discontinues the flow due (because it relies on the image repeating). Here is a demo of your code with simply this line taken out and the % in flow fixed (scroll down to see the animation due to your absolute positioning). You can see what it does now, I'm not sure how you want it to look in the end.
There should be no issue changing it from horizontal animation to vertical animation, as seen by this new demo showing both effects separate. All I did was switch the x and y values in the after animation: http://cssdeck.com/labs/mjsrldib If you put background-repeat: no-repeat; back in you can see the problem it creates
EDIT your question prompted me to try and make something that fell like a waterfall but still moved sideways like your water element. Here is what I came up with in the short time I worked on it. It could prove useful somehow

Is it possible to drop down/left/right/up images using css

I'm trying to create images that will drop out in any direction when hovered over, using just HTML and CSS.
What it's meant to look like:
not hovered over: a section of the image is displayed
hover: the remaining section of the image slides out (in a CSS specified direction)
What I've tried doing:
a <div> to hold a background-image that cuts off at a certain height and slides out using css animations on hover
<html>
<body>
<style>
#-webkit-keyframes resize {
0% {
}
100% {
height: 446px;
}
}
#pic {
height: 85px;
width: 500px;
background-image: url(http://images5.fanpop.com/image/photos/31400000/Cow-cows-31450227-500-446.jpg);
}
#pic:hover {
-webkit-animation-name: resize;
-webkit-animation-duration: 1s;
-webkit-animation-iteration-count: 1;
-webkit-animation-delay: 0.5s;
-webkit-animation-direction: normal;
-webkit-animation-fill-mode: forwards;
}
</style>
<div id="pic"></div>
<p class="center">Hover over me</p>
</body>
</html>
The problem with this approach is that this moves other content out of the way which I don't want.
This approach also doesn't work if I want to slide the image to the left or the right or upwards.
Any suggestions?
I put your code on fiddle an worked out a few examples for you:
move down: http://jsfiddle.net/rcCeP/
move up: http://jsfiddle.net/rcCeP/1/
move right: http://jsfiddle.net/rcCeP/2/
move left: http://jsfiddle.net/rcCeP/3/
for fun:
from center: http://jsfiddle.net/rcCeP/4/
in the document flow: http://jsfiddle.net/rcCeP/5/ (note the xtra wrapper with relative positioning)
how i would do it, with transitions in stead of animations, to work in two directions and degrade gracefully on older browsers: http://jsfiddle.net/rcCeP/6/
I could keep going on like this all day, this is real fun...
The key to prevent the content from getting pushed is making the picture position absolute. This will lift it out of the flow of the document. Then the direction just becomes a matter of playing around with the position and backround-position values.
Hope this helps!

Resources