Proprietà di animazione dello stile
Esempio
Modifica dell'animazione di un elemento <div>, utilizzando la proprietà shorthand:
document.getElementById("myDIV").style.animation = "mynewmove 4s 2";
Definizione e utilizzo
La proprietà di animazione è una proprietà abbreviata per sei delle proprietà di animazione:
AnimazioneNome
AnimazioneDurata
AnimazioneTimingFunzione
AnimazioneDelay
animazioneIterazioneCount
animationDirection
Nota: specificare sempre la proprietà animationDuration, altrimenti la durata è 0 e non verrà mai riprodotta.
Supporto browser
I numeri nella tabella specificano la prima versione del browser che supporta completamente la proprietà.
I numeri seguiti da Webkit, Moz o O specificano la prima versione che ha funzionato con un prefisso.
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.1 12.0 O |
Sintassi
Restituisce la proprietà dell'animazione:
object.style.animation
Imposta la proprietà dell'animazione:
object.style.animation = "name duration timingFunction delay iterationCount direction fillMode playState"
Valori di proprietà
Value | Description |
---|---|
animationName | Specifies the name of the keyframe you want to bind to the selector |
animationDuration | Specifies how many seconds or milliseconds an animation takes to complete |
animationTimingFunction | Specifies the speed curve of the animation |
animationDelay | Specifies a delay before the animation will start |
animationIterationCount | Specifies how many times an animation should be played |
animationDirection | Specifies whether or not the animation should play in reverse on alternate cycles |
animationFillMode | Specifies what values are applied by the animation outside the time it is executing |
animationPlayState | 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 |
Dettagli tecnici
Valore di default: | nessuno 0 facilità 0 1 normale nessuno in esecuzione |
---|---|
Valore di ritorno: | Un oggetto String, che rappresenta la proprietà di animazione di un elemento |
Versione CSS | CSS3 |
Pagine correlate
Riferimento CSS: proprietà di animazione