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

纯css星空动画

让大家实现一个这样的星空动画效果,大家会怎么做? js,不! 其实使用css就能写
请添加图片描述
我也不藏着掖着,源码直接放下面了

	<script setup></script><template><div class="box"><div v-for="i in 5" :key="i" :class="'layer' + i"></div></div></template><style scoped lang="scss">@use "sass:math";$size: 20px;$duration: 800s;$count: 1300;.box {height: 100vh;width: 100vw;background: black;}.title {background-clip: text;color: transparent;}@function getShadows($n) {$shadows: "#{random(100)}vw #{random(100)}vh #fff";@for $i from 2 through $n {$shadows: "#{$shadows}, #{random(100)}vw #{random(100)}vh #fff";}@return unquote($shadows);}@for $i from 1 through 5 {$duration: math.div($duration, 2);$count: floor(math.div($count, 2));.layer#{$i} {$size: #{$i}px;position: fixed;width: $size;height: $size;border-radius: 50%;left: 0;top: 0;box-shadow: getShadows($count);animation: moveUp $duration linear infinite;&::after {content: "";position: fixed;left: 0;top: 100vh;border-radius: inherit;width: inherit;height: inherit;box-shadow: inherit;}}}@keyframes moveUp {to {transform: translateY(-100vh);}}
</style> 
http://www.lryc.cn/news/382325.html

相关文章:

  • 使用Apache Flink实现实时数据同步与清洗:MySQL和Oracle到目标MySQL的ETL流程
  • postman教程-22-Newman结合Jenkins执行自动化测试
  • uniapp实现tabBar功能常见的方法
  • 智慧在线医疗在线诊疗APP患者端+医生端音视频诊疗并开处方
  • 攻防平台搭建与简易渗透工具箱编写
  • SQL EXISTS 关键字的使用与理解
  • 开源低代码平台,JeecgBoot v3.7.0 里程碑版本发布
  • 名侦探李先生第一话:谁是真正的凶手(只出现一次的数字相关题解(力扣)+位操作符回忆)
  • 【PA交易】BackTrader(一): 如何使用实时tick数据和蜡烛图
  • HTML(16)——边距问题
  • 【Godot4自学手册】第四十二节实现拖拽进行物品交换和数量叠加
  • 存储系统概述
  • Trilium windows上修改笔记目录,创建多个笔记空间方法
  • <Rust><iced>在iced中显示gif动态图片的一种方法
  • 【Unity设计模式】状态编程模式
  • 圆的面积并三角形面积并
  • Spring Data JPA介绍与CRUD实战演练
  • Python网络爬虫实战6—下一页,模拟用户点击,切换窗口
  • Notepad++插件 Hex-Edit
  • Matlab要这样批量读取txt数据!科研效率UpUp第10期
  • buuctf----firmware
  • ssl证书90天过期?保姆级教程——使用acme.sh实现证书的自动续期
  • 由于bug造成truncate table卡住问题
  • Charles抓包工具系列文章(二)-- Repeat 回放http请求
  • jemeter基本使用
  • 【Golang】Steam 创意工坊 Mod 文件夹批量重命名
  • 求职刷题力扣DAY33--贪心算法part04
  • aws的eks(k8s)ingress+elb部署实践
  • 大数据面试题之YARN
  • 最小生成树模板(prim,heap-prim,kruskal)