位置: IT常识 - 正文

学习CSS3,模拟春雪漫天飘的动画效果(css3的模块结构和应用)

编辑:rootadmin
学习CSS3,模拟春雪漫天飘的动画效果

推荐整理分享学习CSS3,模拟春雪漫天飘的动画效果(css3的模块结构和应用),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:css3的模块结构和应用,html模拟,css3技术简介,css3的模块结构和应用,html模拟,css3模板,css 模拟器,css 模拟器,内容如对您有帮助,希望把文章链接给更多的朋友!

清明时节雨纷纷,但有些地方却下起了大雪,今天我们就用所学的CSS3知识,模拟一下夜晚漫天飘雪的场景吧。

目录

1. 实现思路

2. 部分HTML代码 

3. 夜空的背景 

4. 雪花的样式 

5. 粒子飞升效果 

6. HTML完整源代码 

7. CSS3完整源代码

8.  最后 


1. 实现思路DIV布局的使用整体背景radial-gradient属性的使用夜空rotate属性的使用雪花radial-gradient属性的使用雪花移动动画animation属性的使用雪花移动过程中translate3d属性的使用2. 部分HTML代码 学习CSS3,模拟春雪漫天飘的动画效果(css3的模块结构和应用)

因为雪花的元素是相同的,只是移动的起点,移动过程,移动的终点不同,所以HTML元素大致相同,这里我们就不把所有的元素都粘贴过来了,稍后会粘贴出所有源代码,你可以拿到源代码放到自己的网页里,即可看到漫天飘雪的场景啦。

<div class="container"> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> ...... <!-- 此处重复此处越多,效果越好 --></div>3. 夜空的背景 

夜空为了绚烂一些,肯定不是能是纯黑色,需要做一定的过渡效果,雪花飘落才会更完美,这里用到了background-image: radial-gradient  等CSS属性

