当前位置: 首页 > wzjs >正文

淘宝做网站靠谱免费网站制作平台

淘宝做网站靠谱,免费网站制作平台,wordpress多网店主题,购车网站设计【css酷炫效果】纯CSS实现粒子旋转动画 缘创作背景html结构css样式完整代码效果图 想直接拿走的老板,链接放在这里:https://download.csdn.net/download/u011561335/90492008 缘 创作随缘,不定时更新。 创作背景 刚看到csdn出活动了&…

【css酷炫效果】纯CSS实现粒子旋转动画

  • 创作背景
  • html结构
  • css样式
  • 完整代码
  • 效果图

想直接拿走的老板,链接放在这里:https://download.csdn.net/download/u011561335/90492008

创作随缘,不定时更新。

创作背景

刚看到csdn出活动了,赶时间,直接上代码。

html结构

	<div id="particle-container" class='particle-container'></div>

css样式

/* 基本样式重置 */
body, html {margin: 0;padding: 0;width: 100%;height: 100%;overflow: hidden; /* 防止滚动条出现 */background-color: #000; /* 设置背景颜色为黑色 */
}/* 粒子容器 */
.particle-container {position: relative;width: 100%;height: 100%;pointer-events: none; /* 使容器内的粒子不影响鼠标事件 */
}/* 粒子样式 */
.particle-container::before,
.particle-container::after,
.particle {content: '';position: absolute;top: 50%;left: 50%;width: 2px;height: 2px;background-color: rgba(255, 255, 255, 0.8); /* 设置粒子颜色为白色,带有一定的透明度 */border-radius: 50%;box-shadow: 0 0 10px rgba(255, 255, 255, 0.5); /* 添加一些模糊效果 */animation: particleAnimation 5s infinite ease-in-out;pointer-events: none;
}/* 使用伪元素生成一些粒子 */
.particle-container::before,
.particle-container::after {width: 4px;height: 4px;
}/* 使用大量类生成更多粒子 */
.particle:nth-child(1) { top: 5%; left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { top: 15%; left: 20%; animation-delay: 0.2s; }
.particle:nth-child(3) { top: 25%; left: 30%; animation-delay: 0.4s; }/* 粒子动画关键帧 */
@keyframes particleAnimation {0% {transform: translate(-50%, -50%) rotate(0deg);opacity: 1;}100% {transform: translate(-50%, -50%) rotate(360deg) translate(200px, -200px);opacity: 0;}
}

完整代码

<!DOCTYPE html>
<html lang="en"> 
<head><title>页面特效</title>
<style type="text/css">
/* 基本样式重置 */
body, html {margin: 0;padding: 0;width: 100%;height: 100%;overflow: hidden; /* 防止滚动条出现 */background-color: #000; /* 设置背景颜色为黑色 */
}/* 粒子容器 */
.particle-container {position: relative;width: 100%;height: 100%;pointer-events: none; /* 使容器内的粒子不影响鼠标事件 */
}/* 粒子样式 */
.particle-container::before,
.particle-container::after,
.particle {content: '';position: absolute;top: 50%;left: 50%;width: 2px;height: 2px;background-color: rgba(255, 255, 255, 0.8); /* 设置粒子颜色为白色,带有一定的透明度 */border-radius: 50%;box-shadow: 0 0 10px rgba(255, 255, 255, 0.5); /* 添加一些模糊效果 */animation: particleAnimation 5s infinite ease-in-out;pointer-events: none;
}@keyframes particleAnimation {0% {transform: translate(-50%, -50%) rotate(0deg);opacity: 1;}100% {transform: translate(-50%, -50%) rotate(360deg) translate(200px, -200px);opacity: 0;}
}</style></head>
<body><h1 style='color:red;'>斗破苍穹!</h1><div id="particle-container" class='particle-container'></div></body><script>const container = document.getElementById('particle-container');const numberOfParticles = 100;setInterval(function(){for (let i = 0; i < numberOfParticles; i++) {const particle = document.createElement('div');particle.classList.add('particle');particle.style.top = Math.random() * 95+ 'vh';particle.style.left = Math.random() * 95+ 'vw';particle.style.animationDelay = Math.random() * 5 * 0.4+`s`;particle.style.width = (Math.floor(Math.random() * 4) + 1)+`px`;particle.style.height = Math.floor(Math.random() * 4) + 1+`px`;container.appendChild(particle);}},3000);</script></html>

效果图

在这里插入图片描述

http://www.dtcms.com/wzjs/475009.html

相关文章:

  • 域名服务器有哪几种上海站群优化公司
  • 公司网站建设的成都网站制作
  • 专做女鞋的网站代发广州排名优化网站建设
  • 淘宝客如何做网站互联网营销师证书是国家认可的吗
  • 贵州城乡建设部网站推广任务发布平台app
  • wordpress 置顶 不显示企业seo网络推广
  • 什么网站流量高快优吧seo优化
  • 如何用kali做网站渗透运营培训班学费大概多少
  • 微网站开发平台案例网站排名seo培训
  • 做3d图的网站产品推广文案100字
  • 做ppt的图片素材网站网络广告投放渠道有哪些
  • 欧美浅蓝色新闻网站css模板泉州百度搜索推广
  • 深做网站公司淘宝运营培训班哪里有
  • 铜陵做网站的公司软文推广哪个平台好
  • 株洲建设局网站关键词上首页软件
  • 企业门户网站建设案例石狮seo
  • 自己做的网址危险网站2022双11各大电商平台销售数据
  • 网站个人中心wordpress三亚百度推广开户
  • 任丘网站建设指数网站
  • 北京做vr网站西安竞价托管公司
  • 凡客家具seo高级
  • wordpress mysql权限设置青岛谷歌优化公司
  • 网站空间知识谷歌seo排名公司
  • 过界女主个人做网站的免费做网站的平台
  • 1号网站建设 高端网站建设八种营销模式
  • 合肥网站制作哪家强什么软件可以找客户资源
  • 网站做视频的软件有哪些网络销售推广是做什么的具体
  • 大连哪家公司做网站好美国搜索引擎排名
  • 华为网站开发百度认证怎么认证
  • 企业网站找谁做站长之家ppt素材