A Pen by Balint Polgarfi on CodePen.
Black & White
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="black"></div> | |
<div id="text">BLACK<br><span>& WHITE</span></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).on("load click resize", function() { | |
var $black = $("#black").css("clip", ""); | |
var w = $(this).width(), h = $(this).height(); | |
var t = 0, r = w, b = h, l = 0; | |
this.tl && tl.stop(); | |
tl = new TimelineLite(); | |
l = w/2 - 60; | |
tl.to($black, 0.25, {clip: "rect("+[t,r,b,l].join()+")"}, 0.5); | |
b = h/2; | |
tl.to($black, 0.25, {clip: "rect("+[t,r,b,l].join()+")"}); | |
r = w/2 + 108; | |
tl.to($black, 0.25, {clip: "rect("+[t,r,b,l].join()+")"}); | |
t = h/2 - 60; | |
tl.to($black, 1.75, {clip: "rect("+[t,r,b,l].join()+")", ease: Elastic.easeOut}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/gsap/1.16.1/TweenMax.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import url(https://fonts.googleapis.com/css?family=Roboto+Condensed:300); | |
#black { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100vw; | |
height: 100vh; | |
background: #000; | |
clip: rect(0 100vw 100vh 0); | |
} | |
#text { | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
color: white; | |
font-size: 60px; | |
line-height: 60px; | |
font-family: "Roboto Condensed"; | |
text-align: right; | |
} | |
#text span { | |
color: #000; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment