ruk·si

🎨 CSS
Glitching Text

Updated at 2014-01-15 01:03

Example

GLITCH

Markup

<div class="glitch-container">
    <div class="glitch" data-text="GLITCH">
        GLITCH
    </div>
</div>
.glitch-container {
    background: black;
    font-family: sans-serif;
}
.glitch {
    color: white;
    font-size: 100px;
    position: relative;
    width: 400px;
    margin: 0 auto;
}
@-webkit-keyframes noise-anim {
    0% { clip: rect(82px, 9999px, 64px, 0); }
    5% { clip: rect(78px, 9999px, 68px, 0); }
    10% { clip: rect(57px, 9999px, 35px, 0); }
    15% { clip: rect(48px, 9999px, 78px, 0); }
    20% { clip: rect(34px, 9999px, 13px, 0); }
    25% { clip: rect(10px, 9999px, 40px, 0); }
    30% { clip: rect(52px, 9999px, 19px, 0); }
    35% { clip: rect(57px, 9999px, 24px, 0); }
    40% { clip: rect(36px, 9999px, 94px, 0); }
    45% { clip: rect(59px, 9999px, 10px, 0); }
    50% { clip: rect(86px, 9999px, 74px, 0); }
    55% { clip: rect(73px, 9999px, 63px, 0); }
    60% { clip: rect(69px, 9999px, 60px, 0); }
    65% { clip: rect(86px, 9999px, 59px, 0); }
    70% { clip: rect(65px, 9999px, 23px, 0); }
    75% { clip: rect(65px, 9999px, 79px, 0); }
    80% { clip: rect(55px, 9999px, 25px, 0); }
    85% { clip: rect(77px, 9999px, 17px, 0); }
    90% { clip: rect(72px, 9999px, 4px, 0); }
    95% { clip: rect(97px, 9999px, 93px, 0); }
    100% { clip: rect(38px, 9999px, 71px, 0); }
}
@keyframes noise-anim {
    0% { clip: rect(82px, 9999px, 64px, 0); }
    5% { clip: rect(78px, 9999px, 68px, 0); }
    10% { clip: rect(57px, 9999px, 35px, 0); }
    15% { clip: rect(48px, 9999px, 78px, 0); }
    20% { clip: rect(34px, 9999px, 13px, 0); }
    25% { clip: rect(10px, 9999px, 40px, 0); }
    30% { clip: rect(52px, 9999px, 19px, 0); }
    35% { clip: rect(57px, 9999px, 24px, 0); }
    40% { clip: rect(36px, 9999px, 94px, 0); }
    45% { clip: rect(59px, 9999px, 10px, 0); }
    50% { clip: rect(86px, 9999px, 74px, 0); }
    55% { clip: rect(73px, 9999px, 63px, 0); }
    60% { clip: rect(69px, 9999px, 60px, 0); }
    65% { clip: rect(86px, 9999px, 59px, 0); }
    70% { clip: rect(65px, 9999px, 23px, 0); }
    75% { clip: rect(65px, 9999px, 79px, 0); }
    80% { clip: rect(55px, 9999px, 25px, 0); }
    85% { clip: rect(77px, 9999px, 17px, 0); }
    90% { clip: rect(72px, 9999px, 4px, 0); }
    95% { clip: rect(97px, 9999px, 93px, 0); }
    100% { clip: rect(38px, 9999px, 71px, 0); }
}
.glitch:after {
    content: attr(data-text);
    position: absolute;
    left: 2px;
    text-shadow: -1px 0 red;
    top: 0;
    color: white;
    background: black;
    overflow: hidden;
    clip: rect(0, 900px, 0, 0);
    -webkit-animation: noise-anim 2s infinite linear alternate-reverse;
    animation: noise-anim 2s infinite linear alternate-reverse;
}
@-webkit-keyframes noise-anim-2 {
    0% { clip: rect(86px, 9999px, 90px, 0); }
    5% { clip: rect(59px, 9999px, 39px, 0); }
    10% { clip: rect(87px, 9999px, 60px, 0); }
    15% { clip: rect(10px, 9999px, 67px, 0); }
    20% { clip: rect(14px, 9999px, 71px, 0); }
    25% { clip: rect(30px, 9999px, 14px, 0); }
    30% { clip: rect(61px, 9999px, 62px, 0); }
    35% { clip: rect(43px, 9999px, 70px, 0); }
    40% { clip: rect(54px, 9999px, 33px, 0); }
    45% { clip: rect(98px, 9999px, 62px, 0); }
    50% { clip: rect(51px, 9999px, 5px, 0); }
    55% { clip: rect(69px, 9999px, 76px, 0); }
    60% { clip: rect(45px, 9999px, 11px, 0); }
    65% { clip: rect(15px, 9999px, 3px, 0); }
    70% { clip: rect(74px, 9999px, 63px, 0); }
    75% { clip: rect(93px, 9999px, 57px, 0); }
    80% { clip: rect(27px, 9999px, 13px, 0); }
    85% { clip: rect(25px, 9999px, 66px, 0); }
    90% { clip: rect(12px, 9999px, 51px, 0); }
    95% { clip: rect(94px, 9999px, 28px, 0); }
    100% { clip: rect(95px, 9999px, 84px, 0); }
}
@keyframes noise-anim-2 {
    0% { clip: rect(86px, 9999px, 90px, 0); }
    5% { clip: rect(59px, 9999px, 39px, 0); }
    10% { clip: rect(87px, 9999px, 60px, 0); }
    15% { clip: rect(10px, 9999px, 67px, 0); }
    20% { clip: rect(14px, 9999px, 71px, 0); }
    25% { clip: rect(30px, 9999px, 14px, 0); }
    30% { clip: rect(61px, 9999px, 62px, 0); }
    35% { clip: rect(43px, 9999px, 70px, 0); }
    40% { clip: rect(54px, 9999px, 33px, 0); }
    45% { clip: rect(98px, 9999px, 62px, 0); }
    50% { clip: rect(51px, 9999px, 5px, 0); }
    55% { clip: rect(69px, 9999px, 76px, 0); }
    60% { clip: rect(45px, 9999px, 11px, 0); }
    65% { clip: rect(15px, 9999px, 3px, 0); }
    70% { clip: rect(74px, 9999px, 63px, 0); }
    75% { clip: rect(93px, 9999px, 57px, 0); }
    80% { clip: rect(27px, 9999px, 13px, 0); }
    85% { clip: rect(25px, 9999px, 66px, 0); }
    90% { clip: rect(12px, 9999px, 51px, 0); }
    95% { clip: rect(94px, 9999px, 28px, 0); }
    100% { clip: rect(95px, 9999px, 84px, 0); }
}
.glitch:before {
    content: attr(data-text);
    position: absolute;
    left: -2px;
    text-shadow: 1px 0 blue;
    top: 0;
    color: white;
    background: black;
    overflow: hidden;
    clip: rect(0, 900px, 0, 0);
    -webkit-animation: noise-anim-2 3s infinite linear alternate-reverse;
    animation: noise-anim-2 3s infinite linear alternate-reverse;
}

Source