search
HomeWeb Front-endCSS TutorialComprehensive comparison of CSS3 animation-related attributes transition, animation, and transform

Transition, animation, and transform are sometimes unclear. This article mainly introduces the comparison of CSS3 animation-related attributes transition, animation, and transform. Through browser compatibility, usage, and comparison, the similarities and differences between them are more deeply demonstrated. You can check the detailed explanation below for the specific operation steps. Interested friends can refer to it. I hope it can help everyone.

Browser Compatibility

##CSS3 transform property

Internet Explorer 10, Firefox, and Opera support the transform attribute.

Internet Explorer 9 supports an alternative -ms-transform property (for 2D transforms only).

Safari and Chrome support alternative -webkit-transform properties (3D and 2D transforms).

Opera only supports 2D conversion.

transform:rotate(7deg);
-ms-transform:rotate(7deg);     /* IE 9 */
-moz-transform:rotate(7deg);     /* Firefox */
-webkit-transform:rotate(7deg); /* Safari 和 Chrome */
-o-transform:rotate(7deg);     /* Opera */

CSS3 animation property ##Internet Explorer 10. Firefox and Opera support the animation attribute.

Safari and Chrome support an alternative -webkit-animation attribute.

Note: Internet Explorer 9 and earlier versions do not support the animation property.

Usage:

animation:mymove 5s infinite;
-webkit-animation:mymove 5s infinite; /* Safari 和 Chrome */

CSS3 transition propertyInternet Explorer 10, Firefox, Opera, and Chrome support the transition attribute.

Safari supports an alternative -webkit-transition attribute.

Note: Internet Explorer 9 and earlier browsers do not support the transition attribute.

Usage:

transition: width 2s;
-moz-transition: width 2s; /* Firefox 4 */
-webkit-transition: width 2s; /* Safari 和 Chrome */
-o-transition: width 2s;

##Other comparison

transition and animation It belongs to animation properties, and transform belongs to static properties. According to the understanding of English words: conversion, transformation, transform mainly refers to the conversion of displacement, size, position, and shape. If you directly write the attribute transformation, you will get the transformed shape and position.

Transition and animation are both animation properties, so they have the following

property
duration
timing-function
delay

properties, animation time, animation form, and delay time For animation, the property becomes the name of the animation. The unique properties of animation are:

animation-iteration-count

animation-direction

One is to define the number of times the animation is played, and the other is to define whether the animation is Play in reverse in turn



Comparison of abbreviated forms:

Transition attribute: transition, that is, the transition in the process of css change, so the meaning of defining the transition attribute is, when defined If the properties of the transition change, they will be transformed according to the animation of the transition, rather than a rigid direct transformation. This provides a good way for animation. Generally we write:-webkit-transition:all 0.85s ease-in 0.1s;

-o-transition:all 0.85s ease-in 0.1s;

-moz-transition:all 0.85s ease -in 0.1s;
transition:all 0.85s ease-in 0.1s;
all means that all changes in attributes will be changed according to this transition
animation writing method:
-webkit-animation: tang1 0.5s ease 0s infinite alternate;
animation: tang1 0.5s ease 0s infinite alternate;
Abbreviated form, animation is followed by the number of animations and whether to play in reverse in turn

The one starting with animation is the name of the animation , so here we need to first define how the animation transforms:

@keyframes tang1
{
from {left:0px;}
to {left:200px;}
}

@-webkit-keyframes tang1 /*Safari and Chrome*/
{
from {left:0px;}
to {left:200px;}
}

Due to browser compatibility, this must also be written when defining the animation.

from represents 0% time, to represents 100% time.

Related recommendations:

Instance analysis of the transition attribute in CSS3

Transition mainly includes an introduction to four attribute values

Tutorial on the use of animation animation in css

Compare the differences and connections between transition and animation in css3

##CSS3 Detailed introduction about transform

The above is the detailed content of Comprehensive comparison of CSS3 animation-related attributes transition, animation, and transform. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Next Level CSS Styling for CursorsNext Level CSS Styling for CursorsApr 23, 2025 am 11:04 AM

Custom cursors with CSS are great, but we can take things to the next level with JavaScript. Using JavaScript, we can transition between cursor states, place dynamic text within the cursor, apply complex animations, and apply filters.

Worlds Collide: Keyframe Collision Detection Using Style QueriesWorlds Collide: Keyframe Collision Detection Using Style QueriesApr 23, 2025 am 10:42 AM

Interactive CSS animations with elements ricocheting off each other seem more plausible in 2025. While it’s unnecessary to implement Pong in CSS, the increasing flexibility and power of CSS reinforce Lee's suspicion that one day it will be a

Using CSS backdrop-filter for UI EffectsUsing CSS backdrop-filter for UI EffectsApr 23, 2025 am 10:20 AM

Tips and tricks on utilizing the CSS backdrop-filter property to style user interfaces. You’ll learn how to layer backdrop filters among multiple elements, and integrate them with other CSS graphical effects to create elaborate designs.

SMIL on?SMIL on?Apr 23, 2025 am 09:57 AM

Well, it turns out that SVG's built-in animation features were never deprecated as planned. Sure, CSS and JavaScript are more than capable of carrying the load, but it's good to know that SMIL is not dead in the water as previously

'Pretty' is in the eye of the beholder'Pretty' is in the eye of the beholderApr 23, 2025 am 09:40 AM

Yay, let's jump for text-wrap: pretty landing in Safari Technology Preview! But beware that it's different from how it works in Chromium browsers.

CSS-Tricks Chronicles XLIIICSS-Tricks Chronicles XLIIIApr 23, 2025 am 09:35 AM

This CSS-Tricks update highlights significant progress in the Almanac, recent podcast appearances, a new CSS counters guide, and the addition of several new authors contributing valuable content.

Tailwind's @apply Feature is Better Than it SoundsTailwind's @apply Feature is Better Than it SoundsApr 23, 2025 am 09:23 AM

Most of the time, people showcase Tailwind's @apply feature with one of Tailwind's single-property utilities (which changes a single CSS declaration). When showcased this way, @apply doesn't sound promising at all. So obvio

Feeling Like I Have No Release: A Journey Towards Sane DeploymentsFeeling Like I Have No Release: A Journey Towards Sane DeploymentsApr 23, 2025 am 09:19 AM

Deploying like an idiot comes down to a mismatch between the tools you use to deploy and the reward in complexity reduced versus complexity added.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),