Свойство анимации CSS
Пример
Привязка анимации к элементу <div> с помощью сокращенного свойства:
div
{
animation: mymove 5s infinite;
}
Определение и использование
Свойство animation
является сокращенным свойством для:
- имя-анимации
- продолжительность анимации
- функция синхронизации анимации
- анимация-задержка
- количество итераций анимации
- анимация-направление
- анимация-заливка-режим
- анимация-игра-состояние
Примечание. Всегда указывайте свойство animation-duration , иначе продолжительность равна 0 и никогда не будет воспроизводиться.
Значение по умолчанию: | нет 0 легкость 0 1 нормальный не работает |
---|---|
Унаследовано: | нет |
Анимация: | нет. Читать об анимации |
Версия: | CSS3 |
Синтаксис JavaScript: | объект .style.animation="mymove 5s бесконечно" |
Поддержка браузера
Цифры в таблице указывают на первую версию браузера, которая полностью поддерживает это свойство.
Цифры, за которыми следует -webkit-, -moz- или -o-, указывают на первую версию, которая работала с префиксом.
Property | |||||
---|---|---|---|---|---|
animation | 43.0 4.0 -webkit- |
10.0 | 16.0 5.0 -moz- |
9.0 4.0 -webkit- |
30.0 15.0 -webkit- 12.0 -o- |
Синтаксис CSS
animation: name duration timing-function delay iteration-count
direction fill-mode play-state;
Значения свойств
Value | Description |
---|---|
animation-name | Specifies the name of the keyframe you want to bind to the selector |
animation-duration | Specifies how many seconds or milliseconds an animation takes to complete |
animation-timing-function | Specifies the speed curve of the animation |
animation-delay | Specifies a delay before the animation will start |
animation-iteration-count | Specifies how many times an animation should be played |
animation-direction | Specifies whether or not the animation should play in reverse on alternate cycles |
animation-fill-mode | Specifies what values are applied by the animation outside the time it is executing |
animation-play-state | Specifies whether the animation is running or paused |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Связанные страницы
Учебное пособие по CSS: CSS-анимации
Справочник по HTML DOM: свойство анимации