HTML
<link rel="stylesheet" href="milinn-style-css.css" type="text/css" />
</head>
<body>
<p align="center">HaYeF N 101 KuwaiT
<div id='sparkler'></div></p>
<script async src="milinn-js.js"></script>
</body>
</html>
CSS
html {
cursor: none;
font-family: system-ui;
display: grid;
place-items: center;
min-height: 100vh;
user-select: none;
}
body {
background: black;
overflow: hidden;
color: white;
--color-spark: peru;
}
#sparkler {
position: absolute;
left: 50%;
top: 50%;
width: 1px;
height: 1px;
transform: rotate(-25deg);
border-radius: 50%;
box-shadow: 0 0 2500px 100px var(--color-spark);
}
#sparkler:before {
content: '';
width: 10px;
height: 25vh;
background: linear-gradient(to right, dimgray, silver);
position: absolute;
top: 0;
left: 0;
border-radius: 1rem;
}
#sparkler:after {
content: '';
width: 4px;
height: 25vh;
background: linear-gradient(to right, dimgray, gray);
position: absolute;
top: calc(25vh - 1px);
left: 3px;
/* border-radius: 1rem; */
}
.particle {
height: 5px;
border-radius: 50%;
background: linear-gradient(to right, transparent, var(--color-spark), white, var(--color-spark), transparent);
box-shadow: 0 0 30px var(--color-spark);
position: absolute;
transition: .5s linear;
z-index: 100;
}
JS
const div = document.querySelector('#sparkler')
function sparkle() {
var p = document.createElement('div')
p.className = 'particle'
p.style.left = div.getBoundingClientRect().x + 'px'
p.style.top = div.getBoundingClientRect().y + 'px'
let w = (Math.floor(Math.random() * 30)) + 20
p.style.width = w + 'vh'
p.style.transform = 'translateX('+((-1)*(w*.475))+'vh) rotate('+Math.random()*360+'deg)'
document.body.appendChild(p)
setTimeout(function(){
let pp = document.querySelectorAll('.particle')[0]
pp.remove()
}, 256)
}
let shiny = setInterval(sparkle, 16)
window.addEventListener('click', function() {
let c = 'hsl('+Math.random()*360+'deg, 100%, 50%)'
document.body.style.setProperty('--color-spark', c)
})
window.addEventListener('mousemove', function(e){
let x = e.clientX,
y = e.clientY
div.style.left = x + 'px'
div.style.top = y + 'px'
})
وسلامتكم
ليست هناك تعليقات: