Skip to content

Instantly share code, notes, and snippets.

@trongthanh
Created May 10, 2012 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trongthanh/2651495 to your computer and use it in GitHub Desktop.
Save trongthanh/2651495 to your computer and use it in GitHub Desktop.
Animated 3D Stereo Images with CSS3
/**
* Animated 3D Stereo Images with CSS3
* Author: Thanh Tran (int3ractive.com)
*/
.image1 {
background: url(http://labs.int3ractive.com/javascript/effects/stereo-images/img/DSC_0192.jpg) no-repeat;
width: 512px;
height: 769px;
}
.stereo-img {
overflow: hidden;
}
.stereo-img:hover {
-webkit-animation: translate .3s infinite linear;
-moz-animation: translate .3s infinite linear;
animation: translate .3s infinite linear;
}
/* These keyframes immitate a 2-state animation.
The 49.999% progress is trying to get as close to
next keyframe as possible, avoiding visible
intermediate transitions between 2 states*/
@-webkit-keyframes translate {
0% { background-position:0 0; }
49.999% { background-position:0 0; }
50% {background-position:100% 0; }
100% { background-position: 100% 0; }
}
@-moz-keyframes translate {
0% { background-position:0 0; }
49.999% { background-position:0 0; }
50% {background-position:100% 0; }
100% { background-position: 100% 0; }
}
@keyframes translate {
0% { background-position:0 0; }
49.999% { background-position:0 0; }
50% {background-position:100% 0; }
100% { background-position: 100% 0; }
}
<div class="image1 stereo-img" ></div>
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment