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

流畅!HTMLCSS打造网格方块加载动画

效果演示

这个动画的效果是五个方块在网格中上下移动,模拟了一个连续的加载过程。每个方块的动画都是独立的,但是它们的时间间隔和路径被设计为相互协调,以创建出流畅的动画效果。

HTML

<div class="loadingspinner"><div id="square1"></div><div id="square2"></div><div id="square3"></div><div id="square4"></div><div id="square5"></div>
</div>
  • loadingspinner:包含所有方块的容器。
  • square1 到 square5:这五个div元素代表动画中的五个方块,每个方块都将通过CSS进行样式化和动画化。

CSS

.loadingspinner {--square: 26px;--offset: 30px;--duration: 2.4s;--delay: 0.2s;--timing-function: ease-in-out;--in-duration: 0.4s;--in-delay: 0.1s;--in-timing-function: ease-out;width: calc(3 * var(--offset) + var(--square));height: calc(2 * var(--offset) + var(--square));padding: 0px;margin-left: auto;margin-right: auto;margin-top: 10px;margin-bottom: 30px;position: relative;
}.loadingspinner div {display: inline-block;background: darkorange;/*background: var(--text-color);*//*box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.4);*/border: none;border-radius: 2px;width: var(--square);height: var(--square);position: absolute;padding: 0px;margin: 0px;font-size: 6pt;color: black;
}.loadingspinner #square1 {left: calc(0 * var(--offset));top: calc(0 * var(--offset));animation: square1 var(--duration) var(--delay) var(--timing-function) infinite,squarefadein var(--in-duration) calc(1 * var(--in-delay)) var(--in-timing-function) both;
}.loadingspinner #square2 {left: calc(0 * var(--offset));top: calc(1 * var(--offset));animation: square2 var(--duration) var(--delay) var(--timing-function) infinite,squarefadein var(--in-duration) calc(1 * var(--in-delay)) var(--in-timing-function) both;
}.loadingspinner #square3 {left: calc(1 * var(--offset));top: calc(1 * var(--offset));animation: square3 var(--duration) var(--delay) var(--timing-function) infinite,squarefadein var(--in-duration) calc(2 * var(--in-delay)) var(--in-timing-function) both;
}.loadingspinner #square4 {left: calc(2 * var(--offset));top: calc(1 * var(--offset));animation: square4 var(--duration) var(--delay) var(--timing-function) infinite,squarefadein var(--in-duration) calc(3 * var(--in-delay)) var(--in-timing-function) both;
}.loadingspinner #square5 {left: calc(3 * var(--offset));top: calc(1 * var(--offset));animation: square5 var(--duration) var(--delay) var(--timing-function) infinite,squarefadein var(--in-duration) calc(4 * var(--in-delay)) var(--in-timing-function) both;
}@keyframes square1 {0% {left: calc(0 * var(--offset));top: calc(0 * var(--offset));}8.333% {left: calc(0 * var(--offset));top: calc(1 * var(--offset));}100% {left: calc(0 * var(--offset));top: calc(1 * var(--offset));}
}@keyframes square2 {0% {left: calc(0 * var(--offset));top: calc(1 * var(--offset));}8.333% {left: calc(0 * var(--offset));top: calc(2 * var(--offset));}16.67% {left: calc(1 * var(--offset));top: calc(2 * var(--offset));}25.00% {left: calc(1 * var(--offset));top: calc(1 * var(--offset));}83.33% {left: calc(1 * var(--offset));top: calc(1 * var(--offset));}91.67% {left: calc(1 * var(--offset));top: calc(0 * var(--offset));}100% {left: calc(0 * var(--offset));top: calc(0 * var(--offset));}
}@keyframes square3 {0%,100% {left: calc(1 * var(--offset));top: calc(1 * var(--offset));}16.67% {left: calc(1 * var(--offset));top: calc(1 * var(--offset));}25.00% {left: calc(1 * var(--offset));top: calc(0 * var(--offset));}33.33% {left: calc(2 * var(--offset));top: calc(0 * var(--offset));}41.67% {left: calc(2 * var(--offset));top: calc(1 * var(--offset));}66.67% {left: calc(2 * var(--offset));top: calc(1 * var(--offset));}75.00% {left: calc(2 * var(--offset));top: calc(2 * var(--offset));}83.33% {left: calc(1 * var(--offset));top: calc(2 * var(--offset));}91.67% {left: calc(1 * var(--offset));top: calc(1 * var(--offset));}
}@keyframes square4 {0% {left: calc(2 * var(--offset));top: calc(1 * var(--offset));}33.33% {left: calc(2 * var(--offset));top: calc(1 * var(--offset));}41.67% {left: calc(2 * var(--offset));top: calc(2 * var(--offset));}50.00% {left: calc(3 * var(--offset));top: calc(2 * var(--offset));}58.33% {left: calc(3 * var(--offset));top: calc(1 * var(--offset));}100% {left: calc(3 * var(--offset));top: calc(1 * var(--offset));}
}@keyframes square5 {0% {left: calc(3 * var(--offset));top: calc(1 * var(--offset));}50.00% {left: calc(3 * var(--offset));top: calc(1 * var(--offset));}58.33% {left: calc(3 * var(--offset));top: calc(0 * var(--offset));}66.67% {left: calc(2 * var(--offset));top: calc(0 * var(--offset));}75.00% {left: calc(2 * var(--offset));top: calc(1 * var(--offset));}100% {left: calc(2 * var(--offset));top: calc(1 * var(--offset));}
}@keyframes squarefadein {0% {transform: scale(0.75);opacity: 0.0;}100% {transform: scale(1.0);opacity: 1.0;}
}
  • .loadingspinner:定义了容器的尺寸和位置。使用了CSS变量来控制方块的大小、间距、动画持续时间等。
  • .loadingspinner div:为所有方块设置了基本的样式,包括背景颜色、尺寸和位置。
  • #square1 到 #square5:为每个方块定义了特定的动画和初始位置。
  • @keyframes square1 到 @keyframes square5:定义了每个方块的动画路径,包括它们在容器内的水平和垂直移动。
  • @keyframes squarefadein:定义了一个淡入效果,使得方块在动画开始时逐渐放大并变得不透明。

相关文章:

流畅!HTMLCSS打造网格方块加载动画

效果演示 这个动画的效果是五个方块在网格中上下移动&#xff0c;模拟了一个连续的加载过程。每个方块的动画都是独立的&#xff0c;但是它们的时间间隔和路径被设计为相互协调&#xff0c;以创建出流畅的动画效果。 HTML <div class"loadingspinner"><…...

linux命令之top(Linux Command Top)

&#x1f49d;&#x1f49d;&#x1f49d;欢迎来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里可以感受到一份轻松愉快的氛围&#xff0c;不仅可以获得有趣的内容和知识&#xff0c;也可以畅所欲言、分享您的想法和见解。 本人主要分享计算机核心技…...

数据结构-希尔排序(ShellSort)笔记

看动画理解 【数据结构】八大排序(超详解附动图源码)_数据结构排序-CSDN博客 一 基本思想 先选定一个整数gap&#xff0c;把待排序文件中所有记录分成gap个组&#xff0c;所有距离为gap的记录分在同一组内&#xff0c;并对每一组内的元素进行排序。 然后将gap逐渐减小重复上…...

Junit + Mockito保姆级集成测试实践

一、做好单测&#xff0c;慢即是快 对于单元测试的看法&#xff0c;业界同仁理解多有不同&#xff0c;尤其是在业务变化快速的互联网行业&#xff0c;通常的问题主要有&#xff0c;必须要做吗&#xff1f;做到多少合适&#xff1f;现在没做不也挺好的吗&#xff1f;甚至一些大…...

软件项目管理要点

一.项目管理 1.盈亏平衡分析 销售额固定成本可变成本税费利润 当利润为0的时候就是盈亏平衡点。 2.范围管理 范围定义的输入包括&#xff1a;项目章程、项目范围管理计划、组织过程资产、批准的变更申请。 3.时间管理 项目时间管理中的过程包括活动定义、活动排序、活动的资…...

ESP8266 连接 MQTT 服务器EMQX 连接MQTTX

目录 1.先用有一台自己的云服务器 2. 使用FinalShell连接阿里云云服务器ECS 3.安装宝塔 4.在云服务器打开8888端口 5.使用外网面板地址打开宝塔面板 6.安装Docker 7.下载emqx 8.打开emqxWeb 界面 9.下载MQTTX 10.EMQX加一个客户端 11.开始通信 12.加入单片机ESP8266 …...

Python中如何处理异常情况?

1、Python中如何处理异常情况&#xff1f; 在Python中&#xff0c;处理异常情况通常使用try/except语句。try语句块包含可能会引发异常的代码&#xff0c;而except语句块包含处理异常的代码。如果try块中的代码引发了异常&#xff0c;控制流将立即转到相应的except块。 以下是…...

openpnp - 在openpnp中单独测试相机

文章目录 openpnp - 在openpnp中单独测试相机概述笔记END openpnp - 在openpnp中单独测试相机 概述 底部相机的位置不合适, 重新做了零件&#xff0c;准备先确定一下相机和吸嘴的距离是多少才合适。 如果在设备上直接实验&#xff0c;那么拆装调整相机挺麻烦的。 准备直接在电…...

