使用 HTML CSS 和 JAVASCRIPT 的黑洞动画

news/2025/3/15 18:06:51/

使用 HTML CSS 和 JAVASCRIPT 的黑洞动画

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Black Hole Animation</title><style>body {margin: 0;overflow: hidden;background: radial-gradient(ellipse at center, black, #1a1a1a);height: 100vh;display: flex;justify-content: center;align-items: center;}.black-hole-container {position: relative;width: 300px;height: 300px;}.black-hole {position: absolute;bottom: 20px;left: 50%;width: 200px;height: 200px;background: black;border-radius: 50%;border: 10px solid transparent;/* background-image: conic-gradient(pink 0% 33%, purple 33% 66%, blue 66% 100%); */box-shadow: 0 0 20px 5px pink,0 0 40px 10px purple,0 0 60px 15px blue;animation: neon-glow 3s infinite ease-in-out;transform: translateX(-50%);}.purple-shadow {position: absolute;top: 30px;left: 50%;width: 450px;height: 450px;background: radial-gradient(circle, rgba(128, 0, 128, 0.2), transparent 70%);border-radius: 50%;transform: translate(-50%);animation: wave-color-motion 5s infinite ease-in-out;}.stars {position: absolute;width: 100%;height: 100%;z-index: -1;}.star {position: absolute;width: 4px;height: 4px;background: purple;border-radius: 50%;animation: twinkle 3s infinite ease-in-out;}/* Animations */@keyframes neon-glow {0%, 100% {box-shadow: 0 0 20px 5px pink,0 0 40px 10px purple,0 0 60px 15px blue;}50% {box-shadow: 0 0 30px 10px pink,0 0 50px 15px purple,0 0 70px 20px blue;}}@keyframes wave-color-motion {0% {transform: translate(-50%) scale(1);background: radial-gradient(circle, rgba(59, 3, 59, 0.2), transparent 70%);}25% {transform: translate(-50%) scale(1.1);background: radial-gradient(circle, rgba(170, 0, 170, 0.4), transparent 70%);}50% {transform: translate(-50%) scale(1.2);background: radial-gradient(circle, rgba(200, 0, 200, 0.6), transparent 70%);}75% {transform: translate(-50%) scale(1.1);background: radial-gradient(circle, rgba(170, 0, 170, 0.4), transparent 70%);}100% {transform: translate(-50%) scale(1);background: radial-gradient(circle, rgba(128, 0, 128, 0.2), transparent 70%);}}@keyframes twinkle {0%, 100% {opacity: 1;}50% {opacity: 0.2;}}</style>
</head>
<body><div class="black-hole-container"><div class="purple-shadow"></div><div class="black-hole"></div></div><div class="stars"></div><script>const starsContainer = document.querySelector('.stars');// Generate random starsfor (let i = 0; i < 200; i++) {const star = document.createElement('div');star.classList.add('star');star.style.left = `${Math.random() * 100}vw`;star.style.top = `${Math.random() * 100}vh`;star.style.animationDelay = `${Math.random() * 5}s`;starsContainer.appendChild(star);}</script>
</body>
</html>

http://www.ppmy.cn/news/1573073.html

相关文章

记录阿里云CDN配置

网站接入CDN全流程&#xff0c;共4步&#xff01;-阿里云开发者社区 1、开通阿里云CDN服务 2、添加加速域名 3、验证域名归属权 4、域名添加CDN生成的CNAME解析 按照官网描述增加。细节点&#xff1a; 1. 域名和泛域名区别 2.开启https,要用nginx的证书&#xff0c;和项…

Win11配置wsl、ubuntu、docker

系统要求 安装WSL。 开通虚拟化&#xff1a; 准备工作 dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestartdism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestartwsl --set-default-versi…

俄罗斯方块游戏完整代码示例

以下是一个基于Cocos Creator引擎开发的俄罗斯方块游戏的完整代码示例。该游戏实现了俄罗斯方块的基本功能&#xff0c;并且代码整合在单个文件中&#xff0c;无需任何外部依赖&#xff0c;可以直接在浏览器中运行。 1. 创建Cocos Creator项目 首先&#xff0c;确保你已经安装了…

前端面试手写--虚拟列表

目录 一.问题背景 二.代码讲解 三.代码改装 四.代码发布 今天我们来学习如何手写一个虚拟列表,本文将把虚拟列表进行拆分并讲解,然后发布到npm网站上. 一.问题背景 为什么需要虚拟列表呢?这是因为在面对大量数据的时候,我们的浏览器会将所有数据都渲染到表格上面,但是渲…

利用SkinMagic美化MFC应用界面

MFC(Microsoft Foundation Class)应用程序的界面设计风格通常比较保守,而且虽然MFC框架的控件功能强大且易于集成,但视觉效果较为朴素,缺乏现代感。尤其是MFC应用程序的设计往往以功能实现为核心,界面设计可能显得较为简洁甚至略显呆板,用户体验可能不如现代应用程序流畅…

MapStruct 中 @BeforeMapping 和 @AfterMapping 注解的使用详解

在使用 MapStruct 进行对象映射时&#xff0c;BeforeMapping和AfterMapping这两个注解能让开发者在映射前后执行自定义逻辑&#xff0c;极大地增强了映射的灵活性&#xff0c;满足多样化的业务需求。 一、BeforeMapping 注解 1.1 作用 BeforeMapping用于在映射方法执行前进行…

如何将模型长度扩展到100万:Llama 3的NTK-aware插值技术解析 小学生都懂的

好的&#xff0c;以下是对 Llama 3 如何通过 NTK-aware 插值 调整位置编码以扩展上下文长度到 100 万的详细原理解释&#xff1a; 1. RoPE&#xff08;旋转位置编码&#xff09;的原理 RoPE 是一种用于 Transformer 模型的位置编码方法&#xff0c;它通过旋转向量来注入位置信…

Golang 语言的内存管理

转载&#xff1a;Golang 语言的内存管理 内存分布 什么是虚拟内存&#xff1f; 计算机系统内存管理的一种技术。 每个进程都拥有独立的、连续的、统一的的虚拟地址空间。 通过 MMU 和物理内存映射&#xff0c;高效使用物理内存。 64 位 linux 进程内存分布情况 理论上有 16E 的…