【CSS】How to implement the opening animation that applies the effect of turning on a CRT TV when accessing the page using @keyframes to the full window size(Demo page)
※Please check using Developer tools
Dummy Text Dummy Text Dummy Text Dummy Text
CSS
body {
background: #000;
}
.content {
overflow: hidden;
background: #fff;
}
.wrap p {
text-align: center;
margin: 0 auto;
padding: 150px 0 0;
}
.show {
background: #000;
}
.show .content {
position: fixed;
top: 50%;
left: 50%;
width: 100%;
height: 100%;
overflow: hidden;
transform: translate3d(-50%, -50%, 0) scale(1, 0);
backface-visibility: hidden;
animation: show-anime 0.2s;
animation-fill-mode: forwards;
animation-delay: 0.3s;
}
@keyframes show-anime {
0% {
transform: translate3d(-50%, -50%, 0) scale(1, 0);
}
1% {
transform: translate3d(-50%, -50%, 0) scale(1, 0.001);
}
10% {
transform: translate3d(-50%, -50%, 0) scale(1, 0.001);
}
35% {
transform: translate3d(-50%, -50%, 0) scale(0.5, 0.003);
}
100% {
transform: translate3d(-50%, -50%, 0) scale(1, 1);
}
}
@media screen and (max-width:640px){
.wrap p {
text-align: left;
}
}
JavaScript
$(window).on('load', function(){
$("body").addClass("show");
setTimeout(function(){
$("body").removeClass("show");
},1000);
});