Spark窗口函数

1、 Spark中的窗口函数 窗口就是单纯在行后面加一个列 可以套多个窗口函数&#xff0c;但彼此之间不能相互引用&#xff0c;是独立的 窗口函数会产生shuffle over就是用来划分窗口的 (1) 分组聚合里面的函数&#xff0c;基…...

Idea、VS Code 如何安装Fitten Code插件使用

博主主页:【南鸢1.0】 本文专栏&#xff1a;JAVA 目录 ​编辑 简介 所用工具 1、Idea如何安装插件 1.idea下载插件 2.需要从外部下载然后在安装&#xff0c; 2、VS Code如何安装插件 总结 简介 Fitten Code是由非十大模型驱动的AI编程助手&#xff0c;它可以自动生成代…...

elasticsearch7.x在k8s中的部署

一、说明 二、思路 三、部署 1、建nfs服务器 2、建持久卷 3、部署elasticsearch 四、附件 ?pv.yaml内容 elasticsearch.yaml内容 一、说明 本文章内容主要的参考来源是https://www.cnblogs.com/javashop-docs/p/12410845.html&#xff0c;但参考文献中的elasticsearc…...

校园社团信息管理平台:Spring Boot技术实战指南

3系统分析 3.1可行性分析 通过对本校园社团信息管理系统实行的目的初步调查和分析&#xff0c;提出可行性方案并对其一一进行论证。我们在这里主要从技术可行性、经济可行性、操作可行性等方面进行分析。 3.1.1技术可行性 本校园社团信息管理系统采用SSM框架&#xff0c;JAVA作…...

【Linux】从内核角度理解 TCP 的 全连接队列(以及什么是 TCP 抓包)

文章目录 概念引入理解全连接队列内核方面理解Tcp抓包方法注意事项 概念引入 我们知道&#xff0c;TCP的三次握手是由TCP协议 自动处理的&#xff0c;建立连接的过程与用户是否进行accept无关&#xff0c;accept()的作用主要是为当前连接创建一个套接字&#xff0c;用于进行后…...

太速科技-712-6U VPX飞腾处理器刀片计算机

6U VPX飞腾处理器刀片计算机 一、产品概述 该产品是一款基于国产飞腾FT-2000四核处理器或D2000八核处理器的高性能6U VPX刀片式计算机。产品提供了可支持全网状交换的高速数据通道&#xff0c;其中P1、P2均支持1个PCIe x16 Gen3或2个PCIe x8 Gen3或4个PCIe x4 Gen3总…...

深度学习(八) TensorFlow、PyTorch、Keras框架大比拼(8/10)

一、深度学习框架概述 深度学习框架在当今人工智能和机器学习领域中占据着至关重要的地位。其中&#xff0c;TensorFlow 由 Google 开发&#xff0c;自 2015 年发布以来&#xff0c;凭借其灵活的计算图、自动微分功能以及跨平台支持等特点&#xff0c;迅速成为主流深度学习框架…...

thinkphp中命令行工具think使用,可用于快速生成控制器,模型,中间件等

在使用tp框架的时候tp内置了一个think的命令行工具&#xff0c; 这个工具可以帮助我们快速的生成控制器&#xff0c;模型&#xff0c;中间件的代码。 这个工具就和laravel中的 artisan 的作用都差不多&#xff0c;只是名称不同而已。 tp中常用的命令行工具&#xff1a; 1. 快…...

Discourse 是否支持手机注册

Discourse 能不能使用手机进行注册&#xff1f; 功能总结 简答来说&#xff0c;Discourse 不能使用手机注册&#xff0c;Discourse 也没有提供这个功能。 这个功能多是需要 SSO 来实现。 比如说华为的那个社区&#xff0c;他们自己做了一个自己的用户管理 SSO&#xff0c;然…...

软件测试学习笔记丨Flask框架-请求与响应

本文转自测试人社区&#xff0c;原文链接&#xff1a;https://ceshiren.com/t/topic/23408 请求方法 from flask import Flaskapp Flask(__name__)app.route("/cases", methods["get"]) def get_case():return {"code": 0, "msg": &…...

【C++笔记】list结构剖析及其模拟实现

【C笔记】list结构剖析及其模拟实现 &#x1f525;个人主页&#xff1a;大白的编程日记 &#x1f525;专栏&#xff1a;C笔记 文章目录 【C笔记】list结构剖析及其模拟实现前言一 .list的结构及其介绍1.1list的结构1.2list的使用1.3迭代器划分 二.list的模拟实现2.1 list结构…...

C#进阶1

