/* Keywords */
animation-trigger: none;
/* One trigger */
animation-trigger: --my-trigger play;
animation-trigger: --my-other-trigger play-once;
animation-trigger: --my-trigger play-forwards play-backwards;
animation-trigger: --my-other-trigger play reset;
/* Multiple values */
animation-trigger:
none,
-forwards play-backwards,
--my-other-trigger play reset;
/* Global values */
animation-trigger: inherit;
animation-trigger: initial;
animation-trigger: revert;
animation-trigger: revert-layer;
animation-trigger: unset;animation-trigger CSS property / notebook
animation-trigger CSS property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
.animated {
animation: rotate 3s infinite linear both;
animation-trigger: --my-trigger play;
}.trigger {
timeline-trigger: --my-trigger view();
}.animated {
animation: rotate 3s infinite linear both;
animation-trigger: --my-trigger play-forwards play-backwards;
}.animated {
animation:
spinOnce 2s 1 ease-out,
spinOnce 2s 1 ease-out;
animation-trigger:
--t1 play-forwards play-backwards,
--t2 play-forwards play-backwards;
}
.trigger1 {
timeline-trigger: --t1 view();
}
.trigger2 {
timeline-trigger: --t2 view();
}.animated {
animation:
fade-in linear 1s forwards,
rotate infinite 5s both,
shrink ease-in 3s forwards,
color-change steps(5) 5s forwards;
animation-trigger:
--t1 play pause,
--t2 forwards backwards;
}
.trigger1 {
timeline-trigger: --t1 view();
}
.trigger2 {
timeline-trigger: --t2 view();
}<div class="animated">I am animated</div>
...
<div class="trigger">I create the trigger</div>
...