在您的网站上添加疯狂光标点击效果..
点击看魔法!
Github
预览
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Happy Diwali - Bomb Blast Animation</title> <link rel="stylesheet" href="styles.css"> </head> <body> <div> <p><strong>CSS</strong><br> </p> <pre class="brush:php;toolbar:false">* { margin: 0; padding: 0; box-sizing: border-box; } body { background: linear-gradient(to bottom, #2c3e50, #4ca1af); height: 100vh; overflow: hidden; color: white; font-family: 'Arial', sans-serif; } .container { position: relative; width: 100%; height: 100%; } .container { position: relative; text-align: center; /* Center text */ font-size: 2em; /* Increase font size */ font-weight: bold; /* Make text bold */ color: #ffcc00; /* Text color */ text-shadow: 2px 2px 10px rgba(255, 255, 0, 0.8); /* Add shadow for effect */ } .bomb { position: absolute; width: 20px; height: 20px; background: #ffcc00; border-radius: 50%; animation: pulse 0.4s forwards; } .light { position: absolute; border-radius: 50%; animation: lightSpread 1s forwards; opacity: 0; } @keyframes pulse { 0% { transform: scale(1); } 100% { transform: scale(1.5); opacity: 0; } } @keyframes lightSpread { 0% { transform: scale(0); opacity: 1; } 100% { transform: scale(4); opacity: 0; } }
登录后复制
JavaScript
document.addEventListener('DOMContentLoaded', () => { const container = document.getElementById('container'); container.addEventListener('click', (e) => { // Create the bomb element const bomb = document.createElement('div'); bomb.className = 'bomb'; bomb.style.left = e.clientX + 'px'; bomb.style.top = e.clientY + 'px'; container.appendChild(bomb); // Create light effects for (let i = 0; i < 10; i++) { const light = document.createElement('div'); light.className = 'light'; light.style.left = e.clientX + 'px'; light.style.top = e.clientY + 'px'; light.style.background = `hsl(${Math.random() * 360}, 100%, 50%)`; light.style.width = Math.random() * 20 + 10 + 'px'; // Random width light.style.height = light.style.width; // Keep it circular // Set a random angle and distance for spreading lights const angle = Math.random() * 2 * Math.PI; // Random angle const distance = Math.random() * 200 + 50; // Random distance light.style.transform = `translate(${Math.cos(angle) * distance}px, ${Math.sin(angle) * distance}px)`; container.appendChild(light); // Remove the light effect after animation setTimeout(() => { light.remove(); }, 1000); } // Remove the bomb after animation setTimeout(() => { bomb.remove(); }, 400); }); });
登录后复制
以上是在您的网站上添加疯狂光标点击效果..的详细内容。更多信息请关注PHP中文网其他相关文章!
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章
如何修复KB5055523无法在Windows 11中安装?
3 周前
By DDD
如何修复KB5055518无法在Windows 10中安装?
3 周前
By DDD
<🎜>:死铁路 - 如何驯服狼
4 周前
By DDD
R.E.P.O.的每个敌人和怪物的力量水平
4 周前
By 尊渡假赌尊渡假赌尊渡假赌
<🎜>:种植花园 - 完整的突变指南
2 周前
By DDD

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

您是否曾经在项目上需要一个倒计时计时器?对于这样的东西,可以自然访问插件,但实际上更多

在元素个数不固定的情况下如何通过CSS选择第一个指定类名的子元素在处理HTML结构时,常常会遇到元素个数不�...

关于Flex布局中紫色斜线区域的疑问在使用Flex布局时,你可能会遇到一些令人困惑的现象,比如在开发者工具(d...

格子呢是一块图案布,通常与苏格兰有关,尤其是他们时尚的苏格兰语。在Tartanify.com上,我们收集了5,000多个格子呢