body { background-image: radial-gradient(#021027, #000000);}.container { width: 100%; height: 100%; overflow: hidden; transform: rotate(180deg);}4. 雪花的样式 

雪花虽然HTML元素相同,但表现形式却不同。他有自己的大小,明暗,移动轨迹,等等,越随机,才能越表现的真实而完美

.circle-container .circle { width: 100%; height: 100%; border-radius: 50%; mix-blend-mode: screen; background-image: radial-gradient(#99ffff, #99ffff 10%, rgba(153, 255, 255, 0) 56%); -webkit-animation: fadein-frames 200ms infinite, scale-frames 2s infinite; animation: fadein-frames 200ms infinite, scale-frames 2s infinite;}@-webkit-keyframes scale-frames { 0% { -webkit-transform: scale3d(0.4, 0.4, 1); transform: scale3d(0.4, 0.4, 1); } 50% { -webkit-transform: scale3d(2.2, 2.2, 1); transform: scale3d(2.2, 2.2, 1); } 100% { -webkit-transform: scale3d(0.4, 0.4, 1); transform: scale3d(0.4, 0.4, 1); }}

5. 粒子飞升效果 

可能在第3步,大家看到了 transform: rotate(180deg); 的代码设置,这是做了另外的考虑。满天飞雪的场景,其实如果旋转屏幕,可以做为那种地面上有某种粒子,逐渐向上飞升的效果,也是非常棒的。喜欢的小伙伴可以试一下。

6. HTML完整源代码 

下面把完整源代码放出来,需要的小伙伴可以直接COPY过去,放到自己网页上就可以看到满天飞雪的效果啦

<!DOCTYPE html><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>漫天飘雪</title><link rel="stylesheet" href="./style.css"></head><body><div class="container"> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div> <div class="circle-container"> <div class="circle"></div> </div></div></body></html>7. CSS3完整源代码html,body { width: 100%; height: 100%; padding:0;margin:0;}body { background-image: radial-gradient(#021027, #000000);}.container { width: 100%; height: 100%; overflow: hidden; transform: rotate(180deg);}.circle-container { position: absolute; -webkit-transform: translateY(-10vh); transform: translateY(-10vh); -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; -webkit-animation-timing-function: linear; animation-timing-function: linear;}.circle-container .circle { width: 100%; height: 100%; border-radius: 50%; mix-blend-mode: screen; background-image: radial-gradient(#99ffff, #99ffff 10%, rgba(153, 255, 255, 0) 56%); -webkit-animation: fadein-frames 200ms infinite, scale-frames 2s infinite; animation: fadein-frames 200ms infinite, scale-frames 2s infinite;}@-webkit-keyframes scale-frames { 0% { -webkit-transform: scale3d(0.4, 0.4, 1); transform: scale3d(0.4, 0.4, 1); } 50% { -webkit-transform: scale3d(2.2, 2.2, 1); transform: scale3d(2.2, 2.2, 1); } 100% { -webkit-transform: scale3d(0.4, 0.4, 1); transform: scale3d(0.4, 0.4, 1); }}@keyframes scale-frames { 0% { -webkit-transform: scale3d(0.4, 0.4, 1); transform: scale3d(0.4, 0.4, 1); } 50% { -webkit-transform: scale3d(2.2, 2.2, 1); transform: scale3d(2.2, 2.2, 1); } 100% { -webkit-transform: scale3d(0.4, 0.4, 1); transform: scale3d(0.4, 0.4, 1); }}.circle-container:nth-child(1) { width: 10px; height: 10px; -webkit-animation-name: move-frames-1; animation-name: move-frames-1; -webkit-animation-duration: 8441ms; animation-duration: 8441ms; -webkit-animation-delay: 4544ms; animation-delay: 4544ms;}@-webkit-keyframes move-frames-1 { from { -webkit-transform: translate3d(50vw, 102vh, 0); transform: translate3d(50vw, 102vh, 0); } to { -webkit-transform: translate3d(2vw, -117vh, 0); transform: translate3d(2vw, -117vh, 0); }}@keyframes move-frames-1 { from { -webkit-transform: translate3d(50vw, 102vh, 0); transform: translate3d(50vw, 102vh, 0); } to { -webkit-transform: translate3d(2vw, -117vh, 0); transform: translate3d(2vw, -117vh, 0); }}.circle-container:nth-child(1) .circle { -webkit-animation-delay: 3734ms; animation-delay: 3734ms;}.circle-container:nth-child(2) { width: 10px; height: 10px; -webkit-animation-name: move-frames-2; animation-name: move-frames-2; -webkit-animation-duration: 9921ms; animation-duration: 9921ms; -webkit-animation-delay: 5982ms; animation-delay: 5982ms;}@-webkit-keyframes move-frames-2 { from { -webkit-transform: translate3d(89vw, 108vh, 0); transform: translate3d(89vw, 108vh, 0); } to { -webkit-transform: translate3d(72vw, -123vh, 0); transform: translate3d(72vw, -123vh, 0); }}@keyframes move-frames-2 { from { -webkit-transform: translate3d(89vw, 108vh, 0); transform: translate3d(89vw, 108vh, 0); } to { -webkit-transform: translate3d(72vw, -123vh, 0); transform: translate3d(72vw, -123vh, 0); }}.circle-container:nth-child(2) .circle { -webkit-animation-delay: 2516ms; animation-delay: 2516ms;}.circle-container:nth-child(3) { width: 3px; height: 3px; -webkit-animation-name: move-frames-3; animation-name: move-frames-3; -webkit-animation-duration: 10427ms; animation-duration: 10427ms; -webkit-animation-delay: 3649ms; animation-delay: 3649ms;}@-webkit-keyframes move-frames-3 { from { -webkit-transform: translate3d(85vw, 107vh, 0); transform: translate3d(85vw, 107vh, 0); } to { -webkit-transform: translate3d(30vw, -133vh, 0); transform: translate3d(30vw, -133vh, 0); }}@keyframes move-frames-3 { from { -webkit-transform: translate3d(85vw, 107vh, 0); transform: translate3d(85vw, 107vh, 0); } to { -webkit-transform: translate3d(30vw, -133vh, 0); transform: translate3d(30vw, -133vh, 0); }}.circle-container:nth-child(3) .circle { -webkit-animation-delay: 731ms; animation-delay: 731ms;}.circle-container:nth-child(4) { width: 6px; height: 6px; -webkit-animation-name: move-frames-4; animation-name: move-frames-4; -webkit-animation-duration: 10951ms; animation-duration: 10951ms; -webkit-animation-delay: 8909ms; animation-delay: 8909ms;}@-webkit-keyframes move-frames-4 { from { -webkit-transform: translate3d(50vw, 104vh, 0); transform: translate3d(50vw, 104vh, 0); } to { -webkit-transform: translate3d(74vw, -122vh, 0); transform: translate3d(74vw, -122vh, 0); }}@keyframes move-frames-4 { from { -webkit-transform: translate3d(50vw, 104vh, 0); transform: translate3d(50vw, 104vh, 0); } to { -webkit-transform: translate3d(74vw, -122vh, 0); transform: translate3d(74vw, -122vh, 0); }}.circle-container:nth-child(4) .circle { -webkit-animation-delay: 2526ms; animation-delay: 2526ms;}.circle-container:nth-child(5) { width: 5px; height: 5px; -webkit-animation-name: move-frames-5; animation-name: move-frames-5; -webkit-animation-duration: 7642ms; animation-duration: 7642ms; -webkit-animation-delay: 2502ms; animation-delay: 2502ms;}@-webkit-keyframes move-frames-5 { from { -webkit-transform: translate3d(9vw, 108vh, 0); transform: translate3d(9vw, 108vh, 0); } to { -webkit-transform: translate3d(39vw, -126vh, 0); transform: translate3d(39vw, -126vh, 0); }}@keyframes move-frames-5 { from { -webkit-transform: translate3d(9vw, 108vh, 0); transform: translate3d(9vw, 108vh, 0); } to { -webkit-transform: translate3d(39vw, -126vh, 0); transform: translate3d(39vw, -126vh, 0); }}.circle-container:nth-child(5) .circle { -webkit-animation-delay: 2755ms; animation-delay: 2755ms;}.circle-container:nth-child(6) { width: 6px; height: 6px; -webkit-animation-name: move-frames-6; animation-name: move-frames-6; -webkit-animation-duration: 8439ms; animation-duration: 8439ms; -webkit-animation-delay: 455ms; animation-delay: 455ms;}@-webkit-keyframes move-frames-6 { from { -webkit-transform: translate3d(29vw, 101vh, 0); transform: translate3d(29vw, 101vh, 0); } to { -webkit-transform: translate3d(21vw, -109vh, 0); transform: translate3d(21vw, -109vh, 0); }}@keyframes move-frames-6 { from { -webkit-transform: translate3d(29vw, 101vh, 0); transform: translate3d(29vw, 101vh, 0); } to { -webkit-transform: translate3d(21vw, -109vh, 0); transform: translate3d(21vw, -109vh, 0); }}.circle-container:nth-child(6) .circle { -webkit-animation-delay: 3506ms; animation-delay: 3506ms;}.circle-container:nth-child(7) { width: 8px; height: 8px; -webkit-animation-name: move-frames-7; animation-name: move-frames-7; -webkit-animation-duration: 7539ms; animation-duration: 7539ms; -webkit-animation-delay: 3595ms; animation-delay: 3595ms;}@-webkit-keyframes move-frames-7 { from { -webkit-transform: translate3d(11vw, 101vh, 0); transform: translate3d(11vw, 101vh, 0); } to { -webkit-transform: translate3d(31vw, -125vh, 0); transform: translate3d(31vw, -125vh, 0); }}@keyframes move-frames-7 { from { -webkit-transform: translate3d(11vw, 101vh, 0); transform: translate3d(11vw, 101vh, 0); } to { -webkit-transform: translate3d(31vw, -125vh, 0); transform: translate3d(31vw, -125vh, 0); }}.circle-container:nth-child(7) .circle { -webkit-animation-delay: 749ms; animation-delay: 749ms;}.circle-container:nth-child(8) { width: 4px; height: 4px; -webkit-animation-name: move-frames-8; animation-name: move-frames-8; -webkit-animation-duration: 7480ms; animation-duration: 7480ms; -webkit-animation-delay: 2680ms; animation-delay: 2680ms;}@-webkit-keyframes move-frames-8 { from { -webkit-transform: translate3d(15vw, 101vh, 0); transform: translate3d(15vw, 101vh, 0); } to { -webkit-transform: translate3d(88vw, -111vh, 0); transform: translate3d(88vw, -111vh, 0); }}@keyframes move-frames-8 { from { -webkit-transform: translate3d(15vw, 101vh, 0); transform: translate3d(15vw, 101vh, 0); } to { -webkit-transform: translate3d(88vw, -111vh, 0); transform: translate3d(88vw, -111vh, 0); }}.circle-container:nth-child(8) .circle { -webkit-animation-delay: 1888ms; animation-delay: 1888ms;}.circle-container:nth-child(9) { width: 2px; height: 2px; -webkit-animation-name: move-frames-9; animation-name: move-frames-9; -webkit-animation-duration: 9087ms; animation-duration: 9087ms; -webkit-animation-delay: 9461ms; animation-delay: 9461ms;}@-webkit-keyframes move-frames-9 { from { -webkit-transform: translate3d(100vw, 107vh, 0); transform: translate3d(100vw, 107vh, 0); } to { -webkit-transform: translate3d(40vw, -130vh, 0); transform: translate3d(40vw, -130vh, 0); }}@keyframes move-frames-9 { from { -webkit-transform: translate3d(100vw, 107vh, 0); transform: translate3d(100vw, 107vh, 0); } to { -webkit-transform: translate3d(40vw, -130vh, 0); transform: translate3d(40vw, -130vh, 0); }}.circle-container:nth-child(9) .circle { -webkit-animation-delay: 1721ms; animation-delay: 1721ms;}.circle-container:nth-child(10) { width: 8px; height: 8px; -webkit-animation-name: move-frames-10; animation-name: move-frames-10; -webkit-animation-duration: 9860ms; animation-duration: 9860ms; -webkit-animation-delay: 8969ms; animation-delay: 8969ms;}@-webkit-keyframes move-frames-10 { from { -webkit-transform: translate3d(74vw, 110vh, 0); transform: translate3d(74vw, 110vh, 0); } to { -webkit-transform: translate3d(30vw, -127vh, 0); transform: translate3d(30vw, -127vh, 0); }}@keyframes move-frames-10 { from { -webkit-transform: translate3d(74vw, 110vh, 0); transform: translate3d(74vw, 110vh, 0); } to { -webkit-transform: translate3d(30vw, -127vh, 0); transform: translate3d(30vw, -127vh, 0); }}.circle-container:nth-child(10) .circle { -webkit-animation-delay: 1801ms; animation-delay: 1801ms;}.circle-container:nth-child(11) { width: 1px; height: 1px; -webkit-animation-name: move-frames-11; animation-name: move-frames-11; -webkit-animation-duration: 9292ms; animation-duration: 9292ms; -webkit-animation-delay: 9812ms; animation-delay: 9812ms;}8.  最后 

最后呢,祝大家2023年心想事成

【手把手、从零到一】SpringBoot+SpringCloud+Vue前后端分离实战项目,专栏持续火热更新中。。。主流技术,细节到位,前后端由两位【十年多】的高级架构师操刀作为毕设项目、入门项目、或者准备进阶提升竞争力的小伙伴,可以【订阅本专栏】哦前端部分 :https://blog.csdn.net/xingyu_qie/category_12222258.html服务端部分 :https://blog.csdn.net/scm_2008/category_12236048.html粉丝福利:订阅的粉丝可加微信,对文章的内容进行【一对一指导】!
本文链接地址:https://www.jiuchutong.com/zhishi/300268.html 转载请保留说明!

上一篇:关基系统防SSL证书断供,知道创宇“包办式”国密改造方案省心又安全

下一篇:JS实现数组去重的八种方法(实用)(js 数组去重的四种方法)

  • 递延所得税资产怎么计算
  • 小规模纳税人收入是含税还是不含税
  • 以前年度损益调整结转到哪里
  • 联营企业子公司抵消比例
  • 水利建设基金计算
  • 购置成本和订货成本是实际发生的吗
  • 已认证的进项税发票要退回,怎么操作
  • 结转应收票据是什么意思
  • 收入转本年利润的会计分录
  • 网上支付的三种类型
  • 如何网上认证发票流程
  • 国有企业出租房屋管理规定
  • 重庆个人住房房产税申报
  • 房屋租赁合同如何办理
  • 产生个人所得税之后是不是不能公益性岗位
  • 出纳如何审核报销发票
  • 海关进口增值税计入什么科目
  • 三个点的专票要交多少税
  • 电脑检测不到税控盘原因
  • 用友软件怎么反记账凭证
  • 库存商品淘汰报告模板
  • 防火墙老是弹出来怎么弄
  • 年折旧率怎么计算折旧几年
  • 如何查询苹果手机充电次数
  • 网银年费如何做账
  • win7右键设置方法
  • linuxssh免密登录
  • Windows 2003 SP2 简体中文版下载地址
  • php的总结
  • 补充医疗税前扣除还是税后扣除
  • 收到预付款计入什么科目
  • vue的安装命令
  • 班夫国家公园最佳旅游时间
  • 待抵扣进项税额借贷方向
  • PHP/HTML混写的四种方式总结
  • php打包phar
  • php点运算符
  • bg命令 将作业放到后台运行
  • Emiller's Advanced Topics In Nginx Module Development
  • Google C++ Style中允许使用的Boost库(1) 程序即人生 博客频道 CSDN.NET
  • 织梦参数配置设置
  • 事业单位结余资金管理办法
  • 购买的商品作为赠品怎么入账
  • 职工教育经费扣除限额怎么算
  • 个人所得税退税退多少钱怎么算
  • 公司银行销户钱转到哪里去
  • 软件无形资产摊销年限
  • 存货和固定资产一经计提减值以后期间不得转回
  • mysql sql性能优化
  • 公司注销前账务怎么处理好
  • 累计预扣法利弊
  • 小企业长期股权投资减值损失采用直接转销法
  • 哪种情形的货物或者服务可以采用竞争性谈判方式采购
  • 商品预计退回会扣钱吗
  • 筹建期的财务费怎么算
  • 企业购买土地如何缴税
  • 销项发票导出为什么是乱码
  • 房地产会计如何报税
  • 旅游饮食服务企业财务会计制度
  • mysql 5.5 5.6
  • xp复制粘贴功能失效
  • unix系统复制命令
  • win7桌面记事本
  • win7的查看方式
  • win10预览版绿屏重启解决
  • xwizard.exe是什么
  • win7系统的话筒在哪设置
  • win10 系统账户
  • win8打开蓝牙设置
  • linux操作系统配置网络
  • win8.1自动更新
  • 车钥匙失灵了10秒教你快速解决
  • nodejs中的模块以及作用
  • apktool破解应用内购
  • shell脚本中计算变量除法
  • python中的
  • javascript的基本数据
  • jquery使用css
  • 房产税自用改为出租,房产税如何申报
  • 下载国税网上申报
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设