From our sponsor: Meco is a distraction-free space for reading and discovering newsletters, separate from the inbox.
Today we’d like to share some item transition inspiration with you. We tried to keep the idea of the transition general, so we did three different use cases: a small image slideshow, a large header slideshow and a slideshow using product images with a transparent background. These transitions don’t have to be restricted to a slideshow, of course. But to see them in action, this was the best option for a demo. You can surely imagine transitioning from one state to another in many different circumstance (think about scrolling a page, loading items, clicking a button, sending a form, and many many more).
A very special case is the usage of (product) images with transparent background. Depending on the item itself, there are many possibilities for transitions that imitate the real-world movement or behavior. A great example in the wild can be found on the brilliant hat presentation section of Optimo Chicago. The slideshow conveys a feeling of throwing a hat into the viewport, transmitting the feeling of lightness and augmenting the viewing experience. This is such an excellent example of how adding the right animations can enhance product browsing and bring it to another level. In our last demo, we give you some simple inspiration using a wine bottle to explore the feeling for heavier objects.
For transitioning the state, we are using CSS Animations. This allows us to specify a certain behavior for the items when coming from any direction. This can be useful for direction-aware navigation of items, like you can see in the demos.
One of the transitions that can be viewed in the large header slideshow example is based on Hakim El Hattab’s slick context-shift transition, Kontext, and another one makes use of one of Lionel’s CSS Shake animations.
Please note that in some examples we are using CSS Animations on pseudo-elements which might not be supported in some browsers (especially mobile browsers).
Please also note that the examples only serve for your inspiration. We haven’t implemented any fallbacks.
Tiny break: 📬 Want to stay up to date with frontend and trends in web design? Subscribe and get our Collective newsletter twice a tweek.
We’ve divided the inspiration for transitions into three demos:
Small Component: these effects are especially interesting for smaller sized images.
Full Width: Having a large header image or background let’s us explore a different set of effects but also restricts the movements and speeds a bit.
Transparent Background: Here we can play with physics and effects that resemble the movements of objects in the real world. Using the right animations can help transmit the feeling for the weight and material of an item.
The images in the first demo are from the Hand Lettering project by Ben Johnston. The ones in the second demo are from Unsplash and the wine bottle mockups can be found over at Pixeden.
We hope you enjoy these effects and find them inspiring.
that is very cool marry 😀 but how to set time that it changes automatically 🙂
This is an inspiration bro! Idea for your project? Hehehe…:P
Tested with index2.html (possibly works with the others).
In js/main.js find the line:
isAnimating = false;
After that line add this:
window.setInterval(function(){navigate( ‘next’ )}, 1000);
The number is milliseconds.
This only starts to work after you choose a transition. Your challenge is to find a way to trigger the effect without intervention.
I hope this helps
Owww amazing work. Thanks for sharing.
Wow amazing. Thank you so much, you made my day! 🙂
The slide-forward on the bottle… OP!
Tested with index2.html (possibly works with the others).
In js/main.js find the line:
isAnimating = false;
After that line add this:
window.setInterval(function(){navigate( ‘next’ )}, 1000);
Thanks
Mary! Muito obrigado!
Very good slide.
Really nice effect, maybe i will use it for a little wine shop.
Always brilliant ideas here 🙂
Amazing 🙂
amazing one 🙂
Mary will you marry me 🙂 hehehe !!!
I bet she gets a few hundred of these a day. If only I smelled of peppercorns. lol
I really like it, nice effects, i find it really inspiring (especially with transparent and full width), thanks
Love it
Great work!
Thank’s for sharing that!
Is there a way to do the slider automatically???
Hello, I actually have a question about your animated responsive grid. http://tympanus.net/codrops/2012/08/02/animated-responsive-image-grid/ I don’t want to use random. And I don’t want to use sliding animations type. Is it possible to specify 2 or 3 animation types I want to use in animType field? Thanks.
Truly great examples of how small details like this add to a pleasurable experience; my coworker didn’t understand why I was laughing at slide transition examples. Some people just don’t get it…
Again a very inspiring article. Finding names for transitions was probably a great exercise as well!
I think something happened with the JavaScript involving the animation prefixes and how they’re handled because the demo doesn’t work on Chrome (version 33.0.1750.154 on Windows). The string seems to be right for it to work in theory though (webkitAnimationEnd)…
how can i program it so one animation is automatically selected without all the options? if anyone could please help mew this this i would appreciate it. 🙂
thank you
great demo!
Have you found a solution to this… I’m trying to do the same thing but can’t figure it out
Firstly comment out the select.
Then in main.js, in the function changeEffect() find this line:
classie.addClass( component, effectSel.options[ effectSel.selectedIndex ].value );
Replace with this example:
classie.addClass( component, “fxPushReveal” );
Where I have chosen fxPushReveal
Done.
See my reply to another user above on how to have the slideshow automatically….
3 Steps:
Firstly comment out the fx selector in the index (IE index2.html).
Then in main.js, replace the changeEffect() function with this:
function changeEffect() {
component.className = component.className.replace(/\bfx.*?\b/g, ”);
classie.addClass( component, “fxPushReveal” );
}
I have chosen the effect fxPushReveal
Finally in the navigate(dir) function comment out this line:
if( isAnimating || !effectSel.selectedIndex ) return false;
Boom!
See my reply to another user above on how to have the slideshow automatically….
Read the code. Extract the part you need to use. Basic HTML / CSS.
Did Miike’s solution work for you?
I’ve been trying to implement it but when I click on the arrows the effect doesn’t work… Is it just me?
Hi guys, here’s what you could do for making it work quickly:
1) index.html
add the effect class to the component div. For instance if you want the fxCorner then:
<div id="component" class="component component-small fxCorner"><!--formatted-->
2) main.js
In function init, comment (or remove) the first two lines:
hideNav(); changeEffect();
3) main.js
In the function navigate change the first line:
if( isAnimating || !effectSel.selectedIndex ) return false;
to
if( isAnimating ) return false;
Hope it helps! Cheers, ML
Brilliant stuff. Small things for a great experience.
Really nice stuff !!!!!!!
i want add autoplay in this slider and i want to run all effect together
thank tou
You guys do such amazing amount of work. This is damn cool!! Thanks for all the efforts!
What kind of mystic browser do I need to see the animations?
On Chrome Version 33.0.1750.154 nothing happens 🙁
This is so awesome. Inspiring, quite refreshing transitions. Thank you
You guys are really awesome. This site is very inspirating, I’m visiting it daily, checking for news.
Thank you. Just had to say that 🙂
write moooore !
Splendid !
This are really nice…is the code open soucre or are you granting permission to use these in our projects…If not that is ok…they were nice to look at…
Michael!
Hola Codrops, me encantan los sliders, encontrar ejemplos asi, nos permiten a los diseñadores tener mas herramientas para hacer buenas webs.
Saludos desde Buenos Aires, Argentina
http://pixmap.in/krishna/index2.html
This is good working but fxselect effect is very fast working?
any solution
Thanks
🙂
nice improvement but still doesn’t work in ie9 and before….
Really Awosome. Thanks for sharing…:)
no more lifes
I’m iniciane in js, I would put a soft transition scale as standard and add auto play how I do it? help me please thanks
Muy interesante! como puedo hacer para que en vez del “prev” y el “next” sea un menú?. gracias 🙂
the codrops interactive demo menu plugins not supporting any other brower except mozillza………….give me a solution my website is spoiling
help me soon plz……..
Hello! Nice implementation! Is it possible to improve with autoplay feature?
thanks!
awesome
Really awesome!
Hi,
On the second demo, can you explain how you created the filter on the image? I mean, this “Instagram” like effect.
The “cliff diving” one reminded me a lot of those old viewfinder toys. I put a thick white border around the surrounding article element, and it looked awesome! Rather nostalgic. Thanks for these, Mary Lou! Excellent work as usual.
Hi, I try use the 3 steps of Miike and didn’t work….
SOMEONE CAN HELP ME?
The problem line is
” effectSel.addEventListener( ‘change’, changeEffect ); ”
Mikiie Steps :
3 Steps:
Firstly comment out the fx selector in the index (IE index2.html).
Then in main.js, replace the changeEffect() function with this:
function changeEffect() {
component.className = component.className.replace(/\bfx.*?\b/g, ”);
classie.addClass( component, “fxPushReveal” );
}
I have chosen the effect fxPushReveal
Finally in the navigate(dir) function comment out this line:
if( isAnimating || !effectSel.selectedIndex ) return false;
Boom!
See my reply to another user above on how to have the slideshow automatically….
Hi guys this is how i have main.js, i didn’t wanted it to auto scroll, but mine doesn’t need to select an effect:
find this line and change it
classie.addClass( component, ‘fxSoftScale’ );
here it goes
(function() {
var support = { animations : Modernizr.cssanimations },
animEndEventNames = {
‘WebkitAnimation’ : ‘webkitAnimationEnd’,
‘OAnimation’ : ‘oAnimationEnd’,
‘msAnimation’ : ‘MSAnimationEnd’,
‘animation’ : ‘animationend’
},
// animation end event name
animEndEventName = animEndEventNames[ Modernizr.prefixed( ‘animation’ ) ],
/*effectSel = document.getElementById( ‘fxselect’ ),*/
component = document.getElementById( ‘component’ ),
items = component.querySelector( ‘ul.itemwrap’ ).children,
current = 0,
itemsCount = items.length,
nav = component.querySelector( ‘nav’ ),
navNext = nav.querySelector( ‘.next’ ),
navPrev = nav.querySelector( ‘.prev’ ),
isAnimating = false;
function init() {
showNav();
changeEffect();
navNext.addEventListener( ‘click’, function( ev ) { ev.preventDefault(); navigate( ‘next’ ); } );
navPrev.addEventListener( ‘click’, function( ev ) { ev.preventDefault(); navigate( ‘prev’ ); } );
/*effectSel.addEventListener( ‘change’, changeEffect );*/
}
function hideNav() {
nav.style.display = ‘none’;
}
function showNav() {
nav.style.display = ‘block’;
}
function changeEffect() {
component.className = component.className.replace(/\bfx.*?\b/g, ”);
/*if( effectSel.selectedIndex ) {
classie.addClass( component, effectSel.options[ effectSel.selectedIndex ].value );
classie.addClass( component, ‘fxPushReveal’ );
showNav();
}*/
classie.addClass( component, ‘fxSoftScale’ );
/*else {
hideNav();
}*/
}
function navigate( dir ) {
/*if( isAnimating || !effectSel.selectedIndex ) return false;*/
isAnimating = true;
var cntAnims = 0;
var currentItem = items[ current ];
if( dir === ‘next’ ) {
current = current 0 ? current – 1 : itemsCount – 1;
}
var nextItem = items[ current ];
var onEndAnimationCurrentItem = function() {
this.removeEventListener( animEndEventName, onEndAnimationCurrentItem );
classie.removeClass( this, ‘current’ );
classie.removeClass( this, dir === ‘next’ ? ‘navOutNext’ : ‘navOutPrev’ );
++cntAnims;
if( cntAnims === 2 ) {
isAnimating = false;
}
}
var onEndAnimationNextItem = function() {
this.removeEventListener( animEndEventName, onEndAnimationNextItem );
classie.addClass( this, ‘current’ );
classie.removeClass( this, dir === ‘next’ ? ‘navInNext’ : ‘navInPrev’ );
++cntAnims;
if( cntAnims === 2 ) {
isAnimating = false;
}
}
if( support.animations ) {
currentItem.addEventListener( animEndEventName, onEndAnimationCurrentItem );
nextItem.addEventListener( animEndEventName, onEndAnimationNextItem );
}
else {
onEndAnimationCurrentItem();
onEndAnimationNextItem();
}
classie.addClass( currentItem, dir === ‘next’ ? ‘navOutNext’ : ‘navOutPrev’ );
classie.addClass( nextItem, dir === ‘next’ ? ‘navInNext’ : ‘navInPrev’ );
}
init();
})();
Hi,
Can anyone help me understand how i can achieve one effect without selection the effect from the dropdown menu.
I tried the above method but it work for me.
Thanks,
Hi Seham, here’s what you could do for making it work quickly:
1) index.html
add the effect class to the component div. For instance if you want the fxCorner then:
<div id="component" class="component component-small fxCorner"><!--formatted-->
2) main.js
In function init, comment (or remove) the first two lines:
hideNav(); changeEffect();
3) main.js
In the function navigate change the first line:
if( isAnimating || !effectSel.selectedIndex ) return false;
to
if( isAnimating ) return false;
Hope it helps! Cheers, ML
Mary Lou, hi 🙂
How do auto play?
All hope for you 🙂
Hi! Have you figured out how to autoplay? Mary Lou can you please help us?!
Mary Lou, you’re awesome! really! thank u so much! God bless u! 🙂
I’ve tried this way, but the “next” button don’t work, the “prev” works fine
In Developer Tools , I find that when click “next” button, the next item doesn’t have a current class, and “navInNext” class never removed
First congratulations to quality.
I have little knowledge in programming, how I can stop when you reach the last photo? or alert saying last photo and just let go backwards.
Hello, I am wanting to make this an automatic slider for the full width one. How would I do this? Thanks
Great work!
thank you for sharing.
I have one total noob JS question:
I try to add multiple sections with images in order to have this effect (imagine several sliders). But it only works on the first one.
Any idea how to approach it?
Hello… i was truing to find the autoplay but i can;t…
I used the Varquez solution, that work fine…
So If anyone can help for autoplay the slide i would be gratiful!
Glad it worked ^^
Hi Mary Lou, I like your second demo, I mean it;s easy for me.
Mary Loy hi,
Congratulations for all your articles, they are amazing!
I have a problem with using the slider in a WordPress site as my loop generates the li elements and if I have the class=”current” then all the li elements have it and you need to click 2-3 times on the next/prev arrows to move on. If I remove the class=”current” then the first slide does not appear and I have to click on the next button to get it started. Is there a way to solve this? I tried appending with javascript a class current to my first-child li but it does not work. Am I missing something very simple?!
Thanks in advance for your time!
Hi, don’t bother to answer, it was very simple to fix, just needed to alter the loop to print the class current only to the first item…! I knew I was missing something very simple!