Do you still remember that I have implemented "using only CSS to make divs move" before? Do you still remember how it was implemented at that time? Yes, transition is also more targeted. The limitations are only the rotation angle, length and width, so it is more like a transition than a movement. Of course, it also has a limitation. It can only be triggered when the mouse is placed. When one style changes to another style, the change is relatively monotonous. To truly achieve animation effects, there is a very effective method in CSS3: @keyframes.
First of all, you need to know its specifications and usage
Do you still remember the usage of transition: add div{transition: width (height, transform) 5s; width: 100px; in the initial style; }, and then div:hover{width: 300px}, this is how to achieve the transition effect, so what about the animation?
The animation here is first depict the overall effect of the animation, and then bind the objects that implement the animation
Here is an example modified from w3cschool for recording. :
@keyframes myfirst{0% {background: red; left:0px; top:0px;}25% {background: yellow; left:200px; top:0px;transform:rotate(100deg);}50% {background: blue; left:200px; top:200px;}75% {background: green; left:0px; top:200px;}100% {background: red; left:0px; top:0px;}}@-moz-keyframes myfirst /* Firefox */{0% {background: red; left:0px; top:0px;}25% {background: yellow; left:200px; top:0px;transform:rotate(100deg);}50% {background: blue; left:200px; top:200px;}75% {background: green; left:0px; top:200px;}100% {background: red; left:0px; top:0px;}}@-webkit-keyframes myfirst /* Safari 和 Chrome */{0% {background: red; left:0px; top:0px;}25% {background: yellow; left:200px; top:0px;transform:rotate(100deg);}50% {background: blue; left:200px; top:200px;}75% {background: green; left:0px; top:200px;}100% {background: red; left:0px; top:0px;}}@-o-keyframes myfirst /* Opera */{0% {background: red; left:0px; top:0px;}25% {background: yellow; left:200px; top:0pxl;transform:rotate(100deg);}50% {background: blue; left:200px; top:200px;}75% {background: green; left:0px; top:200px;}100% {background: red; left:0px; top:0px;}}
Find another object to bind. Do you find any problem with this object? Left and top are used to describe the distance. It must be absolute position, so let’s write the html part
<div style="width:100px;height:100px;position:absolute;"></div>and then bind it:
div{animation: myfirst 5s;-moz-animation: myfirst 5s; /* Firefox */-webkit-animation: myfirst 5s; /* Safari 和 Chrome */-o-animation: myfirst 5s; /* Opera */-moz-animation-iteration-count: 4;}General stepsWe understand this, 1: First make sure that the "animation effect" has been completed; 2. Find the object to achieve the animation effect; 3. Bind the animation effect to the object to be implemented, as follows That’s all.
But there is one thing we need to pay attention to. It cannot be achieved by binding casually. This binding is conditional , so what are the conditions?
1. Determine which animation effect is bound, 2. How long it takes to realize the animation effect. If you don’t write it, it will default to not running;
Of course this is the most basic requirement , and in order to achieve better animation effects , we can also set the following attributes:
1. animation-iteration-count, set the number of times the set animation effect is executed. , one thing to be clear here is that after all the times have been run, it will still disappear
2. animation-direction, how to achieve the animation effect, whether it is normal or reverse order;
3 , animation-play-state, the running effect of the animation, whether it is paused or running;
4. animation-delay, when the animation starts running
, etc., through these properties, we can better Have you realized your own animation effect in a personalized way?
I have seen so much css3 without knowing it. I should summarize the related content this weekend. Okay, I’ll study some places I haven’t seen yet in the past few days

当微软推出Windows11时,它带来了许多变化。其中一项更改是增加了用户界面动画的数量。一些用户想要改变事物的出现方式,他们必须想办法去做。拥有动画让用户感觉更好、更友好。动画使用视觉效果使计算机看起来更具吸引力和响应能力。其中一些包括几秒钟或几分钟后的滑动菜单。计算机上有许多动画会影响PC性能、减慢速度并影响您的工作。在这种情况下,您必须关闭动画。本文将介绍用户可以提高其在PC上的动画速度的几种方法。您可以使用注册表编辑器或您运行的自定义文件来应用更改。如何提高Windows11动画的

如何使用Vue实现打字机动画特效打字机动画是一种常见且引人注目的特效,常用于网站的标题、标语等文字展示上。在Vue中,我们可以通过使用Vue自定义指令来实现打字机动画效果。本文将详细介绍如何使用Vue来实现这一特效,并提供具体的代码示例。步骤1:创建Vue项目首先,我们需要创建一个Vue项目。可以使用VueCLI来快速创建一个新的Vue项目,或者手动在HT

本站需要重新写作的内容是:9需要重新写作的内容是:月需要重新写作的内容是:23需要重新写作的内容是:日消息,动画剧集《明日方舟》的第二季主线剧《明日方舟:冬隐归路》公布定档需要重新写作的内容是:PV,将于需要重新写作的内容是:10需要重新写作的内容是:月需要重新写作的内容是:7需要重新写作的内容是:日需要重新写作的内容是:00:23需要重新写作的内容是:正式上线,点此进入主题官网。需要重新写作的内容是:本站注意到,《明日方舟:冬隐归路》是《明日方舟:黎明前奏》的续作,剧情简介如下:为阻止感染者组

MicrosoftWindows11中包含多项新特性和功能。用户界面已更新,公司还引入了一些新效果。默认情况下,动画效果应用于控件和其他对象。我应该禁用这些动画吗?尽管Windows11具有视觉上吸引人的动画和淡入淡出效果,但它们可能会导致您的计算机对某些用户来说感觉迟钝,因为它们会为某些任务增加一点延迟。关闭动画以获得更灵敏的用户体验很简单。在我们看到对操作系统进行了哪些其他更改后,我们将引导您了解在Windows11中打开或关闭动画效果的方法。我们还有一篇关于如何在Windows

怎么制作文字轮播与图片轮播?大家第一想到的是不是利用js,其实利用纯CSS也能实现文字轮播与图片轮播,下面来看看实现方法,希望对大家有所帮助!

微软正在Windows11中试验新的任务栏动画,这是这家软件巨头正在进行的另一项新测试。这一次在设置应用程序中,当您单击相应部分时,图标会显示动画。以下是如何在Windows11中为“设置”应用启用图标动画。您可以在Windows11中看到特殊的动画和动画效果。例如,当您最小化和最大化设置应用程序或文件资源管理器时,您会注意到动画。说到图标,当您最小化窗口时,您会看到一个图标会向下弹起,而在您最大化或恢复时,它会弹起。Windows11设置可能会新收到左侧显示的导航图标动画,这是您

Vue中如何实现图片的闪烁和旋转动画Vue.js是目前非常流行的前端框架之一,它提供了强大的工具来管理和展示页面中的数据。在Vue中,我们可以通过添加CSS样式和动画来使元素产生各种各样的效果。本文将介绍如何使用Vue和CSS来实现图片的闪烁和旋转动画。首先,我们需要准备一张图片,可以是本地的图片文件或者网络上的图片地址。我们将使用<img>标

CSS动画教程:手把手教你实现闪烁文本特效CSS(CascadingStyleSheets)是一种用于为网页添加样式和布局的标记语言。通过使用CSS,我们可以为HTML元素添加动画效果,使网页更加生动和吸引人。在本教程中,我将向您展示如何使用CSS来实现一个简单的闪烁文本特效。您将会学到如何使用CSS的动画属性,以及如何在文本上应用动画来达到闪烁效果。以


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 English version
Recommended: Win version, supports code prompts!
