Revolution slider have option to set slide up image transition and I'm trying to copy that effect so I can use this without revolution slider..
This is slide transition effect.
This is the page where I'm trying to adopt above transition effect.
I tried this CSS but no luck, I don't know how to use key-frames for animation.
Thanks
.full-img.parallax-yes{
overflow-y: hidden;
max-height: 330px;
transition-property: all;
transition-duration: .5s;
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
transition: background-position 1s;
transform: matrix(1, 0, 0, 1, 0, 0);
transform-origin: 0% 0% 0px;
}
Here I have given an sample code for using the keyframes
<div class="full-height"> </div>;
.full-height {
max-height: 330px;
min-height: 330px;
background-image: url("http://carbongroup.com.au/wp-content/uploads/2015/10/bridge.jpg");
background-size: cover;
background-position: 0% 0%;
background-repeat: no-repeat;
background-color: green;
animation-name: move;
animation-duration: 10s;
animation-timing-function: linear;
animation-iteration-count: 1;
}
#keyframes move {
0% {
background-position: 0% 0%;
}
100% {
background-position: 100% 100%;
}
}
Hope this what you are trying for, simple background-image slide-up animation using CSS animation.
Define two different class inside of your parent div, one for background image and another for text which is positioned as absolute, position:absolute, to move background-image up-side use background-position-y in keyframes and negative value, for downward background-position-y and positive values.
#-webkit-keyframes ani{
from{
background-position-y:0px;
}
to{
background-position-y:-100px;
}
}
#bx{
width:100%;
height:300px;
overflow:hidden;
position:relative;
}
#bx > .iim{
width:100%;
height:600px;
background:url('https://source.unsplash.com/user/erondu');
background-repeat:no-repeat;
background-size:100% 100%;
background-position:fixed;
animation:an 5s forwards;
transition:5s ease forwards;
}
#-webkit-keyframes an{
from{
background-position-y:0px;
}
to{
background-position-y:-100px;
}
}
#bx > .txt{
width:100%;
height:300px;
overflow:hidden;
position:absolute;
color:black;
font-size:32px;
z-index:6;
top:0;
left:0;
}
<div id="bx">
<div class="iim">
</div>
<div class="txt">
Replace following content by your text.
</div>
</div>
You can do like this, and use at lease window.load() so the animation start only, when your page already loaded.
$(window).load(function(){
$('.banner').addClass('loaded');
});
.banner{
width: 100%;
height: 200px;
background-image: url(https://source.unsplash.com/user/erondu);
background-repeat: no-repeat;
background-size: cover;
background-attachment: fixed;
background-position-y: 100%;
color: #fff;
transition: all 5s cubic-bezier(0.47, 0, 0.745, 0.715);
-webkit-transition: all 5s cubic-bezier(0.47, 0, 0.745, 0.715);
}
.banner.loaded{
background-position-y: 0%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="banner">
<p>this is banner text</p>
</div>
Related
I'm trying to mimic sites like: http://shiz.co/ and http://www.maison-vignaux.com/work
The way the images show up, it's like they're not moving, but more of it gets shown in an interval. I want this type of animation. Right now, my image moves rather than having more of it show up like the sites above.
I have no idea how to accomplish this.
Here's my fiddle: https://jsfiddle.net/z7ukk6kb/ (disregard the name of the animation)
EDIT: problem was the background position on the div. now it does what I want.
<div class="parallax-elem">
<div class="img"></div>
</div>
$('.img').addClass('slide-top');
My CSS:
.slide-top {
-webkit-animation: slide-top 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
animation: slide-top 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}
#keyframes slide-top {
0% {
width:0;
}
100% {
width:100%;
}
}
.parallax-elem {
overflow:hidden;
position: absolute;
height:600px;
width:100%;
}
.parallax-elem:after {
content:"";
background-color:#eee;
width:100%;
height:100%;
top:0;
left:0;
right:0;
position: absolute;
z-index:10;
}
.img {
background:url('http://media.nj.com/entertainment_impact_dining/photo/coffee-stock-photo-0e8b300f42157b6f.jpg') no-repeat;
background-size: cover;
background-position: center center;
position: relative;
height: 100%;
z-index:11;
width: 100%;
}
Try removing background-position from .img.
Since you have set background-position: center center, as the width of the div increases during the animation, the background image keeps adjusting to stay centered. That's the reason it keeps moving.
$('.img').addClass('slide-top');
.slide-top {
animation: slide-top 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both infinite;
}
#keyframes slide-top {
0% {
width:0;
}
100% {
width:100%;
}
}
body {
max-width:800px;
margin:0 auto;
position:relative;
}
.parallax-elem {
overflow:hidden;
position: absolute;
height:600px;
width:100%;
}
.parallax-elem:after {
content:"";
background-color:#eee;
width:100%;
height:100%;
top:0;
left:0;
right:0;
position: absolute;
z-index:10;
}
.img {
background:url('http://media.nj.com/entertainment_impact_dining/photo/coffee-stock-photo-0e8b300f42157b6f.jpg') no-repeat;
background-size: cover;
position: relative;
height: 100%;
z-index:11;
width: 100%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="parallax-elem">
<div class="img"></div>
</div>
The reason this happens is because you use background-position center. And that is exactly what is is doing, it is aligning you image in the center. If you'd change is to background-position: left center, the problem is fixed, as you can see in this fiddle.
You could also remove the background-position entirely, but then you will also loose you vertical alignment, you might not want that.
Also, you can make your animation a whole lot easier, you don't need keyframes:
.img{
width: 0%;
background-position: left center;
animation: width 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940);
}
.img.slide-top{
width: 100%;
}
I have a working demo. just hover the img and there is the effect I want to have.
http://jsfiddle.net/jxgjhzer/1/
As you can see in css file, I don't use any css animation.
Just using CSS transform, I want my img to achieve same effect without hovering it. It should happen automatically.
So how to zoom-in and zoom-out automatically (without animation if possible)?
Code goes here:
.galleryImg{
height:150px;
width:100%;
transform-origin: 50% 50%;
transition: transform 30s linear;
}
.galleryImg:hover{
transform: scale(2) rotate(0.1deg);
}
that's very simple. you can see DEMO on this link on jsfiddle.net
<div class="cardcontainer">
<img class="galleryImg" src="https://www.google.com/logos/doodles/2014/2014-winter-olympics-5710368030588928-hp.jpg">
</div>
#keyframes zoominoutsinglefeatured {
0% {
transform: scale(1,1);
}
50% {
transform: scale(1.2,1.2);
}
100% {
transform: scale(1,1);
}
}
.cardcontainer img {
animation: zoominoutsinglefeatured 1s infinite ;
}
use animation
.galleryImg{
height:150px;
width:100%;
animation:move 3s infinite ease-in-out;
}
#keyframes move{
0%{
transform: scale(1) rotate(0deg);
}
100%{
transform: scale(2) rotate(0.1deg);
}
}
The below css code will help you out for zoom out effect on hover the particular image. Try this code its very useful to you
figure {
width: 300px;
height: 200px;
margin: 0;
padding: 0;
background: #fff;
overflow: hidden;
}
figure:hover+span {
bottom: -36px;
opacity: 1;
}
.hover04 figure img {
width: 400px;
height: auto;
-webkit-transition: .3s ease-in-out;
transition: .3s ease-in-out;
}
.hover04 figure:hover img {
width: 300px;
}
Refer the html code here.
<div class="hover04 column">
<div>
<figure><img src="1.jpeg" /></figure>
<span>Hover Text</span>
</div>
</div>
I'm trying to create an animation that simulates a "cut from rope" sort of effect.
Picture an object hanging from two ropes. First, the left one is cut, and a bit after the right one is then cut. I have got pretty close to the desire effect, but my animation isn't as smooth as I would like.
You can see that the object sort of bounces back up, which I tried to minimize by translating the entire object down.
My question is, is there a better way to achieve this effect, or any ways to improve my animation?
HTML
<div id="box"></div>
<div id="bottom"></div>
CSS
#box {
width: 400px;
height: 60px;
background: black;
margin: 100px;
animation: ropecut 1.2s 1 ease-out;
transform: rotateZ(0deg);
transform: rotateZ(0);
transform-origin: top left;
animation-timing-function: ease-in-out;
transform: translateY(50px)
}
#bottom {
width: 600px;
height: 2px;
background: red;
margin-top: -50px;
}
#keyframes ropecut {
0% {transform: rotateZ(0deg);transform-origin: top right;animation-timing-function: ease-in-out;}
50% {transform: rotateZ(-7.5deg);transform-origin: top right;animation-timing-function: ease-in-out;}
70% {transform: rotateZ(-7.5deg);transform-origin: top right;animation-timing-function: ease-in-out;}
100% {transform: rotateZ(0);transform-origin: top left;animation-timing-function: ease-in-out;transform: translateY(50px)}
}
Link to JS Fiddle
Try this, I basically just took out the 70% bit of the keyframe and then removed the rotateZ in the 100% sequence. That will keep the bottom left corner where it should stay.
#box {
width: 400px;
height: 60px;
background: black;
margin: 100px;
animation: ropecut 1.2s 1 ease-out;
transform: rotateZ(0);
transform-origin: top left;
animation-timing-function: ease-in-out;
transform: translateY(50px)
}
#bottom {
width: 600px;
height: 2px;
background: red;
margin-top: -50px;
}
#keyframes ropecut {
0% {transform: rotateZ(0deg);transform-origin: top right;animation-timing-function: ease-in-out;}
50% {transform: rotateZ(-7.5deg);transform-origin: top right;animation-timing-function: ease-in-out;}
100% {animation-timing-function: ease-in-out; transform-origin: top right;}
}
<div id="box"></div>
<div id="bottom"></div>
i have two css3 keyframes and trigger by some button, but the issue is when i try to adding a new keyframe (new class) the transition not change in smooth way, how to make this transition working smooth ?
source in fiddle here
.button {
width:50px;
height:50px;
background:silver;
}
.box {
width: 100px;
height: 100px;
background: green;
position: relative;
top: 10%;
left: 10%;
}
.box {
animation: xx 2s linear infinite;
}
.boxShake {
animation:boxShake 2s linear infinite;
}
One trick to achieve this is not to change the animation.
But make a composite animation transforming both the X and the Y in percentages.
Now, changing the width and the height of the element, we modify the amount of movement in one axis or the other of the unaltered animation
$(".button").click(function(){
$("#mover").toggleClass("alternate");
});
.button {
width:50px;
height:50px;
background:silver;
}
.box {
width: 100px;
height: 100px;
background: green;
position: relative;
top: 10%;
left: 10%;
}
.box {
animation: xx 2s linear infinite;
}
#mover {
width: 0px;
height: 20px;
transition: width 2s, height 2s;
animation: mover 2s linear infinite;
}
#mover.alternate {
width: 5px;
height: 0px;
}
#keyframes mover {
0% {transform:translate( 0%, 0%);}
10% {transform:translate(-100%, 20%);}
20% {transform:translate( 100%, 40%);}
30% {transform:translate(-100%, 60%);}
40% {transform:translate( 100%, 80%);}
50% {transform:translate(-100%, 100%);}
60% {transform:translate( 100%, 80%);}
70% {transform:translate(-100%, 60%);}
80% {transform:translate( 100%, 40%);}
90% {transform:translate(-100%, 20%);}
100% {transform:translate( 0%, 0%);}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="button">Button</div>
<div id="mover">
<div class="box"></div>
</div>
Just play with the width and height of the 2 element states, and the transition between them, to adapt it to your needs
I am trying to perform a rotate on the Y axis of an element that contains a background-image. When I reach 50% of that animation, I would like to change the image.
The problem:
The background-image is also animated
I am trying to do this without the use of Javascript.
Is that possible?
Code:
.picture {
background-image: url('http://img3.wikia.nocookie.net/__cb20130216121424/adventuretimewithfinnandjake/images/2/29/Tom-cruise-funny-face.png');
display: inline-block;
vertical-align: top;
border: 5px solid red;
width: 250px;
height: 250px;
background-size: 100% 100%;
border-radius: 100%;
}
.animated {
-webkit-animation-name: turns;
animation-name: turns;
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}
#-webkit-keyframes turns {
0% { background-image: url('http://img3.wikia.nocookie.net/__cb20130216121424/adventuretimewithfinnandjake/images/2/29/Tom-cruise-funny-face.png'); -webkit-transform: rotateY(0deg); }
1% { background-image: url('http://img3.wikia.nocookie.net/__cb20130216121424/adventuretimewithfinnandjake/images/2/29/Tom-cruise-funny-face.png'); }
50% { background-image: url('http://img3.wikia.nocookie.net/__cb20130216121424/adventuretimewithfinnandjake/images/2/29/Tom-cruise-funny-face.png'); }
51% { background-image: url('http://i3.mirror.co.uk/incoming/article172940.ece/alternates/s615/image-16-jim-carrey-50th-birthday-604638636.jpg'); }
100% { background-image: url('http://i3.mirror.co.uk/incoming/article172940.ece/alternates/s615/image-16-jim-carrey-50th-birthday-604638636.jpg'); -webkit-transform: rotateY(180deg); }
}
jsFiddle: http://jsfiddle.net/dmzj7cfh/1/
If the problem that you have is that the background image change does nt happen in the 50% of the rotation, it's because the timing funciont is applied for the individual steps in the case of the background (because it is set in every keyframe), but for the full animation in the case of the rotation.
The easiest way to solve it is to set
-webkit-animation-timing-function: linear;
so that it doesn't matter the above problem
I have also fixed a problem with the background size.
fiddle
You should probably use multiple animation keywords to simplify, as you need to change two different properties.
For background-image animation, use animation-timing-function: steps(2); and for transform: rotate;, use linear function to simplify the keyframes.
Using non-linear functions like ease and custom cubic-bezier()s can create a lot of complexities.
FIDDLE
Snippet :
div{
display: inline-block;
border: 5px solid red;
width: 250px;
height: 250px;
background-size: cover;
border-radius: 100%;
-webkit-animation-name: animate, background;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 2s;
-webkit-animation-timing-function: linear, steps(2);
animation-name: animate, background;
animation-iteration-count: infinite;
animation-duration: 2s;
animation-timing-function: linear, steps(2);
background-image: url('http://i.imgur.com/gmucjHi.png');
position: relative;
}
#-webkit-keyframes animate {
0% {transform: rotateY(90deg);}
100% {transform: rotateY(450deg);}
}
#-webkit-keyframes background {
0% {background-image: url('http://i.imgur.com/gmucjHi.png');}
100% {background-image: url('http://i.imgur.com/mZinlRQ.jpg');}
}
#keyframes animate {
0% {transform: rotateY(90deg);}
100% {transform: rotateY(450deg);}
}
#keyframes background {
0% {background-image: url('http://i.imgur.com/gmucjHi.png');}
100% {background-image: url('http://i.imgur.com/mZinlRQ.jpg');}
}
<div></div>
Note : I haven't added vendor prefixes other than -webkit-.