Splitting | Html Css And JavaScript

HTML
<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
  <title>CodeAtNow - Splitting Demo</title>
  <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Black+Han+Sans&display=swap" rel="stylesheet"><link rel='stylesheet' href='https://unpkg.com/splitting/dist/splitting.css'>
<link rel='stylesheet' href='https://unpkg.com/splitting/dist/splitting-cells.css'><link rel="stylesheet" href="./style.css">

</head>
<body>

<div class="circle" data-splitting>CodeAtNow Like Share And Follow </div>
<img class="globe" src="https://purepng.com/public/uploads/large/purepng.com-earthearthplanetglobethird-planet-from-the-sun-1411526987961jvz5u.png"/>
<!-- partial -->
  <script src='https://unpkg.com/splitting/dist/splitting.min.js'></script><script  src="./script.js"></script>

</body>
</html>
CSS
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: monospace;
}

@import url('https://fonts.googleapis.com/css2?family=Black+Han+Sans&display=swap');

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: black;
	transform-style: preserve-3d;
	font-family: 'Black Han Sans', sans-serif;
	
}

body:after {
	content: "";
	background: url('https://i0.wp.com/texturefabrik.com/wp-content/uploads/2020/09/texturefabrik-photocopy_5_06.jpg');
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	width: 100%;
	height: 100%;
	z-index: 2;
	mix-blend-mode: screen;
	opacity: 0.4;
}


.circle {
    transform-style: preserve-3d;
    animation: animate 8s linear infinite;
    --deg: calc(360deg / var(--numchs));
	z-index: 1
}

@keyframes animate {
    0% {
        transform: perspective(1000px) rotateY(360deg) rotateX(15deg);
    }

    100% {
        transform: perspective(1000px) rotateY(0deg) rotateX(15deg);
    }
}

.circle .char {
    position: absolute;
    top: 0;
    left: 0;
    color: white;
    font-size: 4em;
		text-transform: uppercase;
    padding: 5px 12px;
    transform-style: preserve-3d;
    transform-origin: center;
        transform: rotateY(calc(var(--char-index) * var(--deg))) translateZ(250px);
font-family: 'Black Han Sans', sans-serif;

}

.globe {
	position: absolute;
	width: 300px;
	height: 300px;
	z-index: 0;
	filter: grayscale(1);
	
}
JS
const circle = document.querySelector('.circle');
        const text = circle.innerHTML;// Note I am being lazy here and assuming the string has no unwanted whitespace
        circle.innerHTML = '';        
        circle.style.setProperty('--numchs', text.length);
        for ( let i = 0; i < text.length; i++ ) {
          circle.innerHTML = circle.innerHTML + '<div class="char" style="--char-index: ' + i + ';">' + text.charAt(i) + '</div>';
        }

Follow Us On Telegram  

Get Full Source Code Zipped File  

Telegram link

Post a Comment

0Comments
Post a Comment (0)