C#进阶1 本文章主要介绍C#的进阶知识&#xff0c;如反射&#xff0c;特性.... 参考视频链接 原码 文章目录 C#进阶1反射步骤泛型反射调用方法 获取属性 特性特性的定义步骤扩展枚举练习 反射 在 C# 中&#xff0c;反射&#xff08;Reflection&#xff09;是一种强大的机制&a…...

预算有限必入!4 款高性价比买断制写作软件,学生党低成本搞定全流程写作

在写作成本日益攀升的当下&#xff0c;买断制写作软件凭借 “一次付费、长期使用、无隐性消费” 的优势&#xff0c;成为学生党、自由创作者与职场人的首选。尤其对于预算有限的群体&#xff0c;既能规避订阅制的长期支出&#xff0c;又能解锁全流程写作能力&#xff0c;堪称 “…...

PX4飞控开发实战:如何调试mc_pos_control模块提升多旋翼飞行稳定性

PX4飞控开发实战&#xff1a;如何调试mc_pos_control模块提升多旋翼飞行稳定性 当多旋翼无人机在悬停时出现高频震荡&#xff0c;或是响应指令时显得迟缓笨重&#xff0c;背后往往隐藏着位置控制参数的配置问题。PX4飞控中的mc_pos_control模块作为多旋翼位置控制的核心&#x…...

从零配置致远OA连接中台:慧集通在A8系统中对接电商平台(聚水潭/旺店通)的完整流程

从零构建致远OA与电商平台的无缝集成&#xff1a;慧集通实战指南 电商企业IT运维团队常面临一个核心痛点&#xff1a;如何让OA系统与电商管理平台&#xff08;如聚水潭、旺店通&#xff09;实现数据自动流转&#xff1f;订单状态变更需要人工同步、库存数据延迟更新、财务对账效…...

Python3.11镜像5分钟快速部署:告别环境冲突,一键搭建AI开发环境

Python3.11镜像5分钟快速部署&#xff1a;告别环境冲突&#xff0c;一键搭建AI开发环境 1. 为什么需要Python3.11镜像 在AI开发和数据科学领域&#xff0c;Python环境管理一直是个令人头疼的问题。不同项目可能需要不同版本的Python解释器或依赖库&#xff0c;手动管理这些环…...

ChatGPT与国内大模型的技术差距解析:从架构到应用场景

ChatGPT与国内大模型的技术差距解析&#xff1a;从架构到应用场景 在评估大语言模型时&#xff0c;基准测试是衡量其综合能力的重要标尺。以MMLU&#xff08;大规模多任务语言理解&#xff09;和C-Eval&#xff08;中文语言理解评估基准&#xff09;为例&#xff0c;GPT-4在MM…...

开源工具图像转换:用数字画生成器打造DIY创作

开源工具图像转换&#xff1a;用数字画生成器打造DIY创作 【免费下载链接】paintbynumbersgenerator Paint by numbers generator 项目地址: https://gitcode.com/gh_mirrors/pa/paintbynumbersgenerator 数字艺术创作正成为越来越多人的兴趣&#xff0c;而开源工具&quo…...

Pixel Dimension Fissioner 数据库集成:MySQL存储用户生成内容与模型参数

Pixel Dimension Fissioner 数据库集成&#xff1a;MySQL存储用户生成内容与模型参数 1. 场景需求与技术选型 在构建基于Pixel Dimension Fissioner的UGC平台时&#xff0c;我们需要处理三类核心数据&#xff1a;用户信息、生成任务记录和模型参数配置。MySQL因其成熟稳定、社…...

ReShade后处理注入器:让任何游戏画面焕发新生的终极解决方案

ReShade后处理注入器&#xff1a;让任何游戏画面焕发新生的终极解决方案 【免费下载链接】reshade A generic post-processing injector for games and video software. 项目地址: https://gitcode.com/gh_mirrors/re/reshade 还在为老旧游戏的画面效果感到失望吗&#…...

Tinkercad对齐工具保姆级教程:从‘切线关系’到‘临时分组’,手把手教你搭建城堡模型

Tinkercad对齐工具高阶指南&#xff1a;从几何原理到城堡建模实战 在三维建模的世界里&#xff0c;精准对齐往往是区分业余作品与专业设计的关键分水岭。Tinkercad的对齐工具看似简单&#xff0c;实则蕴含着一套完整的空间逻辑体系——这正是许多中级用户突破瓶颈所缺失的设计思…...

塔吉特(Target)采购技术:提升下单成功率方案

在跨境电商竞争白热化的当下&#xff0c;塔吉特&#xff08;Target&#xff09;作为美国零售巨头&#xff0c;其采购下单技术通过模拟真实用户行为、构建独立运营环境及动态风控策略&#xff0c;成为跨境卖家突破采购限制、降低运营成本的核心手段。以下从技术底层逻辑到实战操…...