The content on this website, including videos and code examples, is for educational purposes only. All demonstrations and designs are fictional and created to illustrate coding techniques. Any resemblance to existing websites or brands is purely coincidental.
The creators and administrators of this website do not claim ownership or affiliation with any existing websites or companies. Users are encouraged to use the information responsibly for learning purposes. Liability for any misuse of the content provided is not accepted.
Below is the html code for this video.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Seconds Counter</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>
Still
<div class="counter">
<span class="decor top"></span>
<span class="decor bottom"></span>
<span class="from top"><span></span><span class="shadow"></span></span>
<span class="from bottom"><span></span><span class="shadow"></span></span>
<span class="to top"><span></span><span class="shadow"></span></span>
<span class="to bottom"><span></span><span class="shadow"></span></span>
</div>
Seconds left in this Minute.
</h1>
<script src="https://code.jquery.com/jquery-3.6.1.min.js"
integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous"></script>
<script src="index.js"></script>
</body>
</html>
Below is the css code for this video.
style.css
@import url('https://fonts.googleapis.com/css2?family=Marck+Script&family=Sono&display=swap');
* {
margin: 0;
padding: 0;
}
body {
height: 100vh;
width: 100%;
background-color: #e84393;
background-image: radial-gradient(#e84393, #000000);
overflow: hidden;
}
h1 {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
text-align: center;
line-height: 200px;
font-size: 48px;
color: #ffffff;
font-family: 'Marck Script', cursive;
}
h1 .counter {
position: relative;
top: -14px;
display: inline-block;
height: 100px;
width: 160px;
font-family: 'Sono', sans-serif;
padding: 0 60px 0 20px;
perspective: 400px;
font-size: 100px;
}
h1 .counter>span {
position: absolute;
display: block;
height: 90px;
width: 100px;
background-color: #a4bfef;
background-image: linear-gradient(#a4bfef, #6a93cb);
padding: 0 50px;
overflow: hidden;
text-align: center;
backface-visibility: hidden;
transform-style: preserve-3d;
}
h1 .counter span span {
color: #ff69b4;
}
h1 .counter span.decor.top {
box-shadow: 0 48px 86px -6px #00000080;
}
h1 .counter span.decor.bottom {
box-shadow: 0 4px 0 -2px #6a93cb, 0 8px 0 -4px #a4bfef, 0 12px 0 -6px #6a93cb, 0 16px 0 -8px #a4bfef,
0 20px 0 -10px #6a93cb, 0 24px 0 -12px #a4bfef, 0 28px 0 -14px #6a93cb, 0 28px 46px -18px #000000bf;
}
h1 .counter span.top {
box-shadow: inset 0 -2px 6px #00000040;
border-radius: 6px 6px 0 0;
}
h1 .counter span.top span {
position: relative;
bottom: 10px;
}
h1 .counter span.bottom {
top: 92px;
box-shadow: inset 0 -2px 6px #00000040;
border-radius: 0 0 6px 6px;
}
h1 .counter span.bottom span {
position: relative;
top: -102px;
}
h1 .counter span.from.bottom {
z-index: 1;
transform-origin: 0% 0%;
animation: bottomFlipAnim 1s;
}
@keyframes bottomFlipAnim {
from {
transform: rotateX(180deg);
}
to {
transform: rotateX(0deg);
}
}
h1 .counter span.to.top {
z-index: 1;
transform-origin: 100% 100%;
animation: topFlipAnim 1s;
}
@keyframes topFlipAnim {
from {
transform: rotateX(0deg);
}
to {
transform: rotateX(180deg);
}
}
.counter .shadow {
display: block;
top: -200px !important;
left: -50px;
height: 90px;
width: 240px;
overflow: hidden;
z-index: 0;
opacity: 0;
}
.counter .top .shadow {
background-color: transparent;
background-image: linear-gradient(transparent, #00000040);
}
.counter .bottom .shadow {
background-color: #00000080;
background-image: linear-gradient(#00000080, transparent);
}
.counter .from.top .shadow {
animation: fadeOutAnim 1s;
}
@keyframes fadeOutAnim {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
.counter .to.bottom .shadow {
animation: fadeInAnim 1s;
}
@keyframes fadeInAnim {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.hide .shadow {
animation: none !important;
}
@media screen and (-webkit-min-device-pixel-ratio:0) {
h1 .counter span span {
color: #00000000;
background: linear-gradient(#b91372, #6b0f1a);
-webkit-background-clip: text;
-webkit-text-stroke: 4px #b91372;
}
}
Below is the javascript code for this video.
index.js
function getSeconds(next) {
var d = new Date();
var second = 60 - d.getSeconds();
if (next) {
second--;
if (second < 0) {
second = 59;
}
} else if (second == 60) {
second = 0;
}
return (second < 10 ? '0' + second : second);
}
function calculateSeconds() {
$('.counter .to').addClass('hide').removeClass('to').addClass('from').removeClass('hide').addClass('n').find('span:not(.shadow)')
.each(function (i, el) { $(el).text(getSeconds(true)); });
$('.counter .from:not(.n)').addClass('hide').addClass('to').removeClass('from').removeClass('hide').find('span:not(.shadow)')
.each(function (i, el) { $(el).text(getSeconds(false)); });
$('.counter .n').removeClass('n');
}
calculateSeconds();
setInterval(calculateSeconds, 1000);
Thanks for visiting