Skip to content

Instantly share code, notes, and snippets.

@CodeMyUI
Created November 14, 2016 00:48
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 CodeMyUI/79132c68da46a9daef5554e472a469c2 to your computer and use it in GitHub Desktop.
Save CodeMyUI/79132c68da46a9daef5554e472a469c2 to your computer and use it in GitHub Desktop.
Focus
<div class="wrapper">
<div class="focus">
focus
</div>
<div class="mask">
<div class="text">focus</div>
</div>
</div>
/*
Inspiration: http://drbl.in/oNQy
*/
$target: #fff;
body {
background: #72B565;
}
.wrapper {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
width: 235px;
height: 70px;
white-space: nowrap;
}
.focus {
position: absolute;
top: 50%;
transform: translateY(-50%);
font-family: Arial;
text-transform: uppercase;
letter-spacing: 2px;
filter: blur(3px);
font-size: 65px;
opacity: 0.6;
color: #fff;
}
.mask {
position: absolute;
left: -5px;
top: -2px;
width: 70px;
font-family: Arial;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 2px;
font-size: 65px;
clip: rect(0px,70px,75px,0px);
background: linear-gradient($target, $target 0) no-repeat,
linear-gradient(to right, $target, $target 0) no-repeat,
linear-gradient(to right, $target, $target 0) bottom left no-repeat,
linear-gradient(to right, $target, $target 0) bottom left no-repeat,
linear-gradient($target, $target 0) bottom right no-repeat,
linear-gradient($target, $target 0) bottom right no-repeat,
linear-gradient($target, $target 0) top right no-repeat,
linear-gradient($target, $target 0) top right no-repeat;
background-size: 10px 2px, 2px 10px, 2px 10px, 10px 2px, 2px 10px, 10px 2px, 10px 2px, 2px 10px, 10px 2px;
color: #fff;
padding: 5px;
transform: translateX(0);
box-sizing: border-box;
animation: mask 2.5s ease infinite alternate;
}
.text {
transform: translateX(0);
animation: text 2.5s ease infinite alternate;
}
@keyframes mask {
to {
transform: translateX(170px);
}
}
@keyframes text {
to {
transform: translateX(-170px);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment