JSFiddle - React, Tailwind, and code Playground
by Dhanck
HTML
<h1>
<span>CSS Cinema Effect</span>
</h1>
<div class='outer-scratch'>
<div class="inner-scratch">
<div class="background grain"></div>
</div>
</div>
SCSS
@import url(https://fonts.googleapis.com/css?family=Roboto:100);
html, body {
height: 100%;
margin: 0;
overflow: hidden;
}
.background {
width: 100%;
height: 100%;
background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/662025/abstract.jpg');
background-size: cover;
}
.outer-scratch, .inner-scratch {
height: inherit;
}
.outer-scratch:after, .inner-scratch:after {
content: '';
width: 120%;
height: 100%;
position: absolute;
top: 0;
left: 0;
padding-left: 100px;
opacity: .08;
background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/662025/scratch.png') repeat center center;
-webkit-animation: scratch 0.45s steps(1) infinite;
animation: scratch 0.45s steps(1) infinite;
}
.inner-scratch:after {
left: 30%;
-webkit-animation: inner-scratch 2s infinite;
animation: inner-scratch 2s infinite;
}
.grain:after {
content: '';
width: 110%;
height: 110%;
position: absolute;
top: -5%;
left: -5%;
opacity: .11;
background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/662025/grain.jpg') repeat center center;
-webkit-animation: grain 0.5s steps(1) infinite;
animation: grain 0.5s steps(1) infinite;
}
/* Basic Title */
h1 {
position: absolute;
top: 0;
left: 0;
width: 100%;
font-family: 'Roboto', sans-serif;
font-weight: 100;
font-size: 3em;
text-align: center;
color: #fff;
-webkit-animation: 3s fade;
animation: 3s fade;
span {
display: inline-block;
position: relative;
padding: .5em 1em;
&:before {
display: block;
content: '';
width: 110%;
margin-left: -5%;
margin-bottom: 5%;
border-top: 1px solid #fff;
-webkit-animation: 2.5s draw;
animation: 2.5s draw;
}
&:after {
display: block;
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 100%;
border-bottom: 1px solid #fff;
-webkit-animation: 2.5s draw-bottom;
animation: 2.5s draw-bottom;
...