css中的animation

ops/2025/2/2 2:59:38/

cssanimation_0">css的animation

animation是一个综合属性,是animation-name, animation-duration, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, animation-fill-mode, animation-play-state, and animation-timeline这些属性的简写

不过在使用的时候,只有animation-nameanimation-duration是必须的

例如:

animation:testkeyframe 3s

我们也可以做更多的设置

例如:

css">animation:testkeyframe 3s linear 1s infinite
//对应的属性
//animation:
//testkeframe关键帧名字 
//3s动画持续时间 
//linear动画时间曲线  
//1s动画在多少时间之后开始执行  
//infinite动画循环次数

其中关键帧名字是对@keyframes的引用

css">@keyframes testkeyframe{0%{}50%{}100%{}
}

注意事项:

@keyframes中改变的属性必须是调用关键帧的元素里面已有的属性

比如调用关键帧的那个元素已有了transform:translateX(100px)

这样才能在@keyframe中不同阶段进行调整

示例:

html

<div class="container"><div class="testEl"></div>
</div>

css

css"> .container{position: relative;margin: 50px auto;width: 500px;height: 500px;border-radius: 5px;box-shadow: 1px 1px 10px 5px #d5d5d5;}.testEl{position:absolute;top: 20px;left: 20px;width: 100px;height: 100px;background-color: #aff;transform: translateX(0px);   //元素本身已有的属性,才能实现动画效果animation: testAn 3s linear infinite 1s;}@keyframes testAn {0%{transform: translateX(0px);}50%{transform: translateX(20px);}100%{transform: translateX(0px);}}

此外还需要注意的是:

animation属性的值animation-durationanimation-delay

必须严格顺序namedurationdelay

其他的内容可以自由搭配,不过都需要在name的后面

按照正确的顺序,才能正常解析成我们所需的动画效果

css">animation:testkeyframe 3s linear 1s infinite
//这里的3s就是animation-duration
//这里的1s就是animation-delay

http://www.ppmy.cn/ops/154917.html

相关文章

UE求职Demo开发日志# 17 物品合成面板数据和功能绑定

1 Pad蓝图里创建OnSelectRecipe函数 1.1 UpdateNeededItemContainer 先移除之前的 数组循环&#xff0c;创建显示信息的UI&#xff1a; 更新新创建UI的信息&#xff1a; 添加到子项&#xff1a; 1.2 UpdateResultItemContainer 与1.1同理 2 动态生成选择按钮 以合成表的长度…

汽车制造案例 | 搭建车间现场数字可视化管理方案(附解决模板)

目录 前言概述 业务背景 典型业务难题 解决方案 1.全程掌控解决方案 2.设备智能运营方案 3.全流程质量追溯方案 4.多维绩效评估方案 总结 生产可视化模板 前言概述 车间现场可视化管理是指利用电子看板、数字大屏等可视化工具&#xff0c;结合结合物联网、大数据分析…

linux 扩容

tmpfs tmpfs 82M 0 82M 0% /run/user/1002 tmpfs tmpfs 82M 0 82M 0% /run/user/0 [输入命令]# fdisk -lu Disk /dev/vda: 40 GiB, 42949672960 bytes, 83886080 sectors Units: sectors of 1 * 512 512 bytes Sector size (logi…

自定义数据集使用scikit-learn中的包实现线性回归方法对其进行拟合

1. 引言 简要介绍线性回归模型及其在机器学习中的应用。 2. 创建自定义数据集 通过生成一个简单的自定义数据集来模拟问题。可以使用numpy生成数据。 import numpy as np import matplotlib.pyplot as plt# 生成自定义数据 np.random.seed(42) X 2 * np.random.rand(100, …

大模型语料库的构建过程 包括知识图谱构建 垂直知识图谱构建 输入到sql构建 输入到cypher构建 通过智能体管理数据生产组件

以下是大模型语料库的构建过程&#xff1a; 一、文档切分语料库构建 数据来源确定&#xff1a; 首先&#xff0c;需要确定语料库的数据来源。这些来源可以是多种多样的&#xff0c;包括但不限于&#xff1a; 网络资源&#xff1a;利用网络爬虫技术从各种网站&#xff08;如新闻…

STM32完全学习——RT-thread在STM32F407上移植

一、写在前面 关于源码的下载&#xff0c;以及在KEIL工程里面添加操作系统的源代码&#xff0c;这里就不再赘述了。需要注意的是RT-thread默认里面是会使用串口的&#xff0c;因此需要额外的进行串口的初始化&#xff0c;有些人可能会问&#xff0c;为什么不直接使用CubMAX直接…

【协议详解】卫星通信5G IoT NTN SIB32-NB 信令详解

一、SIB32信令概述 低轨卫星的移动性会导致地面用户设备覆盖不连续&#xff0c;为了解决这一问题&#xff0c;3GPP引入了SystemInformationBlockType32&#xff08;SIB32&#xff09;信令&#xff0c;为非连续覆盖预测提供卫星辅助信息。地面设备可以基于SIB32信令中的信息&am…

【matlab】绘图 离散数据--->连续函数

matlab绘图练习 离散数据及离散函数对离散区间进行细划分 达到连续效果画plot(y)图 与 复数的应用 离散数据及离散函数 例1 x1[1 2 4 6 7 8 10 11 12 14 16 17 18 20] y1[1 2 4 6 7 8 10 10 8 7 6 4 2 1] figure(1); plot(x1,y1,o,MarkerSize,15); x21:20; y2log(x2); figure…