Skip to content

Instantly share code, notes, and snippets.

@mcamiano
Created August 4, 2013 22:33
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 mcamiano/6152223 to your computer and use it in GitHub Desktop.
Save mcamiano/6152223 to your computer and use it in GitHub Desktop.
A CSS transition effect to mimic slowly expanding/contracting movie titles.
<style>
hr {
margin-top: 2em;
}
.inflate, .deflate {
font-size: 4em;
width: 50%;
hideborder: solid thin red;
text-align: center;
margin-left: 25%;
margin-top: 1em;
transition: color 12s, tranform 12s;
-webkit-transition: color 12s, -webkit-transform 12s;
}
.inflates:hover .deflate {
transform-origin: center center;
-webkit-transform-origin: center center;
transform: scale(0.83,0.83);
-webkit-transform: scale(0.83,0.83);
color: red;
}
.inflates:hover .inflate {
transform-origin: center center;
-webkit-transform-origin: center center;
transform: scale(1.2,1.2);
-webkit-transform: scale(1.2,1.2);
color: red;
}
h2.deflate {
font-size: 4em;
}
</style>
<div class='inflates'>
<h1 class='inflate'>Hello</h1>
<hr />
<h2 class='deflate'>World</h2>
</div>
@mcamiano
Copy link
Author

mcamiano commented Aug 4, 2013

See http://jsfiddle.net/mcamiano/Wzf8H/ for a working example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment