CINXE.COM

CSS Animations Level 1

<!doctype html><html lang="en"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"> <title>CSS Animations Level 1</title> <meta content="WD" name="w3c-status"> <meta content="Bikeshed version 742f3d674, updated Mon Nov 4 14:56:54 2024 -0800" name="generator"> <link href="https://www.w3.org/TR/css-animations-1/" rel="canonical"> <meta content="b893221e560a002844ed9de2193274e0d4df9e2a" name="revision"> <meta content="dark light" name="color-scheme"> <style>/* Boilerplate: style-autolinks */ .css.css, .property.property, .descriptor.descriptor { color: var(--a-normal-text); font-size: inherit; font-family: inherit; } .css::before, .property::before, .descriptor::before { content: "‘"; } .css::after, .property::after, .descriptor::after { content: "’"; } .property, .descriptor { /* Don't wrap property and descriptor names */ white-space: nowrap; } .type { /* CSS value <type> */ font-style: italic; } pre .property::before, pre .property::after { content: ""; } [data-link-type="property"]::before, [data-link-type="propdesc"]::before, [data-link-type="descriptor"]::before, [data-link-type="value"]::before, [data-link-type="function"]::before, [data-link-type="at-rule"]::before, [data-link-type="selector"]::before, [data-link-type="maybe"]::before { content: "‘"; } [data-link-type="property"]::after, [data-link-type="propdesc"]::after, [data-link-type="descriptor"]::after, [data-link-type="value"]::after, [data-link-type="function"]::after, [data-link-type="at-rule"]::after, [data-link-type="selector"]::after, [data-link-type="maybe"]::after { content: "’"; } [data-link-type].production::before, [data-link-type].production::after, .prod [data-link-type]::before, .prod [data-link-type]::after { content: ""; } [data-link-type=element], [data-link-type=element-attr] { font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace; font-size: .9em; } [data-link-type=element]::before { content: "<" } [data-link-type=element]::after { content: ">" } [data-link-type=biblio] { white-space: pre; } @media (prefers-color-scheme: dark) { :root { --selflink-text: black; --selflink-bg: silver; --selflink-hover-text: white; } } </style> <style>/* Boilerplate: style-colors */ /* Any --*-text not paired with a --*-bg is assumed to have a transparent bg */ :root { color-scheme: light dark; --text: black; --bg: white; --unofficial-watermark: url(https://www.w3.org/StyleSheets/TR/2016/logos/UD-watermark); --logo-bg: #1a5e9a; --logo-active-bg: #c00; --logo-text: white; --tocnav-normal-text: #707070; --tocnav-normal-bg: var(--bg); --tocnav-hover-text: var(--tocnav-normal-text); --tocnav-hover-bg: #f8f8f8; --tocnav-active-text: #c00; --tocnav-active-bg: var(--tocnav-normal-bg); --tocsidebar-text: var(--text); --tocsidebar-bg: #f7f8f9; --tocsidebar-shadow: rgba(0,0,0,.1); --tocsidebar-heading-text: hsla(203,20%,40%,.7); --toclink-text: var(--text); --toclink-underline: #3980b5; --toclink-visited-text: var(--toclink-text); --toclink-visited-underline: #054572; --heading-text: #005a9c; --hr-text: var(--text); --algo-border: #def; --del-text: red; --del-bg: transparent; --ins-text: #080; --ins-bg: transparent; --a-normal-text: #034575; --a-normal-underline: #bbb; --a-visited-text: var(--a-normal-text); --a-visited-underline: #707070; --a-hover-bg: rgba(75%, 75%, 75%, .25); --a-active-text: #c00; --a-active-underline: #c00; --blockquote-border: silver; --blockquote-bg: transparent; --blockquote-text: currentcolor; --issue-border: #e05252; --issue-bg: #fbe9e9; --issue-text: var(--text); --issueheading-text: #831616; --example-border: #e0cb52; --example-bg: #fcfaee; --example-text: var(--text); --exampleheading-text: #574b0f; --note-border: #52e052; --note-bg: #e9fbe9; --note-text: var(--text); --noteheading-text: hsl(120, 70%, 30%); --notesummary-underline: silver; --assertion-border: #aaa; --assertion-bg: #eee; --assertion-text: black; --advisement-border: orange; --advisement-bg: #fec; --advisement-text: var(--text); --advisementheading-text: #b35f00; --warning-border: red; --warning-bg: hsla(40,100%,50%,0.95); --warning-text: var(--text); --amendment-border: #330099; --amendment-bg: #F5F0FF; --amendment-text: var(--text); --amendmentheading-text: #220066; --def-border: #8ccbf2; --def-bg: #def; --def-text: var(--text); --defrow-border: #bbd7e9; --datacell-border: silver; --indexinfo-text: #707070; --indextable-hover-text: black; --indextable-hover-bg: #f7f8f9; --outdatedspec-bg: rgba(0, 0, 0, .5); --outdatedspec-text: black; --outdated-bg: maroon; --outdated-text: white; --outdated-shadow: red; --editedrec-bg: darkorange; } @media (prefers-color-scheme: dark) { :root { --text: #ddd; --bg: black; --unofficial-watermark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cg fill='%23100808' transform='translate(200 200) rotate(-45) translate(-200 -200)' stroke='%23100808' stroke-width='3'%3E%3Ctext x='50%25' y='220' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EUNOFFICIAL%3C/text%3E%3Ctext x='50%25' y='305' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EDRAFT%3C/text%3E%3C/g%3E%3C/svg%3E"); --logo-bg: #1a5e9a; --logo-active-bg: #c00; --logo-text: white; --tocnav-normal-text: #999; --tocnav-normal-bg: var(--bg); --tocnav-hover-text: var(--tocnav-normal-text); --tocnav-hover-bg: #080808; --tocnav-active-text: #f44; --tocnav-active-bg: var(--tocnav-normal-bg); --tocsidebar-text: var(--text); --tocsidebar-bg: #080808; --tocsidebar-shadow: rgba(255,255,255,.1); --tocsidebar-heading-text: hsla(203,20%,40%,.7); --toclink-text: var(--text); --toclink-underline: #6af; --toclink-visited-text: var(--toclink-text); --toclink-visited-underline: #054572; --heading-text: #8af; --hr-text: var(--text); --algo-border: #456; --del-text: #f44; --del-bg: transparent; --ins-text: #4a4; --ins-bg: transparent; --a-normal-text: #6af; --a-normal-underline: #555; --a-visited-text: var(--a-normal-text); --a-visited-underline: var(--a-normal-underline); --a-hover-bg: rgba(25%, 25%, 25%, .2); --a-active-text: #f44; --a-active-underline: var(--a-active-text); --borderedblock-bg: rgba(255, 255, 255, .05); --blockquote-border: silver; --blockquote-bg: var(--borderedblock-bg); --blockquote-text: currentcolor; --issue-border: #e05252; --issue-bg: var(--borderedblock-bg); --issue-text: var(--text); --issueheading-text: hsl(0deg, 70%, 70%); --example-border: hsl(50deg, 90%, 60%); --example-bg: var(--borderedblock-bg); --example-text: var(--text); --exampleheading-text: hsl(50deg, 70%, 70%); --note-border: hsl(120deg, 100%, 35%); --note-bg: var(--borderedblock-bg); --note-text: var(--text); --noteheading-text: hsl(120, 70%, 70%); --notesummary-underline: silver; --assertion-border: #444; --assertion-bg: var(--borderedblock-bg); --assertion-text: var(--text); --advisement-border: orange; --advisement-bg: #222218; --advisement-text: var(--text); --advisementheading-text: #f84; --warning-border: red; --warning-bg: hsla(40,100%,20%,0.95); --warning-text: var(--text); --amendment-border: #330099; --amendment-bg: #080010; --amendment-text: var(--text); --amendmentheading-text: #cc00ff; --def-border: #8ccbf2; --def-bg: #080818; --def-text: var(--text); --defrow-border: #136; --datacell-border: silver; --indexinfo-text: #aaa; --indextable-hover-text: var(--text); --indextable-hover-bg: #181818; --outdatedspec-bg: rgba(255, 255, 255, .5); --outdatedspec-text: black; --outdated-bg: maroon; --outdated-text: white; --outdated-shadow: red; --editedrec-bg: darkorange; } /* In case a transparent-bg image doesn't expect to be on a dark bg, which is quite common in practice... */ img { background: white; } } </style> <style>/* Boilerplate: style-counters */ body { counter-reset: example figure issue; } .issue { counter-increment: issue; } .issue:not(.no-marker)::before { content: "Issue " counter(issue); } .example { counter-increment: example; } .example:not(.no-marker)::before { content: "Example " counter(example); } .invalid.example:not(.no-marker)::before, .illegal.example:not(.no-marker)::before { content: "Invalid Example" counter(example); } figcaption { counter-increment: figure; } figcaption:not(.no-marker)::before { content: "Figure " counter(figure) " "; } </style> <style>/* Boilerplate: style-dfn-panel */ :root { --dfnpanel-bg: #ddd; --dfnpanel-text: var(--text); --dfnpanel-target-bg: #ffc; --dfnpanel-target-outline: orange; } @media (prefers-color-scheme: dark) { :root { --dfnpanel-bg: #222; --dfnpanel-text: var(--text); --dfnpanel-target-bg: #333; --dfnpanel-target-outline: silver; } } .dfn-panel { position: absolute; z-index: 35; width: 20em; width: 300px; height: auto; max-height: 500px; overflow: auto; padding: 0.5em 0.75em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: var(--dfnpanel-bg); color: var(--dfnpanel-text); border: outset 0.2em; white-space: normal; /* in case it's moved into a pre */ } .dfn-panel:not(.on) { display: none; } .dfn-panel * { margin: 0; padding: 0; text-indent: 0; } .dfn-panel > b { display: block; } .dfn-panel a { color: var(--dfnpanel-text); } .dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; } .dfn-panel a:focus { outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color; } .dfn-panel > b + b { margin-top: 0.25em; } .dfn-panel ul { padding: 0 0 0 1em; list-style: none; } .dfn-panel li a { max-width: calc(300px - 1.5em - 1em); overflow: hidden; text-overflow: ellipsis; } .dfn-panel.activated { display: inline-block; position: fixed; left: 8px; bottom: 2em; margin: 0 auto; max-width: calc(100vw - 1.5em - .4em - .5em); max-height: 30vh; transition: left 1s ease-out, bottom 1s ease-out; } .dfn-panel .link-item:hover { text-decoration: underline; } .dfn-panel .link-item .copy-icon { opacity: 0; } .dfn-panel .link-item:hover .copy-icon, .dfn-panel .link-item .copy-icon:focus { opacity: 1; } .dfn-panel .copy-icon { display: inline-block; margin-right: 0.5em; width: 0.85em; height: 1em; border-radius: 3px; background-color: #ccc; cursor: pointer; } .dfn-panel .copy-icon .icon { width: 100%; height: 100%; background-color: #fff; display: flex; justify-content: center; align-items: center; position: relative; } .dfn-panel .copy-icon .icon::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 1px solid black; background-color: #ccc; opacity: 0.25; transform: translate(3px, -3px); } .dfn-panel .copy-icon:active .icon::before { opacity: 1; } .dfn-paneled[role="button"] { cursor: help; } .highlighted { animation: target-fade 3s; } @keyframes target-fade { from { background-color: var(--dfnpanel-target-bg); outline: 5px solid var(--dfnpanel-target-outline); } to { color: var(--a-normal-text); background-color: transparent; outline: transparent; } } </style> <style>/* Boilerplate: style-idl-highlighting */ pre.idl.highlight { background: var(--borderedblock-bg, var(--def-bg)); } </style> <style>/* Boilerplate: style-issues */ a[href].issue-return { float: right; float: inline-end; color: var(--issueheading-text); font-weight: bold; text-decoration: none; } </style> <style>/* Boilerplate: style-md-lists */ /* This is a weird hack for me not yet following the commonmark spec regarding paragraph and lists. */ [data-md] > :first-child { margin-top: 0; } [data-md] > :last-child { margin-bottom: 0; } </style> <style>/* Boilerplate: style-ref-hints */ :root { --ref-hint-bg: #ddd; --ref-hint-text: var(--text); } @media (prefers-color-scheme: dark) { :root { --ref-hint-bg: #222; --ref-hint-text: var(--text); } } .ref-hint { display: inline-block; position: absolute; z-index: 35; width: 20em; width: 300px; height: auto; max-height: 500px; overflow: auto; padding: 0.5em 0.5em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: var(--ref-hint-bg); color: var(--ref-hint-text); border: outset 0.2em; white-space: normal; /* in case it's moved into a pre */ } .ref-hint * { margin: 0; padding: 0; text-indent: 0; } .ref-hint ul { padding: 0 0 0 1em; list-style: none; } </style> <style>/* Boilerplate: style-selflinks */ :root { --selflink-text: white; --selflink-bg: gray; --selflink-hover-text: black; } .heading, .issue, .note, .example, li, dt { position: relative; } a.self-link { position: absolute; top: 0; left: calc(-1 * (3.5rem - 26px)); width: calc(3.5rem - 26px); height: 2em; text-align: center; border: none; transition: opacity .2s; opacity: .5; } a.self-link:hover { opacity: 1; } .heading > a.self-link { font-size: 83%; } .example > a.self-link, .note > a.self-link, .issue > a.self-link { /* These blocks are overflow:auto, so positioning outside doesn't work. */ left: auto; right: 0; } li > a.self-link { left: calc(-1 * (3.5rem - 26px) - 2em); } dfn > a.self-link { top: auto; left: auto; opacity: 0; width: 1.5em; height: 1.5em; background: var(--selflink-bg); color: var(--selflink-text); font-style: normal; transition: opacity .2s, background-color .2s, color .2s; } dfn:hover > a.self-link { opacity: 1; } dfn > a.self-link:hover { color: var(--selflink-hover-text); } a.self-link::before { content: "¶"; } .heading > a.self-link::before { content: "§"; } dfn > a.self-link::before { content: "#"; } </style> <style>/* Boilerplate: style-syntax-highlighting */ code.highlight { padding: .1em; border-radius: .3em; } pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; } .highlight:not(.idl) { background: rgba(0, 0, 0, .03); } c-[a] { color: #990055 } /* Keyword.Declaration */ c-[b] { color: #990055 } /* Keyword.Type */ c-[c] { color: #708090 } /* Comment */ c-[d] { color: #708090 } /* Comment.Multiline */ c-[e] { color: #0077aa } /* Name.Attribute */ c-[f] { color: #669900 } /* Name.Tag */ c-[g] { color: #222222 } /* Name.Variable */ c-[k] { color: #990055 } /* Keyword */ c-[l] { color: #000000 } /* Literal */ c-[m] { color: #000000 } /* Literal.Number */ c-[n] { color: #0077aa } /* Name */ c-[o] { color: #999999 } /* Operator */ c-[p] { color: #999999 } /* Punctuation */ c-[s] { color: #a67f59 } /* Literal.String */ c-[t] { color: #a67f59 } /* Literal.String.Single */ c-[u] { color: #a67f59 } /* Literal.String.Double */ c-[cp] { color: #708090 } /* Comment.Preproc */ c-[c1] { color: #708090 } /* Comment.Single */ c-[cs] { color: #708090 } /* Comment.Special */ c-[kc] { color: #990055 } /* Keyword.Constant */ c-[kn] { color: #990055 } /* Keyword.Namespace */ c-[kp] { color: #990055 } /* Keyword.Pseudo */ c-[kr] { color: #990055 } /* Keyword.Reserved */ c-[ld] { color: #000000 } /* Literal.Date */ c-[nc] { color: #0077aa } /* Name.Class */ c-[no] { color: #0077aa } /* Name.Constant */ c-[nd] { color: #0077aa } /* Name.Decorator */ c-[ni] { color: #0077aa } /* Name.Entity */ c-[ne] { color: #0077aa } /* Name.Exception */ c-[nf] { color: #0077aa } /* Name.Function */ c-[nl] { color: #0077aa } /* Name.Label */ c-[nn] { color: #0077aa } /* Name.Namespace */ c-[py] { color: #0077aa } /* Name.Property */ c-[ow] { color: #999999 } /* Operator.Word */ c-[mb] { color: #000000 } /* Literal.Number.Bin */ c-[mf] { color: #000000 } /* Literal.Number.Float */ c-[mh] { color: #000000 } /* Literal.Number.Hex */ c-[mi] { color: #000000 } /* Literal.Number.Integer */ c-[mo] { color: #000000 } /* Literal.Number.Oct */ c-[sb] { color: #a67f59 } /* Literal.String.Backtick */ c-[sc] { color: #a67f59 } /* Literal.String.Char */ c-[sd] { color: #a67f59 } /* Literal.String.Doc */ c-[se] { color: #a67f59 } /* Literal.String.Escape */ c-[sh] { color: #a67f59 } /* Literal.String.Heredoc */ c-[si] { color: #a67f59 } /* Literal.String.Interpol */ c-[sx] { color: #a67f59 } /* Literal.String.Other */ c-[sr] { color: #a67f59 } /* Literal.String.Regex */ c-[ss] { color: #a67f59 } /* Literal.String.Symbol */ c-[vc] { color: #0077aa } /* Name.Variable.Class */ c-[vg] { color: #0077aa } /* Name.Variable.Global */ c-[vi] { color: #0077aa } /* Name.Variable.Instance */ c-[il] { color: #000000 } /* Literal.Number.Integer.Long */ @media (prefers-color-scheme: dark) { .highlight:not(.idl) { background: rgba(255, 255, 255, .05); } c-[a] { color: #d33682 } /* Keyword.Declaration */ c-[b] { color: #d33682 } /* Keyword.Type */ c-[c] { color: #2aa198 } /* Comment */ c-[d] { color: #2aa198 } /* Comment.Multiline */ c-[e] { color: #268bd2 } /* Name.Attribute */ c-[f] { color: #b58900 } /* Name.Tag */ c-[g] { color: #cb4b16 } /* Name.Variable */ c-[k] { color: #d33682 } /* Keyword */ c-[l] { color: #657b83 } /* Literal */ c-[m] { color: #657b83 } /* Literal.Number */ c-[n] { color: #268bd2 } /* Name */ c-[o] { color: #657b83 } /* Operator */ c-[p] { color: #657b83 } /* Punctuation */ c-[s] { color: #6c71c4 } /* Literal.String */ c-[t] { color: #6c71c4 } /* Literal.String.Single */ c-[u] { color: #6c71c4 } /* Literal.String.Double */ c-[ch] { color: #2aa198 } /* Comment.Hashbang */ c-[cp] { color: #2aa198 } /* Comment.Preproc */ c-[cpf] { color: #2aa198 } /* Comment.PreprocFile */ c-[c1] { color: #2aa198 } /* Comment.Single */ c-[cs] { color: #2aa198 } /* Comment.Special */ c-[kc] { color: #d33682 } /* Keyword.Constant */ c-[kn] { color: #d33682 } /* Keyword.Namespace */ c-[kp] { color: #d33682 } /* Keyword.Pseudo */ c-[kr] { color: #d33682 } /* Keyword.Reserved */ c-[ld] { color: #657b83 } /* Literal.Date */ c-[nc] { color: #268bd2 } /* Name.Class */ c-[no] { color: #268bd2 } /* Name.Constant */ c-[nd] { color: #268bd2 } /* Name.Decorator */ c-[ni] { color: #268bd2 } /* Name.Entity */ c-[ne] { color: #268bd2 } /* Name.Exception */ c-[nf] { color: #268bd2 } /* Name.Function */ c-[nl] { color: #268bd2 } /* Name.Label */ c-[nn] { color: #268bd2 } /* Name.Namespace */ c-[py] { color: #268bd2 } /* Name.Property */ c-[ow] { color: #657b83 } /* Operator.Word */ c-[mb] { color: #657b83 } /* Literal.Number.Bin */ c-[mf] { color: #657b83 } /* Literal.Number.Float */ c-[mh] { color: #657b83 } /* Literal.Number.Hex */ c-[mi] { color: #657b83 } /* Literal.Number.Integer */ c-[mo] { color: #657b83 } /* Literal.Number.Oct */ c-[sa] { color: #6c71c4 } /* Literal.String.Affix */ c-[sb] { color: #6c71c4 } /* Literal.String.Backtick */ c-[sc] { color: #6c71c4 } /* Literal.String.Char */ c-[dl] { color: #6c71c4 } /* Literal.String.Delimiter */ c-[sd] { color: #6c71c4 } /* Literal.String.Doc */ c-[se] { color: #6c71c4 } /* Literal.String.Escape */ c-[sh] { color: #6c71c4 } /* Literal.String.Heredoc */ c-[si] { color: #6c71c4 } /* Literal.String.Interpol */ c-[sx] { color: #6c71c4 } /* Literal.String.Other */ c-[sr] { color: #6c71c4 } /* Literal.String.Regex */ c-[ss] { color: #6c71c4 } /* Literal.String.Symbol */ c-[fm] { color: #268bd2 } /* Name.Function.Magic */ c-[vc] { color: #cb4b16 } /* Name.Variable.Class */ c-[vg] { color: #cb4b16 } /* Name.Variable.Global */ c-[vi] { color: #cb4b16 } /* Name.Variable.Instance */ c-[vm] { color: #cb4b16 } /* Name.Variable.Magic */ c-[il] { color: #657b83 } /* Literal.Number.Integer.Long */ } </style> <link href="https://www.w3.org/StyleSheets/TR/2021/W3C-WD" rel="stylesheet"> <link href="https://www.w3.org/StyleSheets/TR/2021/dark.css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css"> <body class="h-entry"> <div class="head"> <p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p> <h1 class="p-name no-ref" id="title">CSS Animations Level 1</h1> <p id="w3c-state"><a href="https://www.w3.org/standards/types/#WD">W3C Working Draft</a>, <time class="dt-updated" datetime="2023-12-08">8 December 2023</time></p> <details open> <summary>More details about this document</summary> <div data-fill-with="spec-metadata"> <dl> <dt>This version: <dd><a class="u-url" href="https://www.w3.org/TR/2023/WD-css-animations-1-20231208/">https://www.w3.org/TR/2023/WD-css-animations-1-20231208/</a> <dt>Latest published version: <dd><a href="https://www.w3.org/TR/css-animations-1/">https://www.w3.org/TR/css-animations-1/</a> <dt>Editor's Draft: <dd><a href="https://drafts.csswg.org/css-animations/">https://drafts.csswg.org/css-animations/</a> <dt>Previous Versions: <dd><a href="https://www.w3.org/TR/2018/WD-css-animations-1-20181011/" rel="prev">https://www.w3.org/TR/2018/WD-css-animations-1-20181011/</a> <dd><a href="https://www.w3.org/TR/2017/WD-css-animations-1-20171130/" rel="prev">https://www.w3.org/TR/2017/WD-css-animations-1-20171130/</a> <dd><a href="https://www.w3.org/TR/2013/WD-css3-animations-20130219/" rel="prev">https://www.w3.org/TR/2013/WD-css3-animations-20130219/</a> <dd><a href="https://www.w3.org/TR/2012/WD-css3-animations-20120403/" rel="prev">https://www.w3.org/TR/2012/WD-css3-animations-20120403/</a> <dt>History: <dd><a class="u-url" href="https://www.w3.org/standards/history/css-animations-1/">https://www.w3.org/standards/history/css-animations-1/</a> <dt>Feedback: <dd><a href="https://github.com/w3c/csswg-drafts/labels/css-animations-1">CSSWG Issues Repository</a> <dd><a href="#issues-index">Inline In Spec</a> <dt class="editor">Editors: <dd class="editor p-author h-card vcard" data-editor-id="42080"><a class="p-name fn u-email email" href="mailto:dino@apple.com">Dean Jackson</a> (<span class="p-org org">Apple Inc.</span>) <dd class="editor p-author h-card vcard" data-editor-id="15393"><a class="p-name fn u-url url" href="https://dbaron.org/">L. David Baron</a> (<a class="p-org org" href="https://www.google.com/">Google</a>) <dd class="editor p-author h-card vcard" data-editor-id="42199"><a class="p-name fn u-url url" href="http://xanthir.com/contact/">Tab Atkins Jr.</a> (<span class="p-org org">Google</span>) <dd class="editor p-author h-card vcard" data-editor-id="43194"><a class="p-name fn u-email email" href="mailto:brian@birchill.co.jp">Brian Birtles</a> (<span class="p-org org">Invited Expert</span>) <dt class="editor">Former Editors: <dd class="editor p-author h-card vcard"><span class="p-name fn">David Hyatt</span> (<span class="p-org org">Apple Inc.</span>) <dd class="editor p-author h-card vcard"><span class="p-name fn">Chris Marrin</span> (<span class="p-org org">Apple Inc.</span>) <dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:galineau@adobe.com">Sylvain Galineau</a> (<span class="p-org org">Adobe</span>) <dt>Suggest an Edit for this Spec: <dd><a href="https://github.com/w3c/csswg-drafts/blob/main/css-animations-1/Overview.bs">GitHub Editor</a> <dt>Issues List: <dd>https://github.com/w3c/csswg-drafts/labels/css-animations-1 </dl> </div> </details> <div data-fill-with="warning"></div> <p class="copyright" data-fill-with="copyright"><a href="https://www.w3.org/policies/#copyright">Copyright</a> © 2023 <a href="https://www.w3.org/">World Wide Web Consortium</a>. <abbr title="World Wide Web Consortium">W3C</abbr><sup>®</sup> <a href="https://www.w3.org/policies/#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/policies/#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/copyright/software-license/" rel="license" title="W3C Software and Document License">permissive document license</a> rules apply. </p> <hr title="Separator for header"> </div> <div class="p-summary" data-fill-with="abstract"> <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2> <p>This CSS module describes a way for authors to animate the values of CSS properties over time, using keyframes. The behavior of these keyframe animations can be controlled by specifying their duration, number of repeats, and repeating behavior.</p> <a href="https://www.w3.org/TR/CSS/">CSS</a> is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, etc. <script> const githubPrefix = "https://w3c.github.io/csswg-drafts/"; if(location.href.slice(0, githubPrefix.length) == githubPrefix) { const suffix = location.href.slice(githubPrefix.length); const draftUrl = "https://drafts.csswg.org/" + suffix; window.location.replace(draftUrl); } </script> </div> <h2 class="no-num no-toc no-ref heading settled" id="sotd"><span class="content">Status of this document</span></h2> <div data-fill-with="status"> <p><em>This section describes the status of this document at the time of its publication. A list of current W3C publications and the latest revision of this technical report can be found in the <a href="https://www.w3.org/TR/">W3C technical reports index at https://www.w3.org/TR/.</a></em> </p> <p> This document was published by the <a href="https://www.w3.org/groups/wg/css">CSS Working Group</a> as a <strong>Working Draft</strong> using the <a href="https://www.w3.org/policies/process/20231103/#recs-and-notes">Recommendation track</a>. Publication as a Working Draft does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. </p> <p> This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. </p> <p>Please send feedback by <a href="https://github.com/w3c/csswg-drafts/issues">filing issues in GitHub</a> (preferred), including the spec code “css-animations” in the title, like this: “[css-animations] <i>…summary of comment…</i>”. All issues and comments are <a href="https://lists.w3.org/Archives/Public/public-css-archive/">archived</a>. Alternately, feedback can be sent to the (<a href="https://lists.w3.org/Archives/Public/www-style/">archived</a>) public mailing list <a href="mailto:www-style@w3.org?Subject=%5Bcss-animations%5D%20PUT%20SUBJECT%20HERE">www-style@w3.org</a>. </p> <p>This document is governed by the <a href="https://www.w3.org/policies/process/20231103/" id="w3c_process_revision">03 November 2023 W3C Process Document</a>. </p> <p>This document was produced by a group operating under the <a href="https://www.w3.org/policies/patent-policy/20200915/">W3C Patent Policy</a>. W3C maintains a <a href="https://www.w3.org/groups/wg/css/ipr" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="https://www.w3.org/policies/patent-policy/20200915/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/policies/patent-policy/20200915/#sec-Disclosure">section 6 of the W3C Patent Policy</a>. </p> <p></p> </div> <div data-fill-with="at-risk"></div> <nav data-fill-with="table-of-contents" id="toc"> <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2> <ol class="toc" role="directory"> <li> <a href="#intro"><span class="secno">1</span> <span class="content"> Introduction</span></a> <ol class="toc"> <li><a href="#values"><span class="secno">1.1</span> <span class="content"> Value Definitions</span></a> </ol> <li><a href="#animations"><span class="secno">2</span> <span class="content"> CSS Animations Model</span></a> <li> <a href="#keyframes"><span class="secno">3</span> <span class="content"> Declaring Keyframes</span></a> <ol class="toc"> <li><a href="#timing-functions"><span class="secno">3.1</span> <span class="content"> Timing functions for keyframes</span></a> </ol> <li> <a href="#animation-definition"><span class="secno">4</span> <span class="content"> Declaring Animations</span></a> <ol class="toc"> <li><a href="#animation-name"><span class="secno">4.1</span> <span class="content"> The <span class="property">animation-name</span> property</span></a> <li><a href="#animation-duration"><span class="secno">4.2</span> <span class="content"> The <span class="property">animation-duration</span> property</span></a> <li><a href="#animation-timing-function"><span class="secno">4.3</span> <span class="content"> The <span class="property">animation-timing-function</span> property</span></a> <li><a href="#animation-iteration-count"><span class="secno">4.4</span> <span class="content"> The <span class="property">animation-iteration-count</span> property</span></a> <li><a href="#animation-direction"><span class="secno">4.5</span> <span class="content"> The <span class="property">animation-direction</span> property</span></a> <li><a href="#animation-play-state"><span class="secno">4.6</span> <span class="content"> The <span class="property">animation-play-state</span> property</span></a> <li><a href="#animation-delay"><span class="secno">4.7</span> <span class="content"> The <span class="property">animation-delay</span> property</span></a> <li><a href="#animation-fill-mode"><span class="secno">4.8</span> <span class="content"> The <span class="property">animation-fill-mode</span> property</span></a> <li><a href="#animation"><span class="secno">4.9</span> <span class="content"> The <span class="property">animation</span> shorthand property</span></a> </ol> <li> <a href="#events"><span class="secno">5</span> <span class="content"> Animation Events</span></a> <ol class="toc"> <li> <a href="#interface-animationevent"><span class="secno">5.1</span> <span class="content"> The <code>AnimationEvent</code> Interface</span></a> <ol class="toc"> <li><a href="#interface-animationevent-idl"><span class="secno">5.1.1</span> <span class="content"> IDL Definition</span></a> <li><a href="#interface-animationevent-attributes"><span class="secno">5.1.2</span> <span class="content"> Attributes</span></a> </ol> <li><a href="#event-animationevent"><span class="secno">5.2</span> <span class="content"> Types of <code>AnimationEvent</code></span></a> <li><a href="#event-handlers-on-elements-document-objects-and-window-objects"><span class="secno">5.3</span> <span class="content">Event handlers on elements, <code>Document</code> objects, and <code>Window</code> objects</span></a> </ol> <li> <a href="#interface-dom"><span class="secno">6</span> <span class="content"> DOM Interfaces</span></a> <ol class="toc"> <li> <a href="#interface-cssrule"><span class="secno">6.1</span> <span class="content"> The <code>CSSRule</code> Interface</span></a> <ol class="toc"> <li><a href="#interface-cssrule-idl"><span class="secno">6.1.1</span> <span class="content"> IDL Definition</span></a> </ol> <li> <a href="#interface-csskeyframerule"><span class="secno">6.2</span> <span class="content"> The <code>CSSKeyframeRule</code> Interface</span></a> <ol class="toc"> <li><a href="#interface-csskeyframerule-idl"><span class="secno">6.2.1</span> <span class="content"> IDL Definition</span></a> <li><a href="#interface-csskeyframerule-attributes"><span class="secno">6.2.2</span> <span class="content"> Attributes</span></a> </ol> <li> <a href="#interface-csskeyframesrule"><span class="secno">6.3</span> <span class="content"> The <code>CSSKeyframesRule</code> Interface</span></a> <ol class="toc"> <li><a href="#interface-csskeyframesrule-idl"><span class="secno">6.3.1</span> <span class="content"> IDL Definition</span></a> <li><a href="#interface-csskeyframesrule-attributes"><span class="secno">6.3.2</span> <span class="content"> Attributes</span></a> <li><a href="#interface-csskeyframesrule-indexed-property-getter"><span class="secno">6.3.3</span> <span class="content"> The indexed property getter</span></a> <li><a href="#interface-csskeyframesrule-appendrule"><span class="secno">6.3.4</span> <span class="content"> The <code>appendRule</code> method</span></a> <li><a href="#interface-csskeyframesrule-deleterule"><span class="secno">6.3.5</span> <span class="content"> The <code>deleteRule</code> method</span></a> <li><a href="#interface-csskeyframesrule-findrule"><span class="secno">6.3.6</span> <span class="content"> The <code>findRule</code> method</span></a> </ol> <li> <a href="#interface-globaleventhandlers"><span class="secno">6.4</span> <span class="content"> Extensions to the <code>GlobalEventHandlers</code> Interface Mixin</span></a> <ol class="toc"> <li><a href="#interface-globaleventhandlers-idl"><span class="secno">6.4.1</span> <span class="content"> IDL Definition</span></a> </ol> </ol> <li><a href="#priv"><span class="secno">7</span> <span class="content"> Privacy Considerations</span></a> <li><a href="#sec"><span class="secno">8</span> <span class="content"> Security Considerations</span></a> <li> <a href="#changes"><span class="secno">9</span> <span class="content">Changes</span></a> <ol class="toc"> <li><a href="#changes-20181011"><span class="secno">9.1</span> <span class="content">Changes since the <span>Working Draft of 11 October 2018</span></span></a> </ol> <li><a href="#acknowledgements"><span class="secno">10</span> <span class="content"> Acknowledgements</span></a> <li><a href="#other-open-issues"><span class="secno">11</span> <span class="content">Other open issues</span></a> <li><a href="#wg-resolutions-pending"><span class="secno">12</span> <span class="content"> Working Group Resolutions that are pending editing</span></a> <li> <a href="#w3c-conformance"><span class="secno"></span> <span class="content"> Conformance</span></a> <ol class="toc"> <li><a href="#w3c-conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a> <li><a href="#w3c-conformance-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a> <li> <a href="#w3c-partial"><span class="secno"></span> <span class="content"> Partial implementations</span></a> <ol class="toc"> <li><a href="#w3c-conform-future-proofing"><span class="secno"></span> <span class="content"> Implementations of Unstable and Proprietary Features</span></a> </ol> <li><a href="#w3c-testing"><span class="secno"></span> <span class="content"> Non-experimental implementations</span></a> </ol> <li> <a href="#index"><span class="secno"></span> <span class="content">Index</span></a> <ol class="toc"> <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a> <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a> </ol> <li> <a href="#references"><span class="secno"></span> <span class="content">References</span></a> <ol class="toc"> <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a> <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a> </ol> <li><a href="#property-index"><span class="secno"></span> <span class="content">Property Index</span></a> <li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a> <li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a> </ol> </nav> <main> <h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content"> Introduction</span><a class="self-link" href="#intro"></a></h2> <p><em>This section is not normative</em></p> <p>CSS Transitions <a data-link-type="biblio" href="#biblio-css3-transitions" title="CSS Transitions">[CSS3-TRANSITIONS]</a> provide a way to interpolate CSS property values when they change as a result of underlying property changes. This provides an easy way to do simple animation, but the start and end states of the animation are controlled by the existing property values, and transitions provide little control to the author on how the animation progresses.</p> <p>This proposal introduces defined animations, in which the author can specify the changes in CSS properties over time as a set of keyframes. Animations are similar to transitions in that they change the presentational value of CSS properties over time. The principal difference is that while transitions trigger implicitly when property values change, animations are explicitly executed when the animation properties are applied. Because of this, animations require explicit values for the properties being animated. These values are specified using animation keyframes, described below.</p> <p>Many aspects of the animation can be controlled, including how many times the animation iterates, whether or not it alternates between the begin and end values, and whether or not the animation should be running or paused. An animation can also delay its start time.</p> <h3 class="heading settled" data-level="1.1" id="values"><span class="secno">1.1. </span><span class="content"> Value Definitions</span><a class="self-link" href="#values"></a></h3> <p>This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from <a data-link-type="biblio" href="#biblio-css2" title="Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification">[CSS2]</a> using the <a href="https://www.w3.org/TR/css-values-3/#value-defs">value definition syntax</a> from <a data-link-type="biblio" href="#biblio-css-values-3" title="CSS Values and Units Module Level 3">[CSS-VALUES-3]</a>. Value types not defined in this specification are defined in CSS Values &amp; Units <span title="CSS Values and Units Module Level 3">[CSS-VALUES-3]</span>. Combination with other CSS modules may expand the definitions of these value types.</p> <p>In addition to the property-specific values listed in their definitions, all properties defined in this specification also accept the <a data-link-type="dfn" href="https://www.w3.org/TR/css-values-4/#css-wide-keywords" id="ref-for-css-wide-keywords">CSS-wide keywords</a> as their property value. For readability they have not been repeated explicitly.</p> <h2 class="heading settled" data-level="2" id="animations"><span class="secno">2. </span><span class="content"> CSS Animations Model</span><a class="self-link" href="#animations"></a></h2> <p>CSS Animations affect computed property values. This effect happens by adding a specified value to the CSS cascade (<a data-link-type="biblio" href="#biblio-css3cascade" title="CSS Cascading and Inheritance Level 3">[CSS3CASCADE]</a>) (at the level for CSS Animations) that will produce the correct computed value for the current state of the animation. As defined in <span title="CSS Cascading and Inheritance Level 3">[CSS3CASCADE]</span>, animations override all normal rules, but are overridden by !important rules.</p> <p>If at some point in time there are multiple animations specifying behavior for the same property, the animation which occurs last in the value of <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name">animation-name</a> will override the other animations at that point.</p> <p>An animation does not affect the computed value before the application of the animation (that is, when the <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name①">animation-name</a> property is set on an element) or after it is removed. Furthermore, typically an animation does not affect the computed value before the animation delay has expired or after the end of the animation, but may do so depending on the <a class="property css" data-link-type="property" href="#propdef-animation-fill-mode" id="ref-for-propdef-animation-fill-mode">animation-fill-mode</a> property.</p> <p>While running, the animation computes the value of those properties it animates. Other values may take precedence over the animated value according to the CSS cascade (<a data-link-type="biblio" href="#biblio-css3cascade" title="CSS Cascading and Inheritance Level 3">[CSS3CASCADE]</a>).</p> <p>While an animation is applied but has not finished, or has finished but has an <a class="property css" data-link-type="property" href="#propdef-animation-fill-mode" id="ref-for-propdef-animation-fill-mode①">animation-fill-mode</a> of <a class="css" data-link-type="maybe" href="#valdef-animation-fill-mode-forwards" id="ref-for-valdef-animation-fill-mode-forwards">forwards</a> or <a class="css" data-link-type="maybe" href="#valdef-animation-fill-mode-both" id="ref-for-valdef-animation-fill-mode-both">both</a>, the user agent must act as if the <a class="property css" data-link-type="property" href="https://www.w3.org/TR/css-will-change-1/#propdef-will-change" id="ref-for-propdef-will-change">will-change</a> property (<a data-link-type="biblio" href="#biblio-css-will-change-1" title="CSS Will Change Module Level 1">[css-will-change-1]</a>) on the element additionally includes all the properties animated by the animation.</p> <p>The start time of an animation is the time at which the style applying the animation and the corresponding @keyframes rule are both resolved. If an animation is specified for an element but the corresponding @keyframes rule does not yet exist, the animation cannot start; the animation will start from the beginning as soon as a matching @keyframes rule can be resolved. An animation specified by dynamically modifying the element’s style will start when this style is resolved; that may be immediately in the case of a pseudo style rule such as hover, or may be when the scripting engine returns control to the browser (in the case of style applied by script). Note that dynamically updating keyframe style rules does not start or re-start an animation.</p> <p>An animation applies to an element if its name appears as one of the identifiers in the computed value of the <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name②">animation-name</a> property and the animation uses a valid @keyframes rule. Once an animation has started it continues until it ends or the <span class="property" id="ref-for-propdef-animation-name③">animation-name</span> is removed. Changes to the values of animation properties while the animation is running apply as if the animation had those values from when it began. For example, shortening the <a class="property css" data-link-type="property" href="#propdef-animation-delay" id="ref-for-propdef-animation-delay">animation-delay</a> may cause the animation to jump forwards or even finish immediately and dispatch an <code class="idl"><a data-link-type="idl" href="#eventdef-globaleventhandlers-animationend" id="ref-for-eventdef-globaleventhandlers-animationend">animationend</a></code> event. Conversely, extending the <span class="property" id="ref-for-propdef-animation-delay①">animation-delay</span> may cause an animation to re-start and dispatch an <code class="idl"><a data-link-type="idl" href="#eventdef-globaleventhandlers-animationstart" id="ref-for-eventdef-globaleventhandlers-animationstart">animationstart</a></code> event.</p> <p>The same @keyframes rule name may be repeated within an <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name④">animation-name</a>. Changes to the <span class="property" id="ref-for-propdef-animation-name⑤">animation-name</span> update existing animations by iterating over the new list of animations from last to first, and, for each animation, finding the <em>last</em> matching animation in the list of existing animations. If a match is found, the existing animation is updated using the animation properties corresponding to its position in the new list of animations, whilst maintaining its current playback time as described above. The matching animation is removed from the existing list of animations such that it will not match twice. If a match is not found, a new animation is created. As a result, updating <span class="property" id="ref-for-propdef-animation-name⑥">animation-name</span> from ‘a’ to ‘a, a’ will cause the existing animation for ‘a’ to become the <em>second</em> animation in the list and a new animation will be created for the first item in the list.</p> <div class="example" id="example-4e34d7ba"> <a class="self-link" href="#example-4e34d7ba"></a> <pre>div { animation-name: diagonal-slide; animation-duration: 5s; animation-iteration-count: 10; } @keyframes diagonal-slide { from { left: 0; top: 0; } to { left: 100px; top: 100px; } } </pre> <p>This will produce an animation that moves an element from (0, 0) to (100px, 100px) over five seconds and repeats itself nine times (for a total of ten iterations).</p> </div> <p>Setting the <a class="property css" data-link-type="property" href="https://www.w3.org/TR/css-display-3/#propdef-display" id="ref-for-propdef-display">display</a> property to <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-display-3/#valdef-display-none" id="ref-for-valdef-display-none">none</a> will terminate any running animation applied to the element and its descendants. If an element has a <span class="property" id="ref-for-propdef-display①">display</span> of <span class="css" id="ref-for-valdef-display-none①">none</span>, updating <span class="property" id="ref-for-propdef-display②">display</span> to a value other than <span class="css" id="ref-for-valdef-display-none②">none</span> will start all animations applied to the element by the <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name⑦">animation-name</a> property, as well as all animations applied to descendants with <span class="property" id="ref-for-propdef-display③">display</span> other than <span class="css" id="ref-for-valdef-display-none③">none</span>.</p> <p>While authors can use animations to create dynamically changing content, dynamically changing content can lead to seizures in some users. For information on how to avoid content that can lead to seizures, see Guideline 2.3: Seizures: Do not design content in a way that is known to cause seizures (<a data-link-type="biblio" href="#biblio-wcag20" title="Web Content Accessibility Guidelines (WCAG) 2.0">[WCAG20]</a>).</p> <p>Implementations may ignore animations when the rendering medium is not interactive e.g. when printed. A future version of this specification may define how to render animations for these media.</p> <h2 class="heading settled" data-level="3" id="keyframes"><span class="secno">3. </span><span class="content"> Declaring Keyframes</span><a class="self-link" href="#keyframes"></a></h2> <p>Keyframes are used to specify the values for the animating properties at various points during the animation. The keyframes specify the behavior of one cycle of the animation; the animation may iterate zero or more times.</p> <p>Keyframes are specified using the <dfn class="dfn-paneled css" data-dfn-type="at-rule" data-export id="at-ruledef-keyframes">@keyframes</dfn> at-rule, defined as follows:</p> <pre>@keyframes = @keyframes <a class="production" data-link-type="type" href="#typedef-keyframes-name" id="ref-for-typedef-keyframes-name">&lt;keyframes-name></a> { <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-qualified-rule-list" id="ref-for-typedef-qualified-rule-list">&lt;qualified-rule-list></a> } <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-keyframes-name">&lt;keyframes-name></dfn> = <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value" id="ref-for-identifier-value">&lt;custom-ident></a> | <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#string-value" id="ref-for-string-value">&lt;string></a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-keyframe-block">&lt;keyframe-block></dfn> = <a class="production" data-link-type="type" href="#typedef-keyframe-selector" id="ref-for-typedef-keyframe-selector">&lt;keyframe-selector></a># { <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-syntax-3/#typedef-declaration-list" id="ref-for-typedef-declaration-list">&lt;declaration-list></a> } <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-keyframe-selector">&lt;keyframe-selector></dfn> = from | to | <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#percentage-value" id="ref-for-percentage-value">&lt;percentage [0,100]></a> </pre> <p>The <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-syntax-3/#typedef-rule-list" id="ref-for-typedef-rule-list">&lt;rule-list></a> inside of <a class="css" data-link-type="maybe" href="#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes">@keyframes</a> can only contain <a class="production css" data-link-type="type" href="#typedef-keyframe-block" id="ref-for-typedef-keyframe-block">&lt;keyframe-block></a> rules.</p> <p>The <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-syntax-3/#typedef-declaration-list" id="ref-for-typedef-declaration-list①">&lt;declaration-list></a> inside of <a class="production css" data-link-type="type" href="#typedef-keyframe-block" id="ref-for-typedef-keyframe-block①">&lt;keyframe-block></a> accepts any CSS property except those defined in this specification, but <em>does</em> accept the <a class="property css" data-link-type="property" href="#propdef-animation-timing-function" id="ref-for-propdef-animation-timing-function">animation-timing-function</a> property and interprets it specially. None of the properties interact with the cascade (so using <span class="css">!important</span> on them is invalid and will cause the property to be ignored).</p> <p>A <a class="css" data-link-type="maybe" href="#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes①">@keyframes</a> block has a name given by the <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value" id="ref-for-identifier-value①">&lt;custom-ident></a> or <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#string-value" id="ref-for-string-value①">&lt;string></a> in its prelude. The two syntaxes are equivalent in functionality; the name is the value of the ident or string. As normal for <span class="production" id="ref-for-identifier-value②">&lt;custom-ident></span>s and <span class="production" id="ref-for-string-value②">&lt;string></span>s, the names are fully <a data-link-type="dfn" href="https://www.w3.org/TR/i18n-glossary/#dfn-case-sensitive" id="ref-for-dfn-case-sensitive">case-sensitive</a>; two names are equal only if they are codepoint-by-codepoint equal. The <span class="production" id="ref-for-identifier-value③">&lt;custom-ident></span> additionally excludes the <a class="css" data-link-type="maybe" href="#valdef-animation-name-none" id="ref-for-valdef-animation-name-none">none</a> keyword.</p> <div class="example" id="example-d0936079"> <a class="self-link" href="#example-d0936079"></a> For example, the following two <a class="css" data-link-type="maybe" href="#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes②">@keyframes</a> rules have the same name, so the first will be ignored: <pre class="lang-css highlight"><c- n>@keyframes</c-> foo <c- p>{</c-> <c- c>/* ... */</c-> <c- p>}</c-> <c- n>@keyframes</c-> <c- s>"foo"</c-> <c- p>{</c-> <c- c>/* ... */</c-> <c- p>}</c-> </pre> <p>On the other hand, the following <a class="css" data-link-type="maybe" href="#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes③">@keyframes</a> rule’s name is <em>different</em> from the previous two rules:</p> <pre class="lang-css highlight"><c- n>@keyframes</c-> FOO <c- p>{</c-> <c- c>/* ... */</c-> <c- p>}</c-> </pre> <p>The following <a class="css" data-link-type="maybe" href="#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes④">@keyframes</a> rules are invalid because they use disallowed <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value" id="ref-for-identifier-value④">&lt;custom-ident></a> values:</p> <pre class="lang-css highlight"><c- n>@keyframes</c-> initial <c- p>{</c-> <c- c>/* ... */</c-> <c- p>}</c-> <c- n>@keyframes</c-> None <c- p>{</c-> <c- c>/* ... */</c-> <c- p>}</c-> </pre> <p>However, those names <em>can</em> be specified with a <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#string-value" id="ref-for-string-value③">&lt;string></a>, so the following are both <em>valid</em>:</p> <pre class="lang-css highlight"><c- n>@keyframes</c-> <c- s>"initial"</c-> <c- p>{</c-> <c- c>/* ... */</c-> <c- p>}</c-> <c- n>@keyframes</c-> <c- s>"None"</c-> <c- p>{</c-> <c- c>/* ... */</c-> <c- p>}</c-> </pre> </div> <p>The <a class="production css" data-link-type="type" href="#typedef-keyframe-selector" id="ref-for-typedef-keyframe-selector①">&lt;keyframe-selector></a> for a <a class="production css" data-link-type="type" href="#typedef-keyframe-block" id="ref-for-typedef-keyframe-block②">&lt;keyframe-block></a> consists of a comma-separated list of percentage values or the keywords <span class="css">from</span> or <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-shapes-2/#valdef-shape-to" id="ref-for-valdef-shape-to">to</a>. The selector is used to specify the percentage along the duration of the animation that the keyframe represents. The keyframe itself is specified by the block of property values declared on the selector. The keyword <span class="css">from</span> is equivalent to the value <span class="css">0%</span>. The keyword <span class="css" id="ref-for-valdef-shape-to①">to</span> is equivalent to the value <span class="css">100%</span>. Values less than <span class="css">0%</span> or higher than <span class="css">100%</span> are invalid and cause their <span class="production" id="ref-for-typedef-keyframe-block③">&lt;keyframe-block></span> to be ignored.</p> <p class="note" role="note"><span class="marker">Note:</span> Note that the percentage unit specifier must be used on percentage values. Therefore, <span class="css">0</span> is an invalid keyframe selector.</p> <p>If a <span class="css">0%</span> or <span class="css">from</span> keyframe is not specified, then the user agent constructs a <span class="css">0%</span> keyframe using the computed values of the properties being animated. If a <span class="css">100%</span> or <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-shapes-2/#valdef-shape-to" id="ref-for-valdef-shape-to②">to</a> keyframe is not specified, then the user agent constructs a <span class="css">100%</span> keyframe using the computed values of the properties being animated.</p> <p>The <a class="production css" data-link-type="type" href="#typedef-keyframe-block" id="ref-for-typedef-keyframe-block④">&lt;keyframe-block></a> contains properties and values. The properties defined by this specification are ignored in these rules, with the exception of <a class="property css" data-link-type="property" href="#propdef-animation-timing-function" id="ref-for-propdef-animation-timing-function①">animation-timing-function</a>, the behavior of which is described below. In addition, properties qualified with !important are invalid and ignored.</p> <p>If multiple <a class="css" data-link-type="maybe" href="#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes⑤">@keyframes</a> rules are defined with the same name, the last one in document order wins, and all preceding ones are ignored.</p> <div class="example" id="example-b784185b"> <a class="self-link" href="#example-b784185b"></a> <pre>div { animation-name: slide-right; animation-duration: 2s; } @keyframes slide-right { from { margin-left: 0px; } 50% { margin-left: 110px; opacity: 1; } 50% { opacity: 0.9; } to { margin-left: 200px; } } </pre> <p>The two 50% rules from above can also be combined into an equivalent single rule as illustrated below:</p> <pre>@keyframes slide-right { from { margin-left: 0px; } 50% { margin-left: 110px; opacity: 0.9; } to { margin-left: 200px; } } </pre> </div> <p>To determine the set of keyframes, all of the values in the selectors are sorted in increasing order by time. The rules within the <a class="css" data-link-type="maybe" href="#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes⑥">@keyframes</a> rule then cascade; the properties of a keyframe may thus derive from more than one <span class="css" id="ref-for-at-ruledef-keyframes⑦">@keyframes</span> rule with the same selector value.</p> <p>If a property is not specified for a keyframe, or is specified but invalid, the animation of that property proceeds as if that keyframe did not exist. Conceptually, it is as if a set of keyframes is constructed for each property that is present in any of the keyframes, and an animation is run independently for each property.</p> <div class="example" id="example-10d90bd9"> <a class="self-link" href="#example-10d90bd9"></a> <pre>@keyframes wobble { 0% { left: 100px; } 40% { left: 150px; } 60% { left: 75px; } 100% { left: 100px; } } </pre> <p>Four keyframes are specified for the animation named "wobble". In the first keyframe, shown at the beginning of the animation cycle, the value of the <a class="property css" data-link-type="property" href="https://www.w3.org/TR/CSS21/visuren.html#propdef-left" id="ref-for-propdef-left">left</a> property being animated is <span class="css">100px</span>. By 40% of the animation duration, <span class="property" id="ref-for-propdef-left①">left</span> has animated to <span class="css">150px</span>. At 60% of the animation duration, <span class="property" id="ref-for-propdef-left②">left</span> has animated back to <span class="css">75px</span>. At the end of the animation cycle, the value of <span class="property" id="ref-for-propdef-left③">left</span> has returned to <span class="css">100px</span>. The diagram below shows the state of the animation if it were given a duration of <span class="css">10s</span>.</p> <figure> <img alt height="546" src="images/animation1.png" width="504"> <figcaption>Animation states specified by keyframes</figcaption> </figure> </div> <p class="issue" id="issue-73aacf21"><a class="self-link" href="#issue-73aacf21"></a> This specification needs to define how the value is determined from the keyframes, like the section on <a href="https://drafts.csswg.org/css-transitions/#application">Application of transitions</a> does for CSS Transitions. </p> <h3 class="heading settled" data-level="3.1" id="timing-functions"><span class="secno">3.1. </span><span class="content"> Timing functions for keyframes</span><a class="self-link" href="#timing-functions"></a></h3> <p>A keyframe style rule may also declare the timing function that is to be used as the animation moves to the next keyframe.</p> <div class="example" id="example-a9d2ebec"> <a class="self-link" href="#example-a9d2ebec"></a> <pre>@keyframes bounce { from { top: 100px; animation-timing-function: ease-out; } 25% { top: 50px; animation-timing-function: ease-in; } 50% { top: 100px; animation-timing-function: ease-out; } 75% { top: 75px; animation-timing-function: ease-in; } to { top: 100px; } } </pre> <p>Five keyframes are specified for the animation named "bounce". Between the first and second keyframe (i.e., between 0% and 25%) an ease-out timing function is used. Between the second and third keyframe (i.e., between 25% and 50%) an ease-in timing function is used. And so on. The effect will appear as an element that moves up the page 50px, slowing down as it reaches its highest point then speeding up as it falls back to 100px. The second half of the animation behaves in a similar manner, but only moves the element 25px up the page.</p> </div> <p>A timing function specified on the <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-shapes-2/#valdef-shape-to" id="ref-for-valdef-shape-to③">to</a> or <span class="css">100%</span> keyframe is ignored.</p> <p>See the <a class="property css" data-link-type="property" href="#propdef-animation-timing-function" id="ref-for-propdef-animation-timing-function②">animation-timing-function</a> property for more information.</p> <h2 class="heading settled" data-level="4" id="animation-definition"><span class="secno">4. </span><span class="content"> Declaring Animations</span><a class="self-link" href="#animation-definition"></a></h2> <p>CSS Animations are defined by binding keyframes to an element using the <a class="property css" data-link-type="property">animation-*</a> properties. These list-valued properties, which are all <a data-link-type="dfn" href="https://www.w3.org/TR/css-cascade-5/#longhand" id="ref-for-longhand">longhands</a> of the <a class="property css" data-link-type="property" href="#propdef-animation" id="ref-for-propdef-animation">animation</a> <a data-link-type="dfn" href="https://www.w3.org/TR/css-cascade-5/#shorthand-property" id="ref-for-shorthand-property">shorthand</a>, form a <a data-link-type="dfn" href="https://www.w3.org/TR/css-values-4/#coordinating-list-property" id="ref-for-coordinating-list-property">coordinating list property group</a> with <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name⑧">animation-name</a> as the <a data-link-type="dfn" href="https://www.w3.org/TR/css-values-4/#coordinating-list-base-property" id="ref-for-coordinating-list-base-property">coordinating list base property</a> and each item in the <a data-link-type="dfn" href="https://www.w3.org/TR/css-values-4/#coordinated-value-list" id="ref-for-coordinated-value-list">coordinated value list</a> defining the properties of a single animation effect.</p> <p class="note" role="note"><span class="marker">Note:</span> This is analogous to the behavior of the <a class="property css" data-link-type="property">background-*</a> properties, with <a class="property css" data-link-type="property" href="https://www.w3.org/TR/CSS21/colors.html#propdef-background-image" id="ref-for-propdef-background-image">background-image</a> analogous to <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name⑨">animation-name</a>.</p> <p>See <a href="https://www.w3.org/TR/css-values-4/#linked-properties"><cite>CSS Values 4</cite> § A Coordinating List-Valued Properties</a> for how the individual <a class="property css" data-link-type="property">animation-*</a> property values coordinate.</p> <h3 class="heading settled" data-level="4.1" id="animation-name"><span class="secno">4.1. </span><span class="content"> The <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name①⓪">animation-name</a> property</span><a class="self-link" href="#animation-name"></a></h3> <p>The <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name①①">animation-name</a> property defines a list of animations that apply. Each name is used to select the keyframe at-rule that provides the property values for the animation. If the name does not match any keyframe at-rule, there are no properties to be animated and the animation will not execute. Furthermore, if the animation name is <code>none</code> then there will be no animation. This can be used to override any animations coming from the cascade. If multiple animations are attempting to modify the same property, then the animation closest to the end of the list of names wins.</p> <table class="def propdef" data-link-for-hint="animation-name"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-animation-name">animation-name</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod">[ none <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one">|</a> <a class="production css" data-link-type="type" href="#typedef-keyframes-name" id="ref-for-typedef-keyframes-name①">&lt;keyframes-name></a> ]<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-comma" id="ref-for-mult-comma">#</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>none <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td><a href="https://www.w3.org/TR/css-pseudo/#generated-content" title="Includes ::before and ::after pseudo-elements.">all elements</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>list, each item either a case-sensitive <a data-link-type="dfn" href="https://www.w3.org/TR/css-values-4/#css-css-identifier" id="ref-for-css-css-identifier">css identifier</a> or the keyword <a class="css" data-link-type="maybe" href="#valdef-animation-name-none" id="ref-for-valdef-animation-name-none①">none</a> <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>not animatable </table> <p>The values of <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name①②">animation-name</a> have the following meanings:</p> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="animation-name" data-dfn-type="value" data-export id="valdef-animation-name-none">none</dfn> <dd> No keyframes are specified at all, so there will be no animation. Any other animations properties specified for this animation have no effect. <dt><dfn class="dfn-paneled css" data-dfn-for="animation-name" data-dfn-type="value" data-export id="valdef-animation-name-keyframes-name"><a class="production css" data-link-type="type" href="#typedef-keyframes-name" id="ref-for-typedef-keyframes-name②">&lt;keyframes-name></a></dfn> <dd> The animation will use the keyframes with the name specified by the <a class="production css" data-link-type="type" href="#typedef-keyframes-name" id="ref-for-typedef-keyframes-name③">&lt;keyframes-name></a>, if they exist. If no <a class="css" data-link-type="maybe" href="#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes⑧">@keyframes</a> rule with that name exists, there is no animation. </dl> <h3 class="heading settled" data-level="4.2" id="animation-duration"><span class="secno">4.2. </span><span class="content"> The <a class="property css" data-link-type="property" href="#propdef-animation-duration" id="ref-for-propdef-animation-duration">animation-duration</a> property</span><a class="self-link" href="#animation-duration"></a></h3> <p>The <a class="property css" data-link-type="property" href="#propdef-animation-duration" id="ref-for-propdef-animation-duration①">animation-duration</a> property defines duration of a single animation cycle.</p> <table class="def propdef" data-link-for-hint="animation-duration"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-animation-duration">animation-duration</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-3/#time-value" id="ref-for-time-value">&lt;time [0s,∞]></a><a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-comma" id="ref-for-mult-comma①">#</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>0s <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td><a href="https://www.w3.org/TR/css-pseudo/#generated-content" title="Includes ::before and ::after pseudo-elements.">all elements</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>list, each item a duration <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>not animatable </table> <dl dfn-value> <dt><dfn class="dfn-paneled css" data-dfn-for="animation-duration" data-dfn-type="value" data-export id="valdef-animation-duration-time-0s"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-3/#time-value" id="ref-for-time-value①">&lt;time [0s,∞]></a></dfn> <dd> Specifies the length of time that an animation takes to complete one cycle. A negative <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-3/#time-value" id="ref-for-time-value②">&lt;time></a> is invalid. <p>If the <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-3/#time-value" id="ref-for-time-value③">&lt;time></a> is <span class="css">0s</span>, like the initial value, the keyframes of the animation have no effect, but the animation itself still occurs instantaneously. Specifically, start and end events are fired; if <a class="property css" data-link-type="property" href="#propdef-animation-fill-mode" id="ref-for-propdef-animation-fill-mode②">animation-fill-mode</a> is set to <a class="css" data-link-type="maybe" href="#valdef-animation-fill-mode-backwards" id="ref-for-valdef-animation-fill-mode-backwards">backwards</a> or <a class="css" data-link-type="maybe" href="#valdef-animation-fill-mode-both" id="ref-for-valdef-animation-fill-mode-both①">both</a>, the first frame of the animation, as defined by <a class="property css" data-link-type="property" href="#propdef-animation-direction" id="ref-for-propdef-animation-direction">animation-direction</a>, will be displayed during the <a class="property css" data-link-type="property" href="#propdef-animation-delay" id="ref-for-propdef-animation-delay②">animation-delay</a>. After the <span class="property" id="ref-for-propdef-animation-delay③">animation-delay</span> the last frame of the animation, as defined by <span class="property" id="ref-for-propdef-animation-direction①">animation-direction</span>, will be displayed if <span class="property" id="ref-for-propdef-animation-fill-mode③">animation-fill-mode</span> is set to <a class="css" data-link-type="maybe" href="#valdef-animation-fill-mode-forwards" id="ref-for-valdef-animation-fill-mode-forwards①">forwards</a> or <span class="css" id="ref-for-valdef-animation-fill-mode-both②">both</span>. If <span class="property" id="ref-for-propdef-animation-fill-mode④">animation-fill-mode</span> is set to <a class="css" data-link-type="maybe" href="#valdef-animation-fill-mode-none" id="ref-for-valdef-animation-fill-mode-none">none</a> the animation will have no visible effect.</p> </dl> <h3 class="heading settled" data-level="4.3" id="animation-timing-function"><span class="secno">4.3. </span><span class="content"> The <a class="property css" data-link-type="property" href="#propdef-animation-timing-function" id="ref-for-propdef-animation-timing-function③">animation-timing-function</a> property</span><a class="self-link" href="#animation-timing-function"></a></h3> <p>The <a class="property css" data-link-type="property" href="#propdef-animation-timing-function" id="ref-for-propdef-animation-timing-function④">animation-timing-function</a> property describes how the animation will progress between each pair of keyframes. Timing functions are defined in the separate CSS Easing Functions module <a data-link-type="biblio" href="#biblio-css-easing-1" title="CSS Easing Functions Level 1">[css-easing-1]</a>.</p> <p>The <a data-link-type="dfn" href="https://www.w3.org/TR/css-easing-2/#input-progress-value" id="ref-for-input-progress-value">input progress value</a> used is the percentage of the time elapsed between the current keyframe and the next keyframe <em>after</em> incorporating the effect of the <a class="property css" data-link-type="property" href="#propdef-animation-direction" id="ref-for-propdef-animation-direction②">animation-direction</a> property.</p> <p>During the <a class="property css" data-link-type="property" href="#propdef-animation-delay" id="ref-for-propdef-animation-delay④">animation-delay</a>, the <a class="property css" data-link-type="property" href="#propdef-animation-timing-function" id="ref-for-propdef-animation-timing-function⑤">animation-timing-function</a> is not applied.</p> <p class="note" role="note"><span class="marker">Note:</span> This definition is necessary because otherwise a <a data-link-type="dfn" href="https://www.w3.org/TR/css-easing-2/#step-easing-function" id="ref-for-step-easing-function">step easing function</a> with a <a data-link-type="dfn" href="https://www.w3.org/TR/css-easing-2/#step-position" id="ref-for-step-position">step position</a> of <a class="css" data-link-type="value" href="https://www.w3.org/TR/css-easing-2/#valdef-steps-start" id="ref-for-valdef-steps-start">start</a> would produce a backwards fill equal to the top of the first step in the function.</p> <p>The <a data-link-type="dfn" href="https://www.w3.org/TR/css-easing-2/#output-progress-value" id="ref-for-output-progress-value">output progress value</a> is used as the <var>p</var> value when interpolating the property values between the current and next keyframe.</p> <table class="def propdef" data-link-for-hint="animation-timing-function"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-animation-timing-function">animation-timing-function</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-easing-2/#typedef-easing-function" id="ref-for-typedef-easing-function">&lt;easing-function></a><a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-comma" id="ref-for-mult-comma②">#</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>ease <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td><a href="https://www.w3.org/TR/css-pseudo/#generated-content" title="Includes ::before and ::after pseudo-elements.">all elements</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>list, each item a computed <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-easing-2/#typedef-easing-function" id="ref-for-typedef-easing-function①">&lt;easing-function></a> <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>not animatable </table> <p>When specified in a keyframe, <a class="property css" data-link-type="property" href="#propdef-animation-timing-function" id="ref-for-propdef-animation-timing-function⑥">animation-timing-function</a> defines the progression of the animation between the current keyframe and the next keyframe for the animating property in sorted keyframe selector order (which may be an implicit 100% keyframe).</p> <h3 class="heading settled" data-level="4.4" id="animation-iteration-count"><span class="secno">4.4. </span><span class="content"> The <a class="property css" data-link-type="property" href="#propdef-animation-iteration-count" id="ref-for-propdef-animation-iteration-count">animation-iteration-count</a> property</span><a class="self-link" href="#animation-iteration-count"></a></h3> <p>The <a class="property css" data-link-type="property" href="#propdef-animation-iteration-count" id="ref-for-propdef-animation-iteration-count①">animation-iteration-count</a> property specifies the number of times an animation cycle is played. The initial value is <span class="css">1</span>, meaning the animation will play from beginning to end once. This property is often used in conjunction with an <a class="property css" data-link-type="property" href="#propdef-animation-direction" id="ref-for-propdef-animation-direction③">animation-direction</a> value of <a class="css" data-link-type="maybe" href="#valdef-animation-direction-alternate" id="ref-for-valdef-animation-direction-alternate">alternate</a>, which will cause the animation to play in reverse on alternate cycles.</p> <p>The time window during which the animation is active (<code>duration</code> x <code>iteration-count</code>) is known as the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="active-duration">active duration</dfn>.</p> <table class="def propdef" data-link-for-hint="animation-iteration-count"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-animation-iteration-count">animation-iteration-count</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod"><a class="production css" data-link-type="type" href="#typedef-single-animation-iteration-count" id="ref-for-typedef-single-animation-iteration-count">&lt;single-animation-iteration-count></a><a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-comma" id="ref-for-mult-comma③">#</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>1 <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td><a href="https://www.w3.org/TR/css-pseudo/#generated-content" title="Includes ::before and ::after pseudo-elements.">all elements</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>list, each item either a number or the keyword <a class="css" data-link-type="maybe" href="#valdef-animation-iteration-count-infinite" id="ref-for-valdef-animation-iteration-count-infinite">infinite</a> <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>not animatable </table> <p><span class="prod"><dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-single-animation-iteration-count">&lt;single-animation-iteration-count></dfn> = infinite <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①">|</a> <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#number-value" id="ref-for-number-value">&lt;number [0,∞]></a></span></p> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="animation-iteration-count" data-dfn-type="value" data-export id="valdef-animation-iteration-count-infinite">infinite</dfn> <dd> The animation will repeat forever. <dt><dfn class="dfn-paneled css" data-dfn-for="animation-iteration-count" data-dfn-type="value" data-export id="valdef-animation-iteration-count-number-0"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#number-value" id="ref-for-number-value①">&lt;number [0,∞]></a></dfn> <dd> <p>The animation will repeat the specified number of times. If the number is not an integer, the animation will end partway through its last cycle. Negative numbers are invalid. </p> <p>A value of <span class="css">0</span> is valid and, similar to an <a class="property css" data-link-type="property" href="#propdef-animation-duration" id="ref-for-propdef-animation-duration②">animation-duration</a> of <span class="css">0s</span>, causes the animation to occur instantaneously. </p> </dl> <p>If the animation has a duration of <span class="css">0s</span>, it will occur instantaneously for any valid value of <a class="property css" data-link-type="property" href="#propdef-animation-iteration-count" id="ref-for-propdef-animation-iteration-count②">animation-iteration-count</a>, including <a class="css" data-link-type="maybe" href="#valdef-animation-iteration-count-infinite" id="ref-for-valdef-animation-iteration-count-infinite①">infinite</a>.</p> <h3 class="heading settled" data-level="4.5" id="animation-direction"><span class="secno">4.5. </span><span class="content"> The <a class="property css" data-link-type="property" href="#propdef-animation-direction" id="ref-for-propdef-animation-direction④">animation-direction</a> property</span><a class="self-link" href="#animation-direction"></a></h3> <p>The <a class="property css" data-link-type="property" href="#propdef-animation-direction" id="ref-for-propdef-animation-direction⑤">animation-direction</a> property defines whether or not the animation should play in reverse on some or all cycles. When an animation is played in reverse the timing functions are also reversed. For example, when played in reverse an <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-easing-2/#valdef-cubic-bezier-easing-function-ease-in" id="ref-for-valdef-cubic-bezier-easing-function-ease-in">ease-in</a> animation would appear to be an <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-easing-2/#valdef-cubic-bezier-easing-function-ease-out" id="ref-for-valdef-cubic-bezier-easing-function-ease-out">ease-out</a> animation.</p> <table class="def propdef" data-link-for-hint="animation-direction"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-animation-direction">animation-direction</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod"><a class="production css" data-link-type="type" href="#typedef-single-animation-direction" id="ref-for-typedef-single-animation-direction">&lt;single-animation-direction></a><a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-comma" id="ref-for-mult-comma④">#</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>normal <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td><a href="https://www.w3.org/TR/css-pseudo/#generated-content" title="Includes ::before and ::after pseudo-elements.">all elements</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>list, each item a keyword as specified <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>not animatable </table> <p><span class="prod"><dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-single-animation-direction">&lt;single-animation-direction></dfn> = normal <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②">|</a> reverse <span id="ref-for-comb-one③">|</span> alternate <span id="ref-for-comb-one④">|</span> alternate-reverse</span></p> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="animation-direction" data-dfn-type="value" data-export id="valdef-animation-direction-normal">normal</dfn> <dd> All iterations of the animation are played as specified. <dt><dfn class="dfn-paneled css" data-dfn-for="animation-direction" data-dfn-type="value" data-export id="valdef-animation-direction-reverse">reverse</dfn> <dd> All iterations of the animation are played in the reverse direction from the way they were specified. <dt><dfn class="dfn-paneled css" data-dfn-for="animation-direction" data-dfn-type="value" data-export id="valdef-animation-direction-alternate">alternate</dfn> <dd> The animation cycle iterations that are odd counts are played in the normal direction, and the animation cycle iterations that are even counts are played in a reverse direction. <dt><dfn class="dfn-paneled css" data-dfn-for="animation-direction" data-dfn-type="value" data-export id="valdef-animation-direction-alternate-reverse">alternate-reverse</dfn> <dd> The animation cycle iterations that are odd counts are played in the reverse direction, and the animation cycle iterations that are even counts are played in a normal direction. </dl> <p class="note" role="note"><span class="marker">Note:</span> For the purpose of determining whether an iteration is even or odd, iterations start counting from 1.</p> <h3 class="heading settled" data-level="4.6" id="animation-play-state"><span class="secno">4.6. </span><span class="content"> The <a class="property css" data-link-type="property" href="#propdef-animation-play-state" id="ref-for-propdef-animation-play-state">animation-play-state</a> property</span><a class="self-link" href="#animation-play-state"></a></h3> <p>The <a class="property css" data-link-type="property" href="#propdef-animation-play-state" id="ref-for-propdef-animation-play-state①">animation-play-state</a> property defines whether the animation is running or paused.</p> <table class="def propdef" data-link-for-hint="animation-play-state"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-animation-play-state">animation-play-state</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod"><a class="production css" data-link-type="type" href="#typedef-single-animation-play-state" id="ref-for-typedef-single-animation-play-state">&lt;single-animation-play-state></a><a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-comma" id="ref-for-mult-comma⑤">#</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>running <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td><a href="https://www.w3.org/TR/css-pseudo/#generated-content" title="Includes ::before and ::after pseudo-elements.">all elements</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>list, each item a keyword as specified <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>not animatable </table> <p><span class="prod"><dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-single-animation-play-state">&lt;single-animation-play-state></dfn> = running <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑤">|</a> paused</span></p> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="animation-play-state" data-dfn-type="value" data-export id="valdef-animation-play-state-running">running</dfn> <dd> While this property is set to <a class="css" data-link-type="maybe" href="#valdef-animation-play-state-running" id="ref-for-valdef-animation-play-state-running">running</a>, the animation proceeds as normal. <dt><dfn class="dfn-paneled css" data-dfn-for="animation-play-state" data-dfn-type="value" data-export id="valdef-animation-play-state-paused">paused</dfn> <dd> While this property is set to <a class="css" data-link-type="maybe" href="#valdef-animation-play-state-paused" id="ref-for-valdef-animation-play-state-paused">paused</a>, the animation is paused. The animation continues to apply to the element with the progress it had made before being paused. When unpaused (set back to <a class="css" data-link-type="maybe" href="#valdef-animation-play-state-running" id="ref-for-valdef-animation-play-state-running①">running</a>), it restarts from where it left off, as if the "clock" that controls the animation had stopped and started again. <p>If the property is set to <a class="css" data-link-type="maybe" href="#valdef-animation-play-state-paused" id="ref-for-valdef-animation-play-state-paused①">paused</a> during the delay phase of the animation, the delay clock is also paused and resumes as soon as <a class="property css" data-link-type="property" href="#propdef-animation-play-state" id="ref-for-propdef-animation-play-state②">animation-play-state</a> is set back to <a class="css" data-link-type="maybe" href="#valdef-animation-play-state-running" id="ref-for-valdef-animation-play-state-running②">running</a>.</p> </dl> <h3 class="heading settled" data-level="4.7" id="animation-delay"><span class="secno">4.7. </span><span class="content"> The <a class="property css" data-link-type="property" href="#propdef-animation-delay" id="ref-for-propdef-animation-delay⑤">animation-delay</a> property</span><a class="self-link" href="#animation-delay"></a></h3> <p>The <a class="property css" data-link-type="property" href="#propdef-animation-delay" id="ref-for-propdef-animation-delay⑥">animation-delay</a> property defines when the animation will start. It allows an animation to begin execution some time after it is applied, or to appear to have begun execution some time <em>before</em> it is applied.</p> <table class="def propdef" data-link-for-hint="animation-delay"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-animation-delay">animation-delay</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-3/#time-value" id="ref-for-time-value④">&lt;time></a><a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-comma" id="ref-for-mult-comma⑥">#</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>0s <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td><a href="https://www.w3.org/TR/css-pseudo/#generated-content" title="Includes ::before and ::after pseudo-elements.">all elements</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>list, each item a duration <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>not animatable </table> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="animation-delay" data-dfn-type="value" data-export id="valdef-animation-delay-time"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-3/#time-value" id="ref-for-time-value⑤">&lt;time></a></dfn> <dd> The <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-3/#time-value" id="ref-for-time-value⑥">&lt;time></a> defines how long of a delay there is between the start of the animation (when the animation is applied to the element via these properties) and when it begins executing. A delay of <span class="css">0s</span> (the initial value) means that the animation will execute as soon as it is applied. <p>A negative delay is <strong>valid</strong>. Similar to a delay of <span class="css">0s</span>, it means that the animation executes immediately, but is automatically progressed by the absolute value of the delay, as if the animation had started the specified time in the past, and so it appears to start partway through its <a href="#animation-iteration-count">active duration</a>. If an animation’s keyframes have an implied starting value, the values are taken from the time the animation starts, not some time in the past.</p> </dl> <h3 class="heading settled" data-level="4.8" id="animation-fill-mode"><span class="secno">4.8. </span><span class="content"> The <a class="property css" data-link-type="property" href="#propdef-animation-fill-mode" id="ref-for-propdef-animation-fill-mode⑤">animation-fill-mode</a> property</span><a class="self-link" href="#animation-fill-mode"></a></h3> <p>The <a class="property css" data-link-type="property" href="#propdef-animation-fill-mode" id="ref-for-propdef-animation-fill-mode⑥">animation-fill-mode</a> property defines what values are applied by the animation outside the time it is executing. By default, an animation will not affect property values between the time it is applied (the <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name①③">animation-name</a> property is set on an element) and the time it begins execution (which is determined by the <a class="property css" data-link-type="property" href="#propdef-animation-delay" id="ref-for-propdef-animation-delay⑦">animation-delay</a> property). Also, by default an animation does not affect property values after the animation ends (determined by the <a class="property css" data-link-type="property" href="#propdef-animation-duration" id="ref-for-propdef-animation-duration③">animation-duration</a> and <a class="property css" data-link-type="property" href="#propdef-animation-iteration-count" id="ref-for-propdef-animation-iteration-count③">animation-iteration-count</a> properties). The <span class="property" id="ref-for-propdef-animation-fill-mode⑦">animation-fill-mode</span> property can override this behavior. Dynamic updates to the property will be reflected by property values as needed, whether during the animation delay or after the animation ends.</p> <table class="def propdef" data-link-for-hint="animation-fill-mode"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-animation-fill-mode">animation-fill-mode</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod"><a class="production css" data-link-type="type" href="#typedef-single-animation-fill-mode" id="ref-for-typedef-single-animation-fill-mode">&lt;single-animation-fill-mode></a><a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-comma" id="ref-for-mult-comma⑦">#</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>none <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td><a href="https://www.w3.org/TR/css-pseudo/#generated-content" title="Includes ::before and ::after pseudo-elements.">all elements</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>list, each item a keyword as specified <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>not animatable </table> <p><span class="prod"><dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-single-animation-fill-mode">&lt;single-animation-fill-mode></dfn> = none <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑥">|</a> forwards <span id="ref-for-comb-one⑦">|</span> backwards <span id="ref-for-comb-one⑧">|</span> both</span></p> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="animation-fill-mode" data-dfn-type="value" data-export id="valdef-animation-fill-mode-none">none</dfn> <dd> The animation has no effect when it is applied but not executing. <dt><dfn class="dfn-paneled css" data-dfn-for="animation-fill-mode" data-dfn-type="value" data-export id="valdef-animation-fill-mode-forwards">forwards</dfn> <dd> After the animation ends (as determined by its <a class="property css" data-link-type="property" href="#propdef-animation-iteration-count" id="ref-for-propdef-animation-iteration-count④">animation-iteration-count</a>), the animation will apply the property values for the time the animation ended. When <span class="property" id="ref-for-propdef-animation-iteration-count⑤">animation-iteration-count</span> is an integer greater than zero, the values applied will be those for the end of the last completed iteration of the animation (rather than the values for the start of the iteration that would be next). When <span class="property" id="ref-for-propdef-animation-iteration-count⑥">animation-iteration-count</span> is zero, the values applied will be those that would start the first iteration (just as when <a class="property css" data-link-type="property" href="#propdef-animation-fill-mode" id="ref-for-propdef-animation-fill-mode⑧">animation-fill-mode</a> is <a class="css" data-link-type="maybe" href="#valdef-animation-fill-mode-backwards" id="ref-for-valdef-animation-fill-mode-backwards①">backwards</a>). <dt><dfn class="dfn-paneled css" data-dfn-for="animation-fill-mode" data-dfn-type="value" data-export id="valdef-animation-fill-mode-backwards">backwards</dfn> <dd> During the period defined by <a class="property css" data-link-type="property" href="#propdef-animation-delay" id="ref-for-propdef-animation-delay⑧">animation-delay</a>, the animation will apply the property values defined in the keyframe that will start the first iteration of the animation. These are either the values of the <span class="css">from</span> keyframe (when <a class="property css" data-link-type="property" href="#propdef-animation-direction" id="ref-for-propdef-animation-direction⑥">animation-direction</a> is <a class="css" data-link-type="maybe" href="#valdef-animation-direction-normal" id="ref-for-valdef-animation-direction-normal">normal</a> or <a class="css" data-link-type="maybe" href="#valdef-animation-direction-alternate" id="ref-for-valdef-animation-direction-alternate①">alternate</a>) or those of the <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-shapes-2/#valdef-shape-to" id="ref-for-valdef-shape-to④">to</a> keyframe (when <span class="property" id="ref-for-propdef-animation-direction⑦">animation-direction</span> is <a class="css" data-link-type="maybe" href="#valdef-animation-direction-reverse" id="ref-for-valdef-animation-direction-reverse">reverse</a> or <a class="css" data-link-type="maybe" href="#valdef-animation-direction-alternate-reverse" id="ref-for-valdef-animation-direction-alternate-reverse">alternate-reverse</a>). <dt><dfn class="dfn-paneled css" data-dfn-for="animation-fill-mode" data-dfn-type="value" data-export id="valdef-animation-fill-mode-both">both</dfn> <dd> The effects of both <a class="css" data-link-type="maybe" href="#valdef-animation-fill-mode-forwards" id="ref-for-valdef-animation-fill-mode-forwards②">forwards</a> and <a class="css" data-link-type="maybe" href="#valdef-animation-fill-mode-backwards" id="ref-for-valdef-animation-fill-mode-backwards②">backwards</a> fill apply. </dl> <h3 class="heading settled" data-level="4.9" id="animation"><span class="secno">4.9. </span><span class="content"> The <a class="property css" data-link-type="property" href="#propdef-animation" id="ref-for-propdef-animation①">animation</a> shorthand property</span><a class="self-link" href="#animation"></a></h3> <p>The <a class="property css" data-link-type="property" href="#propdef-animation" id="ref-for-propdef-animation②">animation</a> shorthand property is a comma-separated list of animation definitions. Each item in the list gives one item of the value for all of the subproperties of the shorthand, which are known as the animation properties. (See the definition of <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name①④">animation-name</a> for what happens when these properties have lists of different lengths, a problem that cannot occur when they are defined using only the <span class="property" id="ref-for-propdef-animation③">animation</span> shorthand.)</p> <table class="def propdef" data-link-for-hint="animation"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-animation">animation</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod"><a class="production css" data-link-type="type" href="#typedef-single-animation" id="ref-for-typedef-single-animation">&lt;single-animation></a><a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-comma" id="ref-for-mult-comma⑧">#</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>see individual properties <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td><a href="https://www.w3.org/TR/css-pseudo/#generated-content" title="Includes ::before and ::after pseudo-elements.">all elements</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>see individual properties <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>not animatable </table> <p><span class="prod"><dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-single-animation">&lt;single-animation></dfn> = <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-3/#time-value" id="ref-for-time-value⑦">&lt;time [0s,∞]></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-any" id="ref-for-comb-any">||</a> <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-easing-2/#typedef-easing-function" id="ref-for-typedef-easing-function②">&lt;easing-function></a> <span id="ref-for-comb-any①">||</span> <span class="production" id="ref-for-time-value⑧">&lt;time></span> <span id="ref-for-comb-any②">||</span> <a class="production css" data-link-type="type" href="#typedef-single-animation-iteration-count" id="ref-for-typedef-single-animation-iteration-count①">&lt;single-animation-iteration-count></a> <span id="ref-for-comb-any③">||</span> <a class="production css" data-link-type="type" href="#typedef-single-animation-direction" id="ref-for-typedef-single-animation-direction①">&lt;single-animation-direction></a> <span id="ref-for-comb-any④">||</span> <a class="production css" data-link-type="type" href="#typedef-single-animation-fill-mode" id="ref-for-typedef-single-animation-fill-mode①">&lt;single-animation-fill-mode></a> <span id="ref-for-comb-any⑤">||</span> <a class="production css" data-link-type="type" href="#typedef-single-animation-play-state" id="ref-for-typedef-single-animation-play-state①">&lt;single-animation-play-state></a> <span id="ref-for-comb-any⑥">||</span> [ none <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑨">|</a> <a class="production css" data-link-type="type" href="#typedef-keyframes-name" id="ref-for-typedef-keyframes-name④">&lt;keyframes-name></a> ]</span></p> <p>Order is important within each animation definition: the first value in each <a class="production css" data-link-type="type" href="#typedef-single-animation" id="ref-for-typedef-single-animation①">&lt;single-animation></a> that can be parsed as a <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-3/#time-value" id="ref-for-time-value⑨">&lt;time></a> is assigned to the <a class="property css" data-link-type="property" href="#propdef-animation-duration" id="ref-for-propdef-animation-duration④">animation-duration</a>, and the second value in each <span class="production" id="ref-for-typedef-single-animation②">&lt;single-animation></span> that can be parsed as a <span class="production" id="ref-for-time-value①⓪">&lt;time></span> is assigned to <a class="property css" data-link-type="property" href="#propdef-animation-delay" id="ref-for-propdef-animation-delay⑨">animation-delay</a>.</p> <p>Order is also important within each animation definition for distinguishing <a class="production css" data-link-type="type" href="#typedef-keyframes-name" id="ref-for-typedef-keyframes-name⑤">&lt;keyframes-name></a> values from other keywords. When parsing, keywords that are valid for properties other than <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name①⑤">animation-name</a> whose values were not found earlier in the shorthand must be accepted for those properties rather than for <span class="property" id="ref-for-propdef-animation-name①⑥">animation-name</span>. Furthermore, when serializing, default values of other properties must be output in at least the cases necessary to distinguish an <span class="property" id="ref-for-propdef-animation-name①⑦">animation-name</span> that could be a value of another property, and may be output in additional cases.</p> <div class="example" id="example-f4782312"><a class="self-link" href="#example-f4782312"></a> For example, a value parsed from <a class="css" data-link-type="propdesc" href="#propdef-animation" id="ref-for-propdef-animation④">animation: 3s none backwards</a> (where <a class="property css" data-link-type="property" href="#propdef-animation-fill-mode" id="ref-for-propdef-animation-fill-mode⑨">animation-fill-mode</a> is <a class="css" data-link-type="maybe" href="#valdef-animation-fill-mode-none" id="ref-for-valdef-animation-fill-mode-none①">none</a> and <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name①⑧">animation-name</a> is <span class="css">backwards</span>) must not be serialized as <span class="css" id="ref-for-propdef-animation⑤">animation: 3s backwards</span> (where <span class="property" id="ref-for-propdef-animation-fill-mode①⓪">animation-fill-mode</span> is <a class="css" data-link-type="maybe" href="#valdef-animation-fill-mode-backwards" id="ref-for-valdef-animation-fill-mode-backwards③">backwards</a> and <span class="property" id="ref-for-propdef-animation-name①⑨">animation-name</span> is <a class="css" data-link-type="maybe" href="#valdef-animation-name-none" id="ref-for-valdef-animation-name-none②">none</a>). </div> <h2 class="heading settled" data-level="5" id="events"><span class="secno">5. </span><span class="content"> Animation Events</span><a class="self-link" href="#events"></a></h2> <p>Several animation-related events are available through the DOM Event system. The start and end of an animation, and the end of each iteration of an animation, all generate DOM events. An element can have multiple properties being animated simultaneously. This can occur either with a single <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name②⓪">animation-name</a> value with keyframes containing multiple properties, or with multiple <span class="property" id="ref-for-propdef-animation-name②①">animation-name</span> values. For the purposes of events, each <span class="property" id="ref-for-propdef-animation-name②②">animation-name</span> specifies a single animation. Therefore an event will be generated for each <span class="property" id="ref-for-propdef-animation-name②③">animation-name</span> value and not necessarily for each property being animated.</p> <p>Any animation for which a valid keyframe rule is defined will run and generate events; this includes animations with empty keyframe rules.</p> <p>The time the animation has been running is sent with each event generated. This allows the event handler to determine the current iteration of a looping animation or the current position of an alternating animation. This time does not include any time the animation was in the <a class="css" data-link-type="maybe" href="#valdef-animation-play-state-paused" id="ref-for-valdef-animation-play-state-paused②">paused</a> play state.</p> <h3 class="heading settled" data-level="5.1" id="interface-animationevent"><span class="secno">5.1. </span><span class="content"> The <code>AnimationEvent</code> Interface</span><a class="self-link" href="#interface-animationevent"></a></h3> <p>The <code>AnimationEvent</code> interface provides specific contextual information associated with Animation events.</p> <h4 class="heading settled" data-level="5.1.1" id="interface-animationevent-idl"><span class="secno">5.1.1. </span><span class="content"> IDL Definition</span><a class="self-link" href="#interface-animationevent-idl"></a></h4> <pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed" id="ref-for-Exposed"><c- g>Exposed</c-></a>=<c- n>Window</c->] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="animationevent"><code><c- g>AnimationEvent</c-></code></dfn> : <a data-link-type="idl-name" href="https://dom.spec.whatwg.org/#event" id="ref-for-event"><c- n>Event</c-></a> { <a class="idl-code" data-link-type="constructor" href="#dom-animationevent-animationevent" id="ref-for-dom-animationevent-animationevent"><c- g>constructor</c-></a>(<a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring"><c- n>CSSOMString</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="AnimationEvent/AnimationEvent(type, animationEventInitDict), AnimationEvent/constructor(type, animationEventInitDict), AnimationEvent/AnimationEvent(type), AnimationEvent/constructor(type)" data-dfn-type="argument" data-export id="dom-animationevent-animationevent-type-animationeventinitdict-type"><code><c- g>type</c-></code></dfn>, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-animationeventinit" id="ref-for-dictdef-animationeventinit"><c- n>AnimationEventInit</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="AnimationEvent/AnimationEvent(type, animationEventInitDict), AnimationEvent/constructor(type, animationEventInitDict), AnimationEvent/AnimationEvent(type), AnimationEvent/constructor(type)" data-dfn-type="argument" data-export id="dom-animationevent-animationevent-type-animationeventinitdict-animationeventinitdict"><code><c- g>animationEventInitDict</c-></code></dfn> = {}); <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring①"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="CSSOMString" href="#dom-animationevent-animationname" id="ref-for-dom-animationevent-animationname"><c- g>animationName</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-double" id="ref-for-idl-double"><c- b>double</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="double" href="#dom-animationevent-elapsedtime" id="ref-for-dom-animationevent-elapsedtime"><c- g>elapsedTime</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring②"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="CSSOMString" href="#dom-animationevent-pseudoelement" id="ref-for-dom-animationevent-pseudoelement"><c- g>pseudoElement</c-></a>; }; <c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-animationeventinit"><code><c- g>AnimationEventInit</c-></code></dfn> : <a data-link-type="idl-name" href="https://dom.spec.whatwg.org/#dictdef-eventinit" id="ref-for-dictdef-eventinit"><c- n>EventInit</c-></a> { <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring③"><c- n>CSSOMString</c-></a> <dfn class="dfn-paneled idl-code" data-default="&quot;&quot;" data-dfn-for="AnimationEventInit" data-dfn-type="dict-member" data-export data-type="CSSOMString" id="dom-animationeventinit-animationname"><code><c- g>animationName</c-></code></dfn> = ""; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-double" id="ref-for-idl-double①"><c- b>double</c-></a> <dfn class="dfn-paneled idl-code" data-default="0.0" data-dfn-for="AnimationEventInit" data-dfn-type="dict-member" data-export data-type="double" id="dom-animationeventinit-elapsedtime"><code><c- g>elapsedTime</c-></code></dfn> = 0.0; <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring④"><c- n>CSSOMString</c-></a> <dfn class="dfn-paneled idl-code" data-default="&quot;&quot;" data-dfn-for="AnimationEventInit" data-dfn-type="dict-member" data-export data-type="CSSOMString" id="dom-animationeventinit-pseudoelement"><code><c- g>pseudoElement</c-></code></dfn> = ""; }; </pre> <h4 class="heading settled" data-level="5.1.2" id="interface-animationevent-attributes"><span class="secno">5.1.2. </span><span class="content"> Attributes</span><a class="self-link" href="#interface-animationevent-attributes"></a></h4> <dl> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="AnimationEvent" data-dfn-type="attribute" data-export id="dom-animationevent-animationname"><code>animationName</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring⑤">CSSOMString</a>, readonly</span> <dd> The value of the <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name②④">animation-name</a> property of the animation that fired the event. <dt><dfn class="dfn-paneled idl-code" data-dfn-for="AnimationEvent" data-dfn-type="attribute" data-export id="dom-animationevent-elapsedtime"><code>elapsedTime</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#idl-double" id="ref-for-idl-double②">double</a>, readonly</span> <dd> The amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused. The precise calculation for of this member is defined along with each event type. <dt><dfn class="dfn-paneled idl-code" data-dfn-for="AnimationEvent" data-dfn-type="attribute" data-export id="dom-animationevent-pseudoelement"><code>pseudoElement</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring⑥">CSSOMString</a>, readonly</span> <dd> The name (beginning with two colons) of the CSS pseudo-element on which the animation runs (in which case the target of the event is that pseudo-element’s corresponding element), or the empty string if the animation runs on an element (which means the target of the event is that element). </dl> <p><dfn class="dfn-paneled idl-code" data-dfn-for="AnimationEvent" data-dfn-type="constructor" data-export data-lt="AnimationEvent(type, animationEventInitDict)|constructor(type, animationEventInitDict)|AnimationEvent(type)|constructor(type)" id="dom-animationevent-animationevent"><code>AnimationEvent(type, animationEventInitDict)</code></dfn> is an <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#constructing-events" id="ref-for-constructing-events">event constructor</a>.</p> <h3 class="heading settled" data-level="5.2" id="event-animationevent"><span class="secno">5.2. </span><span class="content"> Types of <code>AnimationEvent</code></span><a class="self-link" href="#event-animationevent"></a></h3> <p>The different types of animation events that can occur are:</p> <dl> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="GlobalEventHandlers" data-dfn-type="event" data-export id="eventdef-globaleventhandlers-animationstart"><code>animationstart</code></dfn> <dd> The <code class="idl"><a data-link-type="idl" href="#eventdef-globaleventhandlers-animationstart" id="ref-for-eventdef-globaleventhandlers-animationstart①">animationstart</a></code> event occurs at the start of the animation. If there is an <a class="property css" data-link-type="property" href="#propdef-animation-delay" id="ref-for-propdef-animation-delay①⓪">animation-delay</a> then this event will fire once the delay period has expired. <p> A negative delay will cause the event to fire with an <code class="idl"><a data-link-type="idl" href="#dom-animationevent-elapsedtime" id="ref-for-dom-animationevent-elapsedtime①">elapsedTime</a></code> equal to the absolute value of the delay capped to the <a data-link-type="dfn" href="#active-duration" id="ref-for-active-duration">active duration</a> of the animation, that is, <code>min(max(-<a class="property css" data-link-type="property" href="#propdef-animation-delay" id="ref-for-propdef-animation-delay①①">animation-delay</a>, 0), <a data-link-type="dfn" href="#active-duration" id="ref-for-active-duration①">active duration</a>)</code>; in this case the event will fire whether <a class="property css" data-link-type="property" href="#propdef-animation-play-state" id="ref-for-propdef-animation-play-state③">animation-play-state</a> is set to <a class="css" data-link-type="maybe" href="#valdef-animation-play-state-running" id="ref-for-valdef-animation-play-state-running③">running</a> or <a class="css" data-link-type="maybe" href="#valdef-animation-play-state-paused" id="ref-for-valdef-animation-play-state-paused③">paused</a>. </p> <ul> <li>Bubbles: Yes <li>Cancelable: No <li>Context Info: animationName, elapsedTime, pseudoElement </ul> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="GlobalEventHandlers" data-dfn-type="event" data-export id="eventdef-globaleventhandlers-animationend"><code>animationend</code></dfn> <dd> The <code class="idl"><a data-link-type="idl" href="#eventdef-globaleventhandlers-animationend" id="ref-for-eventdef-globaleventhandlers-animationend①">animationend</a></code> event occurs when the animation finishes. In this case the value of the <code class="idl"><a data-link-type="idl" href="#dom-animationevent-elapsedtime" id="ref-for-dom-animationevent-elapsedtime②">elapsedTime</a></code> member of the event is equal to the <a data-link-type="dfn" href="#active-duration" id="ref-for-active-duration②">active duration</a>. <ul> <li>Bubbles: Yes <li>Cancelable: No <li>Context Info: animationName, elapsedTime, pseudoElement </ul> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="GlobalEventHandlers" data-dfn-type="event" data-export id="eventdef-globaleventhandlers-animationiteration"><code>animationiteration</code></dfn> <dd> The <code class="idl"><a data-link-type="idl" href="#eventdef-globaleventhandlers-animationiteration" id="ref-for-eventdef-globaleventhandlers-animationiteration">animationiteration</a></code> event occurs at the end of each iteration of an animation, except when an animationend event would fire at the same time. This means that this event does not occur for animations with an iteration count of one or less. <p>The <code class="idl"><a data-link-type="idl" href="#dom-animationevent-elapsedtime" id="ref-for-dom-animationevent-elapsedtime③">elapsedTime</a></code> member in this case is equal to the product of the <var>current iteration</var> and <a class="property css" data-link-type="property" href="#propdef-animation-duration" id="ref-for-propdef-animation-duration⑤">animation-duration</a> where the <var>current iteration</var> is the zero-based index of the new iteration. For example, assuming no negative <a class="property css" data-link-type="property" href="#propdef-animation-delay" id="ref-for-propdef-animation-delay①②">animation-delay</a>, after one iteration completes the <var>current iteration</var> would be one.</p> <ul> <li>Bubbles: Yes <li>Cancelable: No <li>Context Info: animationName, elapsedTime, pseudoElement </ul> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="GlobalEventHandlers" data-dfn-type="event" data-export id="eventdef-globaleventhandlers-animationcancel"><code>animationcancel</code></dfn> <dd> The <code class="idl"><a data-link-type="idl" href="#eventdef-globaleventhandlers-animationcancel" id="ref-for-eventdef-globaleventhandlers-animationcancel">animationcancel</a></code> event occurs when the animation stops running in a way that does not fire an <code class="idl"><a data-link-type="idl" href="#eventdef-globaleventhandlers-animationend" id="ref-for-eventdef-globaleventhandlers-animationend②">animationend</a></code> event, such as a change in the <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name②⑤">animation-name</a> that removes the animation, or the animating element or one of its ancestors becoming <span class="css">display:none</span>. <p>The <code class="idl"><a data-link-type="idl" href="#dom-animationevent-elapsedtime" id="ref-for-dom-animationevent-elapsedtime④">elapsedTime</a></code> member for this event indicates the number of seconds that had elapsed since the beginning of the animation at the moment when the animation was canceled. This excludes any time where the animation was paused. If the animation had a negative <a class="property css" data-link-type="property" href="#propdef-animation-delay" id="ref-for-propdef-animation-delay①③">animation-delay</a>, the beginning of the animation is the moment equal to the absolute value of <span class="property" id="ref-for-propdef-animation-delay①④">animation-delay</span> seconds <em>prior</em> to when the animation was actually triggered. Alternatively, if the animation had a positive <span class="property" id="ref-for-propdef-animation-delay①⑤">animation-delay</span> and the event is fired before the animation’s delay has expired, the <code class="idl"><a data-link-type="idl" href="#dom-animationevent-elapsedtime" id="ref-for-dom-animationevent-elapsedtime⑤">elapsedTime</a></code> will be zero.</p> <ul> <li>Bubbles: Yes <li>Cancelable: No <li>Context Info: animationName, elapsedTime, pseudoElement </ul> </dl> <h3 class="heading settled" data-level="5.3" id="event-handlers-on-elements-document-objects-and-window-objects"><span class="secno">5.3. </span><span class="content">Event handlers on elements, <code>Document</code> objects, and <code>Window</code> objects</span><a class="self-link" href="#event-handlers-on-elements-document-objects-and-window-objects"></a></h3> <p>The following are the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers" id="ref-for-event-handlers">event handlers</a> (and their corresponding <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type" id="ref-for-event-handler-event-type">event handler event types</a>) that must be supported by all <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#html-elements" id="ref-for-html-elements">HTML elements</a>, as both <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-content-attributes" id="ref-for-event-handler-content-attributes">event handler content attributes</a> and <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-idl-attributes" id="ref-for-event-handler-idl-attributes">event handler IDL attributes</a>; and that must be supported by all <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#document" id="ref-for-document">Document</a></code> and <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window" id="ref-for-window">Window</a></code> objects, as <span id="ref-for-event-handler-idl-attributes①">event handler IDL attributes</span>:</p> <table class="data"> <tbody> <tr> <th><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers" id="ref-for-event-handlers①">Event handler</a> <th><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type" id="ref-for-event-handler-event-type①">Event handler event type</a> <tr> <td><dfn class="dfn-paneled idl-code" data-dfn-for="Document, Window" data-dfn-type="attribute" data-export id="dom-document-onanimationstart"><code>onanimationstart</code></dfn> <td><code class="idl"><a data-link-type="idl" href="#eventdef-globaleventhandlers-animationstart" id="ref-for-eventdef-globaleventhandlers-animationstart②">animationstart</a></code> <tr> <td><dfn class="dfn-paneled idl-code" data-dfn-for="Document, Window" data-dfn-type="attribute" data-export id="dom-document-onanimationiteration"><code>onanimationiteration</code></dfn> <td><code class="idl"><a data-link-type="idl" href="#eventdef-globaleventhandlers-animationiteration" id="ref-for-eventdef-globaleventhandlers-animationiteration①">animationiteration</a></code> <tr> <td><dfn class="dfn-paneled idl-code" data-dfn-for="Document, Window" data-dfn-type="attribute" data-export id="dom-document-onanimationend"><code>onanimationend</code></dfn> <td><code class="idl"><a data-link-type="idl" href="#eventdef-globaleventhandlers-animationend" id="ref-for-eventdef-globaleventhandlers-animationend③">animationend</a></code> <tr> <td><dfn class="dfn-paneled idl-code" data-dfn-for="Document, Window" data-dfn-type="attribute" data-export id="dom-document-onanimationcancel"><code>onanimationcancel</code></dfn> <td><code class="idl"><a data-link-type="idl" href="#eventdef-globaleventhandlers-animationcancel" id="ref-for-eventdef-globaleventhandlers-animationcancel①">animationcancel</a></code> </table> <h2 class="heading settled" data-level="6" id="interface-dom"><span class="secno">6. </span><span class="content"> DOM Interfaces</span><a class="self-link" href="#interface-dom"></a></h2> <p>CSS animations are exposed to the CSSOM through a pair of new interfaces describing the keyframes.</p> <p class="note" role="note"><span class="marker">Note:</span> the interfaces defined below reflect the interoperable API available as of this level of the specification. Future levels may deprecate parts of this API and extend others.</p> <h3 class="heading settled" data-level="6.1" id="interface-cssrule"><span class="secno">6.1. </span><span class="content"> The <code>CSSRule</code> Interface</span><a class="self-link" href="#interface-cssrule"></a></h3> <p>The following two rule types are added to the <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/cssom-1/#cssrule" id="ref-for-cssrule">CSSRule</a></code> interface. They provide identification for the new keyframe and keyframes rules.</p> <h4 class="heading settled" data-level="6.1.1" id="interface-cssrule-idl"><span class="secno">6.1.1. </span><span class="content"> IDL Definition</span><a class="self-link" href="#interface-cssrule-idl"></a></h4> <pre class="idl highlight def"><c- b>partial</c-> <c- b>interface</c-> <a class="idl-code" data-link-type="interface" href="https://www.w3.org/TR/cssom-1/#cssrule" id="ref-for-cssrule①"><c- g>CSSRule</c-></a> { <c- b>const</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-short" id="ref-for-idl-unsigned-short"><c- b>unsigned</c-> <c- b>short</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="CSSRule" data-dfn-type="const" data-export id="dom-cssrule-keyframes_rule"><code><c- g>KEYFRAMES_RULE</c-></code></dfn> = 7; <c- b>const</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-short" id="ref-for-idl-unsigned-short①"><c- b>unsigned</c-> <c- b>short</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="CSSRule" data-dfn-type="const" data-export id="dom-cssrule-keyframe_rule"><code><c- g>KEYFRAME_RULE</c-></code></dfn> = 8; }; </pre> <h3 class="heading settled" data-level="6.2" id="interface-csskeyframerule"><span class="secno">6.2. </span><span class="content"> The <code>CSSKeyframeRule</code> Interface</span><a class="self-link" href="#interface-csskeyframerule"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#csskeyframerule" id="ref-for-csskeyframerule">CSSKeyframeRule</a></code> interface represents the style rule for a single key.</p> <h4 class="heading settled" data-level="6.2.1" id="interface-csskeyframerule-idl"><span class="secno">6.2.1. </span><span class="content"> IDL Definition</span><a class="self-link" href="#interface-csskeyframerule-idl"></a></h4> <pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed" id="ref-for-Exposed①"><c- g>Exposed</c-></a>=<c- n>Window</c->] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="csskeyframerule"><code><c- g>CSSKeyframeRule</c-></code></dfn> : <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssrule" id="ref-for-cssrule②"><c- n>CSSRule</c-></a> { <c- b>attribute</c-> <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring⑦"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="CSSOMString" href="#dom-csskeyframerule-keytext" id="ref-for-dom-csskeyframerule-keytext"><c- g>keyText</c-></a>; [<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SameObject" id="ref-for-SameObject"><c- g>SameObject</c-></a>, <a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#PutForwards" id="ref-for-PutForwards"><c- g>PutForwards</c-></a>=<a class="idl-code" data-link-type="attribute"><c- n>cssText</c-></a>] <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://drafts.csswg.org/cssom-1/#cssstyleproperties" id="ref-for-cssstyleproperties"><c- n>CSSStyleProperties</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="CSSStyleProperties" href="#dom-csskeyframerule-style" id="ref-for-dom-csskeyframerule-style"><c- g>style</c-></a>; }; </pre> <h4 class="heading settled" data-level="6.2.2" id="interface-csskeyframerule-attributes"><span class="secno">6.2.2. </span><span class="content"> Attributes</span><a class="self-link" href="#interface-csskeyframerule-attributes"></a></h4> <dl> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="CSSKeyframeRule" data-dfn-type="attribute" data-export id="dom-csskeyframerule-keytext"><code>keyText</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring⑧">CSSOMString</a></span> <dd> This attribute represents the keyframe selector as a comma-separated list of percentage values. The <span class="css">from</span> and <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-shapes-2/#valdef-shape-to" id="ref-for-valdef-shape-to⑤">to</a> keywords map to 0% and 100%, respectively. <p>If <a class="idl-code" data-link-type="attribute" href="#dom-csskeyframerule-keytext" id="ref-for-dom-csskeyframerule-keytext①">keyText</a> is updated with an invalid keyframe selector, a <a class="idl-code" data-link-type="exception" href="https://webidl.spec.whatwg.org/#syntaxerror" id="ref-for-syntaxerror">SyntaxError</a> exception must be thrown and the value of <span id="ref-for-dom-csskeyframerule-keytext②">keyText</span> must remain unchanged.</p> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="CSSKeyframeRule" data-dfn-type="attribute" data-export id="dom-csskeyframerule-style"><code>style</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://drafts.csswg.org/cssom-1/#cssstyleproperties" id="ref-for-cssstyleproperties①">CSSStyleProperties</a>, readonly</span> <dd> Must return a <code class="idl"><a data-link-type="idl" href="https://drafts.csswg.org/cssom-1/#cssstyleproperties" id="ref-for-cssstyleproperties②">CSSStyleProperties</a></code> object for the keyframe rule, with the following properties: <dl> <dt><a data-link-type="dfn" href="https://drafts.csswg.org/cssom-1/#cssstyledeclaration-readonly-flag" id="ref-for-cssstyledeclaration-readonly-flag">readonly flag</a> <dd>Unset. <dt><a data-link-type="dfn" href="https://www.w3.org/TR/cssom-1/#cssstyledeclaration-declarations" id="ref-for-cssstyledeclaration-declarations">declarations</a> <dd>The declared declarations in the rule, in <a data-link-type="dfn" href="https://www.w3.org/TR/cssom-1/#concept-declarations-specified-order" id="ref-for-concept-declarations-specified-order">specified order</a>. <dt><a data-link-type="dfn" href="https://www.w3.org/TR/cssom-1/#cssstyledeclaration-parent-css-rule" id="ref-for-cssstyledeclaration-parent-css-rule">parent CSS rule</a> <dd>The <a data-link-type="dfn">context object</a> (i.e. this <code class="idl"><a data-link-type="idl" href="#csskeyframerule" id="ref-for-csskeyframerule①">CSSKeyframeRule</a></code>). <dt><a data-link-type="dfn" href="https://www.w3.org/TR/cssom-1/#cssstyledeclaration-owner-node" id="ref-for-cssstyledeclaration-owner-node">owner node</a> <dd>Null. </dl> </dl> <h3 class="heading settled" data-level="6.3" id="interface-csskeyframesrule"><span class="secno">6.3. </span><span class="content"> The <code>CSSKeyframesRule</code> Interface</span><a class="self-link" href="#interface-csskeyframesrule"></a></h3> <p>The <code class="idl"><a data-link-type="idl" href="#csskeyframesrule" id="ref-for-csskeyframesrule">CSSKeyframesRule</a></code> interface represents a complete set of keyframes for a single animation.</p> <h4 class="heading settled" data-level="6.3.1" id="interface-csskeyframesrule-idl"><span class="secno">6.3.1. </span><span class="content"> IDL Definition</span><a class="self-link" href="#interface-csskeyframesrule-idl"></a></h4> <pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed" id="ref-for-Exposed②"><c- g>Exposed</c-></a>=<c- n>Window</c->] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="csskeyframesrule"><code><c- g>CSSKeyframesRule</c-></code></dfn> : <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssrule" id="ref-for-cssrule③"><c- n>CSSRule</c-></a> { <c- b>attribute</c-> <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring⑨"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="CSSOMString" href="#dom-csskeyframesrule-name" id="ref-for-dom-csskeyframesrule-name"><c- g>name</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssrulelist" id="ref-for-cssrulelist"><c- n>CSSRuleList</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="CSSRuleList" href="#dom-csskeyframesrule-cssrules" id="ref-for-dom-csskeyframesrule-cssrules"><c- g>cssRules</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long" id="ref-for-idl-unsigned-long"><c- b>unsigned</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="unsigned long" href="#dom-csskeyframesrule-length" id="ref-for-dom-csskeyframesrule-length"><c- g>length</c-></a>; <c- b>getter</c-> <a data-link-type="idl-name" href="#csskeyframerule" id="ref-for-csskeyframerule②"><c- n>CSSKeyframeRule</c-></a> (<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long" id="ref-for-idl-unsigned-long①"><c- b>unsigned</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="argument" href="#dom-csskeyframesrule-__getter__-index-index" id="ref-for-dom-csskeyframesrule-__getter__-index-index"><c- g>index</c-></a>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#dom-csskeyframesrule-appendrule" id="ref-for-dom-csskeyframesrule-appendrule"><c- g>appendRule</c-></a>(<a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring①⓪"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="argument" href="#dom-csskeyframesrule-appendrule-rule-rule" id="ref-for-dom-csskeyframesrule-appendrule-rule-rule"><c- g>rule</c-></a>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined①"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#dom-csskeyframesrule-deleterule" id="ref-for-dom-csskeyframesrule-deleterule"><c- g>deleteRule</c-></a>(<a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring①①"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="argument" href="#dom-csskeyframesrule-deleterule-select-select" id="ref-for-dom-csskeyframesrule-deleterule-select-select"><c- g>select</c-></a>); <a data-link-type="idl-name" href="#csskeyframerule" id="ref-for-csskeyframerule③"><c- n>CSSKeyframeRule</c-></a>? <a class="idl-code" data-link-type="method" href="#dom-csskeyframesrule-findrule" id="ref-for-dom-csskeyframesrule-findrule"><c- g>findRule</c-></a>(<a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring①②"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="argument" href="#dom-csskeyframesrule-findrule-select-select" id="ref-for-dom-csskeyframesrule-findrule-select-select"><c- g>select</c-></a>); }; </pre> <h4 class="heading settled" data-level="6.3.2" id="interface-csskeyframesrule-attributes"><span class="secno">6.3.2. </span><span class="content"> Attributes</span><a class="self-link" href="#interface-csskeyframesrule-attributes"></a></h4> <dl> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="CSSKeyframesRule" data-dfn-type="attribute" data-export id="dom-csskeyframesrule-name"><code>name</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring①③">CSSOMString</a></span> <dd> This attribute is the name of the keyframes, used by the <a class="property css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name②⑥">animation-name</a> property. <dt><dfn class="dfn-paneled idl-code" data-dfn-for="CSSKeyframesRule" data-dfn-type="attribute" data-export id="dom-csskeyframesrule-cssrules"><code>cssRules</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssrulelist" id="ref-for-cssrulelist①">CSSRuleList</a>, readonly</span> <dd> This attribute gives access to the keyframes in the list. <dt><dfn class="dfn-paneled idl-code" data-dfn-for="CSSKeyframesRule" data-dfn-type="attribute" data-export id="dom-csskeyframesrule-length"><code>length</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#idl-unsigned-long" id="ref-for-idl-unsigned-long②">unsigned long</a>, readonly</span> <dd> This attribute is the number of keyframes in the list. </dl> <h4 class="heading settled" data-level="6.3.3" id="interface-csskeyframesrule-indexed-property-getter"><span class="secno">6.3.3. </span><span class="content"> The indexed property getter</span><a class="self-link" href="#interface-csskeyframesrule-indexed-property-getter"></a></h4> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="CSSKeyframesRule" data-dfn-type="method" data-export data-lt="__getter__(index)" id="dom-csskeyframesrule-__getter__"><code>indexed property getter</code></dfn> returns the <code class="idl"><a data-link-type="idl" href="#csskeyframerule" id="ref-for-csskeyframerule④">CSSKeyframeRule</a></code> from the list of keyframes at the indicated position.</p> <p>Parameters:</p> <dl> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="CSSKeyframesRule/__getter__(index)" data-dfn-type="argument" data-export id="dom-csskeyframesrule-__getter__-index-index"><code>index</code></dfn> of type <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-unsigned-long" id="ref-for-idl-unsigned-long③">unsigned long</a></code> <dd> The zero-based index of the rule to return. </dl> <p>Return Value:</p> <dl> <dt><code class="idl"><a data-link-type="idl" href="#csskeyframerule" id="ref-for-csskeyframerule⑤">CSSKeyframeRule</a></code> <dd> The found rule or <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined②">undefined</a></code> if there is no rule at the specific index. </dl> <p>No Exceptions</p> <h4 class="heading settled" data-level="6.3.4" id="interface-csskeyframesrule-appendrule"><span class="secno">6.3.4. </span><span class="content"> The <code>appendRule</code> method</span><a class="self-link" href="#interface-csskeyframesrule-appendrule"></a></h4> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="CSSKeyframesRule" data-dfn-type="method" data-export data-lt="appendRule(rule)" id="dom-csskeyframesrule-appendrule"><code>appendRule</code></dfn> method appends the passed <code class="idl"><a data-link-type="idl" href="#csskeyframerule" id="ref-for-csskeyframerule⑥">CSSKeyframeRule</a></code> at the end of the keyframes rule.</p> <p>Parameters:</p> <dl> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="CSSKeyframesRule/appendRule(rule)" data-dfn-type="argument" data-export id="dom-csskeyframesrule-appendrule-rule-rule"><code>rule</code></dfn> of type <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring①④">CSSOMString</a></code> <dd> The rule to be appended, expressed in the same syntax as one entry in the <a class="css" data-link-type="maybe" href="#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes⑨">@keyframes</a> rule. A valid rule is always appended e.g. even if its key(s) already exists. </dl> <p>No Return Value</p> <p>No Exceptions</p> <h4 class="heading settled" data-level="6.3.5" id="interface-csskeyframesrule-deleterule"><span class="secno">6.3.5. </span><span class="content"> The <code>deleteRule</code> method</span><a class="self-link" href="#interface-csskeyframesrule-deleterule"></a></h4> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="CSSKeyframesRule" data-dfn-type="method" data-export data-lt="deleteRule(select)" id="dom-csskeyframesrule-deleterule"><code>deleteRule</code></dfn> method deletes the last declared <code class="idl"><a data-link-type="idl" href="#csskeyframerule" id="ref-for-csskeyframerule⑦">CSSKeyframeRule</a></code> matching the specified keyframe selector. If no matching rule exists, the method does nothing.</p> <p>Parameters:</p> <dl> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="CSSKeyframesRule/deleteRule(select)" data-dfn-type="argument" data-export id="dom-csskeyframesrule-deleterule-select-select"><code>select</code></dfn> of type <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring①⑤">CSSOMString</a></code> <dd> The keyframe selector of the rule to be deleted: a comma-separated list of percentage values between 0% and 100% or the keywords <span class="css">from</span> or <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-shapes-2/#valdef-shape-to" id="ref-for-valdef-shape-to⑥">to</a> which resolve to 0% and 100%, respectively. <p>The number and order of the values in the specified keyframe selector must match those of the targeted keyframe rule(s). The match is not sensitive to white space around the values in the list.</p> </dl> <p>No Return Value</p> <p>No Exceptions</p> <h4 class="heading settled" data-level="6.3.6" id="interface-csskeyframesrule-findrule"><span class="secno">6.3.6. </span><span class="content"> The <code>findRule</code> method</span><a class="self-link" href="#interface-csskeyframesrule-findrule"></a></h4> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="CSSKeyframesRule" data-dfn-type="method" data-export data-lt="findRule(select)" id="dom-csskeyframesrule-findrule"><code>findRule</code></dfn> returns the last declared <code class="idl"><a data-link-type="idl" href="#csskeyframerule" id="ref-for-csskeyframerule⑧">CSSKeyframeRule</a></code> matching the specified keyframe selector. If no matching rule exists, the method does nothing.</p> <p>Parameters:</p> <dl> <dt><dfn class="dfn-paneled idl-code" data-dfn-for="CSSKeyframesRule/findRule(select)" data-dfn-type="argument" data-export id="dom-csskeyframesrule-findrule-select-select"><code>select</code></dfn> of type <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/cssom-1/#cssomstring" id="ref-for-cssomstring①⑥">CSSOMString</a></code> <dd> The keyframe selector of the rule to be found: a comma-separated list of percentage values between 0% and 100% or the keywords <span class="css">from</span> or <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-shapes-2/#valdef-shape-to" id="ref-for-valdef-shape-to⑦">to</a> which resolve to 0% and 100%, respectively. <p>The number and order of the values in the specified keyframe selector must match those of the targeted keyframe rule(s). The match is not sensitive to white space around the values in the list.</p> </dl> <p>Return Value:</p> <dl> <dt><code class="idl"><a data-link-type="idl" href="#csskeyframerule" id="ref-for-csskeyframerule⑨">CSSKeyframeRule</a></code> <dd> The found rule. </dl> <p>No Exceptions</p> <div class="example" id="example-d1f87811"> <a class="self-link" href="#example-d1f87811"></a> For example, given the following animation: <pre>@keyframes colorful-diagonal-slide { from { left: 0; top: 0; } 10% { background-color: blue; } 10% { background-color: green; } 25%, 75% { background-color: red; } 100% { left: 100px; top: 100px; } } </pre> <p>Assuming the variable <code>anim</code> holds a reference to a CSSKeyframesRule object for this animation, then:</p> <pre>anim.deleteRule('10%'); var tenPercent = anim.findRule('10%'); </pre> <p>will start by deleting the last 10% rule i.e. the green background color rule; then find the remaining blue background rule and return it into <code>tenPercent</code>.</p> <p>The following:</p> <pre>var red = anim.findRule('75%'); </pre> <p>will set <code>red</code> to <code>null</code>. The full selector for the red background color rule must be used instead:</p> <pre>var red = anim.findRule('25%,75%'); </pre> <p>Since <span class="css">from</span> maps to 0% and <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-shapes-2/#valdef-shape-to" id="ref-for-valdef-shape-to⑧">to</a> maps to 100%, we can find these rules using either value:</p> <pre>var from = anim.findRule('0%'); // Returns from { left: 0; top: 0; } rule var to = anim.findRule('to'); // Returns 100% { left: 100px; top: 100px; } rule </pre> </div> <h3 class="heading settled" data-level="6.4" id="interface-globaleventhandlers"><span class="secno">6.4. </span><span class="content"> Extensions to the <code>GlobalEventHandlers</code> Interface Mixin</span><a class="self-link" href="#interface-globaleventhandlers"></a></h3> <p>This specification extends the <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers" id="ref-for-globaleventhandlers">GlobalEventHandlers</a></code> interface mixin from HTML to add <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-idl-attributes" id="ref-for-event-handler-idl-attributes②">event handler IDL attributes</a> for <a href="#events">animation events</a> as defined in <a href="#event-handlers-on-elements-document-objects-and-window-objects">§ 5.3 Event handlers on elements, Document objects, and Window objects</a>.</p> <h4 class="heading settled" data-level="6.4.1" id="interface-globaleventhandlers-idl"><span class="secno">6.4.1. </span><span class="content"> IDL Definition</span><a class="self-link" href="#interface-globaleventhandlers-idl"></a></h4> <pre class="idl highlight def"><c- b>partial</c-> <c- b>interface</c-> <c- b>mixin</c-> <a class="idl-code" data-link-type="interface" href="https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers" id="ref-for-globaleventhandlers①"><c- g>GlobalEventHandlers</c-></a> { <c- b>attribute</c-> <a data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler"><c- n>EventHandler</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="GlobalEventHandlers" data-dfn-type="attribute" data-export data-type="EventHandler" id="dom-globaleventhandlers-onanimationstart"><code><c- g>onanimationstart</c-></code></dfn>; <c- b>attribute</c-> <a data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler①"><c- n>EventHandler</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="GlobalEventHandlers" data-dfn-type="attribute" data-export data-type="EventHandler" id="dom-globaleventhandlers-onanimationiteration"><code><c- g>onanimationiteration</c-></code></dfn>; <c- b>attribute</c-> <a data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler②"><c- n>EventHandler</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="GlobalEventHandlers" data-dfn-type="attribute" data-export data-type="EventHandler" id="dom-globaleventhandlers-onanimationend"><code><c- g>onanimationend</c-></code></dfn>; <c- b>attribute</c-> <a data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler③"><c- n>EventHandler</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="GlobalEventHandlers" data-dfn-type="attribute" data-export data-type="EventHandler" id="dom-globaleventhandlers-onanimationcancel"><code><c- g>onanimationcancel</c-></code></dfn>; }; </pre> <h2 class="heading settled" data-level="7" id="priv"><span class="secno">7. </span><span class="content"> Privacy Considerations</span><a class="self-link" href="#priv"></a></h2> <p>No privacy concerns have been reported on this specification.</p> <h2 class="heading settled" data-level="8" id="sec"><span class="secno">8. </span><span class="content"> Security Considerations</span><a class="self-link" href="#sec"></a></h2> <p>No security concerns have been reported on this specification.</p> <h2 class="heading settled" data-level="9" id="changes"><span class="secno">9. </span><span class="content">Changes</span><a class="self-link" href="#changes"></a></h2> <h3 class="heading settled" data-level="9.1" id="changes-20181011"><span class="secno">9.1. </span><span class="content">Changes since the <a href="https://www.w3.org/TR/2018/WD-css-animations-1-20181011/">Working Draft of 11 October 2018</a></span><a class="self-link" href="#changes-20181011"></a></h3> <p>The following substantive changes were made:</p> <ul> <li>Defined indexed property getter for CSSKeyframesRule <li>Added constructor type on AnimationEvent’s definition <li>Added required unit for dimension in range notation <li>Applied range definition notation to descriptor and rule’s prelude values <li>Applied range definition notation to property values <li>Associated event definitions with their EventHandler container <li>Better markup for productions <li>Corrected typo (rule to be found, not rule to be deleted) <li>Made value definition reference consistent with other CSS specifications <li>IDL aligned with Web IDL specification <li>Added default dictionary value to constructor <li>Rewrote confusing example (<a href="https://github.com/w3c/csswg-drafts/issues/4118">#4118</a>) <li>Clarified handling of zero-duration animations <li>Use "not animatable" rather than "none" <li>Timing functions now called easing functions <li>Changed GlobalEventHandlers to be a mixin </ul> <h2 class="heading settled" data-level="10" id="acknowledgements"><span class="secno">10. </span><span class="content"> Acknowledgements</span><a class="self-link" href="#acknowledgements"></a></h2> <p>Thanks especially to the feedback from Tab Atkins, Brian Birtles, Shane Stephens, Carine Bournez, Christian Budde, Anne van Kesteren, Øyvind Stenhaug, Estelle Weyl, and all the rest of the www-style community.</p> <h2 class="heading settled" data-level="11" id="other-open-issues"><span class="secno">11. </span><span class="content">Other open issues</span><a class="self-link" href="#other-open-issues"></a></h2> <p class="issue" id="issue-c01277bc"><a class="self-link" href="#issue-c01277bc"></a>Need to <a href="https://lists.w3.org/Archives/Public/www-style/2015Jul/0391.html">specify how keyframes interact</a>.</p> <h2 class="heading settled" data-level="12" id="wg-resolutions-pending"><span class="secno">12. </span><span class="content"> Working Group Resolutions that are pending editing</span><a class="self-link" href="#wg-resolutions-pending"></a></h2> <p><em>This section is informative and temporary.</em></p> <p>The editors are currently behind on editing this spec. The following working group resolutions still need to be edited in:</p> <ul> <li> 2014-09-09 minutes (Antibes f2f) <ul> <li>Issue(7335): Detail how/when keyframe values are computed; using <a href="https://lists.w3.org/Archives/Public/www-style/2014Aug/0132.html">G.beta in dbaron’s mail</a> <li> <del>Agreed that both transitions and animations animate all properties. css-transitions to define animation of non-interoperable/discrete values. They take their starting values below 50% timing function progress, and end values above</del> <li> <del>Dynamic changes to animation properties/keyframes. Tab to propose resolution. (<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=14713">Bug 14713</a>) </del> <li> <del>Negative animation-delay values apply against the active duration of the animation i.e. (animation-duration*animation-iteration-count). The delay can thus swallow iterations for which no iteration event will be fired. The start/end events are still fired. Even when delay == (-1*active_duration) </del> <li> <del>Fire animation start/end events when animation-duration is zero, with 0 elapsedTime </del> <li> <del>If animation-iteration-count is infinite and duration is 0, treat the iteration-count as if it was finite and run a 0s second (option A in <a href="https://lists.w3.org/Archives/Public/www-style/2014Sep/0056.html">Brian’s mail</a>) </del> <li> <del>If an animation with a negative animation delay is initially paused, the start event still fires </del> </ul> <li> 2012-10-29 minutes <ul> <li> <del>Change the animation properties to be dynamically changeable </del> <li> <del>@keyframes can be dynamically changed </del> <li> <del>When you encounter duplicate animations names, last one wins.</del> <li> <del>Make *animations* transition *all* properties. Unless otherwise specified, discrete properties take their starting values below 50% timing function progress, and end values above 50% timing function progress.</del> </ul> <li> 2012-12-12 minutes and intermediate comments <del>and 2012-12-19 minutes</del> <ul> <li> <del>Animations only run if they contain at least one valid keyframe rule (<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15251">Bug</a>) </del> <li> <del>When an element changes from display:none to display: non-none, animations start immediately (<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=14785">Bug</a>)</del> <li> <del>An initially-paused animation is still started (fires start events etc.) (<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=14774">Bug</a>) </del> <li> <del>Animations can be paused during their delay phase, which freezes the remaining delay to be applied after it unpauses (<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=14774">Bug</a>)</del> <li> <del>animation-play-state has the same list behavior as the other animation properties, matching the length of animation-name (<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=14786">Bug</a>)</del> </ul> <li> 2013-02-20 minutes <ul> <li> <del>Øyvind’s clarification accepted</del> <li> <del>keyframe rules cascade</del> <li> <del>mark pseudoElement at-risk</del> </ul> <li> 2013-05-30 minutes <ul> <li> <del>expectations on animations in non-interactive media</del> </ul> <li> 2014-01-27 minutes <ul> <li> <del>remove text about waiting for document load</del> </ul> </ul> </main> <h2 class="no-ref no-num heading settled" id="w3c-conformance"><span class="content"> Conformance</span><a class="self-link" href="#w3c-conformance"></a></h2> <h3 class="no-ref heading settled" id="w3c-conventions"><span class="content"> Document conventions</span><a class="self-link" href="#w3c-conventions"></a></h3> <p>Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification. </p> <p>All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119" title="Key words for use in RFCs to Indicate Requirement Levels">[RFC2119]</a></p> <p>Examples in this specification are introduced with the words “for example” or are set apart from the normative text with <code>class="example"</code>, like this: </p> <div class="example" id="w3c-example"> <a class="self-link" href="#w3c-example"></a> <p>This is an example of an informative example.</p> </div> <p>Informative notes begin with the word “Note” and are set apart from the normative text with <code>class="note"</code>, like this: </p> <p class="note" role="note">Note, this is an informative note.</p> <p>Advisements are normative sections styled to evoke special attention and are set apart from other normative text with <code>&lt;strong class="advisement"></code>, like this: <strong class="advisement"> UAs MUST provide an accessible alternative. </strong></p> <h3 class="no-ref heading settled" id="w3c-conformance-classes"><span class="content"> Conformance classes</span><a class="self-link" href="#w3c-conformance-classes"></a></h3> <p>Conformance to this specification is defined for three conformance classes: </p> <dl> <dt>style sheet <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS style sheet</a>. <dt>renderer <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that interprets the semantics of a style sheet and renders documents that use them. <dt>authoring tool <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that writes a style sheet. </dl> <p>A style sheet is conformant to this specification if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module. </p> <p>A renderer is conformant to this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.) </p> <p>An authoring tool is conformant to this specification if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module. </p> <h3 class="no-ref heading settled" id="w3c-partial"><span class="content"> Partial implementations</span><a class="self-link" href="#w3c-partial"></a></h3> <p>So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers <strong>must</strong> treat as invalid (and <a href="https://www.w3.org/TR/CSS21/conform.html#ignore">ignore as appropriate</a>) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents <strong>must not</strong> selectively ignore unsupported component values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.</p> <h4 class="heading settled" id="w3c-conform-future-proofing"><span class="content"> Implementations of Unstable and Proprietary Features</span><a class="self-link" href="#w3c-conform-future-proofing"></a></h4> <p>To avoid clashes with future stable CSS features, the CSSWG recommends <a href="https://www.w3.org/TR/CSS/#future-proofing">following best practices</a> for the implementation of <a href="https://www.w3.org/TR/CSS/#unstable">unstable</a> features and <a href="https://www.w3.org/TR/CSS/#proprietary-extension">proprietary extensions</a> to CSS. </p> <h3 class="no-ref heading settled" id="w3c-testing"><span class="content"> Non-experimental implementations</span><a class="self-link" href="#w3c-testing"></a></h3> <p>Once a specification reaches the Candidate Recommendation stage, non-experimental implementations are possible, and implementors should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec. </p> <p>To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group. </p> <p>Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at <a href="https://www.w3.org/Style/CSS/Test/">https://www.w3.org/Style/CSS/Test/</a>. Questions should be directed to the <a href="https://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a> mailing list.</p> <script src="https://www.w3.org/scripts/TR/2021/fixup.js"></script> <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2> <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3> <ul class="index"> <li><a href="#active-duration">active duration</a><span>, in § 4.4</span> <li><a href="#valdef-animation-direction-alternate">alternate</a><span>, in § 4.5</span> <li><a href="#valdef-animation-direction-alternate-reverse">alternate-reverse</a><span>, in § 4.5</span> <li><a href="#propdef-animation">animation</a><span>, in § 4.9</span> <li><a href="#eventdef-globaleventhandlers-animationcancel">animationcancel</a><span>, in § 5.2</span> <li><a href="#propdef-animation-delay">animation-delay</a><span>, in § 4.7</span> <li><a href="#propdef-animation-direction">animation-direction</a><span>, in § 4.5</span> <li><a href="#propdef-animation-duration">animation-duration</a><span>, in § 4.2</span> <li><a href="#eventdef-globaleventhandlers-animationend">animationend</a><span>, in § 5.2</span> <li><a href="#animationevent">AnimationEvent</a><span>, in § 5.1.1</span> <li><a href="#dictdef-animationeventinit">AnimationEventInit</a><span>, in § 5.1.1</span> <li><a href="#dom-animationevent-animationevent">AnimationEvent(type)</a><span>, in § 5.1.2</span> <li><a href="#dom-animationevent-animationevent">AnimationEvent(type, animationEventInitDict)</a><span>, in § 5.1.2</span> <li><a href="#propdef-animation-fill-mode">animation-fill-mode</a><span>, in § 4.8</span> <li><a href="#eventdef-globaleventhandlers-animationiteration">animationiteration</a><span>, in § 5.2</span> <li><a href="#propdef-animation-iteration-count">animation-iteration-count</a><span>, in § 4.4</span> <li><a href="#propdef-animation-name">animation-name</a><span>, in § 4.1</span> <li> animationName <ul> <li><a href="#dom-animationevent-animationname">attribute for AnimationEvent</a><span>, in § 5.1.2</span> <li><a href="#dom-animationeventinit-animationname">dict-member for AnimationEventInit</a><span>, in § 5.1.1</span> </ul> <li><a href="#propdef-animation-play-state">animation-play-state</a><span>, in § 4.6</span> <li><a href="#eventdef-globaleventhandlers-animationstart">animationstart</a><span>, in § 5.2</span> <li><a href="#propdef-animation-timing-function">animation-timing-function</a><span>, in § 4.3</span> <li><a href="#dom-csskeyframesrule-appendrule">appendRule(rule)</a><span>, in § 6.3.4</span> <li><a href="#valdef-animation-fill-mode-backwards">backwards</a><span>, in § 4.8</span> <li><a href="#valdef-animation-fill-mode-both">both</a><span>, in § 4.8</span> <li><a href="#dom-animationevent-animationevent">constructor(type)</a><span>, in § 5.1.2</span> <li><a href="#dom-animationevent-animationevent">constructor(type, animationEventInitDict)</a><span>, in § 5.1.2</span> <li><a href="#csskeyframerule">CSSKeyframeRule</a><span>, in § 6.2.1</span> <li><a href="#csskeyframesrule">CSSKeyframesRule</a><span>, in § 6.3.1</span> <li><a href="#dom-csskeyframesrule-cssrules">cssRules</a><span>, in § 6.3.2</span> <li><a href="#dom-csskeyframesrule-deleterule">deleteRule(select)</a><span>, in § 6.3.5</span> <li> elapsedTime <ul> <li><a href="#dom-animationevent-elapsedtime">attribute for AnimationEvent</a><span>, in § 5.1.2</span> <li><a href="#dom-animationeventinit-elapsedtime">dict-member for AnimationEventInit</a><span>, in § 5.1.1</span> </ul> <li><a href="#dom-csskeyframesrule-findrule">findRule(select)</a><span>, in § 6.3.6</span> <li><a href="#valdef-animation-fill-mode-forwards">forwards</a><span>, in § 4.8</span> <li><a href="#dom-csskeyframesrule-__getter__">__getter__(index)</a><span>, in § 6.3.3</span> <li><a href="#valdef-animation-iteration-count-infinite">infinite</a><span>, in § 4.4</span> <li><a href="#typedef-keyframe-block">&lt;keyframe-block></a><span>, in § 3</span> <li><a href="#dom-cssrule-keyframe_rule">KEYFRAME_RULE</a><span>, in § 6.1.1</span> <li><a href="#at-ruledef-keyframes">@keyframes</a><span>, in § 3</span> <li><a href="#typedef-keyframe-selector">&lt;keyframe-selector></a><span>, in § 3</span> <li> &lt;keyframes-name> <ul> <li><a href="#typedef-keyframes-name">(type)</a><span>, in § 3</span> <li><a href="#valdef-animation-name-keyframes-name">value for animation-name</a><span>, in § 4.1</span> </ul> <li><a href="#dom-cssrule-keyframes_rule">KEYFRAMES_RULE</a><span>, in § 6.1.1</span> <li><a href="#dom-csskeyframerule-keytext">keyText</a><span>, in § 6.2.2</span> <li><a href="#dom-csskeyframesrule-length">length</a><span>, in § 6.3.2</span> <li><a href="#dom-csskeyframesrule-name">name</a><span>, in § 6.3.2</span> <li> none <ul> <li><a href="#valdef-animation-fill-mode-none">value for animation-fill-mode</a><span>, in § 4.8</span> <li><a href="#valdef-animation-name-none">value for animation-name</a><span>, in § 4.1</span> </ul> <li><a href="#valdef-animation-direction-normal">normal</a><span>, in § 4.5</span> <li><a href="#valdef-animation-iteration-count-number-0">&lt;number [0,∞]></a><span>, in § 4.4</span> <li> onanimationcancel <ul> <li><a href="#dom-document-onanimationcancel">attribute for Document, Window</a><span>, in § 5.3</span> <li><a href="#dom-globaleventhandlers-onanimationcancel">attribute for GlobalEventHandlers</a><span>, in § 6.4.1</span> </ul> <li> onanimationend <ul> <li><a href="#dom-document-onanimationend">attribute for Document, Window</a><span>, in § 5.3</span> <li><a href="#dom-globaleventhandlers-onanimationend">attribute for GlobalEventHandlers</a><span>, in § 6.4.1</span> </ul> <li> onanimationiteration <ul> <li><a href="#dom-document-onanimationiteration">attribute for Document, Window</a><span>, in § 5.3</span> <li><a href="#dom-globaleventhandlers-onanimationiteration">attribute for GlobalEventHandlers</a><span>, in § 6.4.1</span> </ul> <li> onanimationstart <ul> <li><a href="#dom-document-onanimationstart">attribute for Document, Window</a><span>, in § 5.3</span> <li><a href="#dom-globaleventhandlers-onanimationstart">attribute for GlobalEventHandlers</a><span>, in § 6.4.1</span> </ul> <li><a href="#valdef-animation-play-state-paused">paused</a><span>, in § 4.6</span> <li> pseudoElement <ul> <li><a href="#dom-animationevent-pseudoelement">attribute for AnimationEvent</a><span>, in § 5.1.2</span> <li><a href="#dom-animationeventinit-pseudoelement">dict-member for AnimationEventInit</a><span>, in § 5.1.1</span> </ul> <li><a href="#valdef-animation-direction-reverse">reverse</a><span>, in § 4.5</span> <li><a href="#valdef-animation-play-state-running">running</a><span>, in § 4.6</span> <li><a href="#typedef-single-animation">&lt;single-animation></a><span>, in § 4.9</span> <li><a href="#typedef-single-animation-direction">&lt;single-animation-direction></a><span>, in § 4.5</span> <li><a href="#typedef-single-animation-fill-mode">&lt;single-animation-fill-mode></a><span>, in § 4.8</span> <li><a href="#typedef-single-animation-iteration-count">&lt;single-animation-iteration-count></a><span>, in § 4.4</span> <li><a href="#typedef-single-animation-play-state">&lt;single-animation-play-state></a><span>, in § 4.6</span> <li><a href="#dom-csskeyframerule-style">style</a><span>, in § 6.2.2</span> <li><a href="#valdef-animation-delay-time">&lt;time></a><span>, in § 4.7</span> <li><a href="#valdef-animation-duration-time-0s">&lt;time [0s,∞]></a><span>, in § 4.2</span> </ul> <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3> <ul class="index"> <li> <a data-link-type="biblio">[]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="99316c56">event constructor</span> </ul> <li> <a data-link-type="biblio">[CSS-CASCADE-5]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="36261173">longhand</span> <li><span class="dfn-paneled" id="e14541aa">shorthand</span> </ul> <li> <a data-link-type="biblio">[CSS-DISPLAY-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="2ccfe434">display</span> <li><span class="dfn-paneled" id="1a017cd1">none</span> </ul> <li> <a data-link-type="biblio">[CSS-EASING-2]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="eef9f659">&lt;easing-function></span> <li><span class="dfn-paneled" id="ea6ea52c">ease-in</span> <li><span class="dfn-paneled" id="003fd744">ease-out</span> <li><span class="dfn-paneled" id="1dd77088">input progress value</span> <li><span class="dfn-paneled" id="035a0bad">output progress value</span> <li><span class="dfn-paneled" id="4f60cc66">start</span> <li><span class="dfn-paneled" id="0b00b5c1">step easing function</span> <li><span class="dfn-paneled" id="95b5db38">step position</span> </ul> <li> <a data-link-type="biblio">[CSS-SHAPES-2]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="38cf5d56">to</span> </ul> <li> <a data-link-type="biblio">[CSS-SYNTAX-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="a81b1fb8">&lt;declaration-list></span> <li><span class="dfn-paneled" id="3d312fb4">&lt;qualified-rule-list></span> <li><span class="dfn-paneled" id="a8cb81d7">&lt;rule-list></span> </ul> <li> <a data-link-type="biblio">[CSS-VALUES-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="bb5f9e40">&lt;time></span> </ul> <li> <a data-link-type="biblio">[CSS-VALUES-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="c297b070">#</span> <li><span class="dfn-paneled" id="a0144f62">&lt;custom-ident></span> <li><span class="dfn-paneled" id="61bb5e44">&lt;number></span> <li><span class="dfn-paneled" id="128295ac">&lt;percentage></span> <li><span class="dfn-paneled" id="1d798932">&lt;string></span> <li><span class="dfn-paneled" id="b35178c1">coordinated value list</span> <li><span class="dfn-paneled" id="d8b99652">coordinating list base property</span> <li><span class="dfn-paneled" id="d9c21938">coordinating list property group</span> <li><span class="dfn-paneled" id="842014fe">CSS identifier</span> <li><span class="dfn-paneled" id="8a110a7b">CSS-wide keywords</span> <li><span class="dfn-paneled" id="4eb9d37e">|</span> <li><span class="dfn-paneled" id="a0336d84">||</span> </ul> <li> <a data-link-type="biblio">[CSS-WILL-CHANGE-1]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="81ec7485">will-change</span> </ul> <li> <a data-link-type="biblio">[CSS2]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="5c96d703">background-image</span> <li><span class="dfn-paneled" id="49a17925">left</span> </ul> <li> <a data-link-type="biblio">[CSSOM-1]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="9d357000">CSSOMString</span> <li><span class="dfn-paneled" id="0f78dbdd">CSSRule</span> <li><span class="dfn-paneled" id="26896c20">CSSRuleList</span> <li><span class="dfn-paneled" id="f9bcb636">CSSStyleProperties</span> <li><span class="dfn-paneled" id="9852f862">declarations</span> <li><span class="dfn-paneled" id="451490eb">owner node</span> <li><span class="dfn-paneled" id="56031446">parent CSS rule</span> <li><span class="dfn-paneled" id="6eabcb67">readonly flag</span> <li><span class="dfn-paneled" id="ec9c26d7">specified order</span> </ul> <li> <a data-link-type="biblio">[DOM]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="85394472">Document</span> <li><span class="dfn-paneled" id="129bdae8">Event</span> <li><span class="dfn-paneled" id="44a7708c">EventInit</span> </ul> <li> <a data-link-type="biblio">[HTML]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="f0951476">EventHandler</span> <li><span class="dfn-paneled" id="762ce945">GlobalEventHandlers</span> <li><span class="dfn-paneled" id="5d7209e9">Window</span> <li><span class="dfn-paneled" id="b22ae7ee">event handler content attributes</span> <li><span class="dfn-paneled" id="9d386f55">event handler event type</span> <li><span class="dfn-paneled" id="d4689c67">event handler IDL attributes</span> <li><span class="dfn-paneled" id="e9189aba">event handlers</span> <li><span class="dfn-paneled" id="49a64d88">HTML elements</span> </ul> <li> <a data-link-type="biblio">[I18N-GLOSSARY]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="612b2c54">case-sensitive</span> </ul> <li> <a data-link-type="biblio">[WEBIDL]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="889e932f">Exposed</span> <li><span class="dfn-paneled" id="21ecf38f">PutForwards</span> <li><span class="dfn-paneled" id="a5c91173">SameObject</span> <li><span class="dfn-paneled" id="be2d2b4c">SyntaxError</span> <li><span class="dfn-paneled" id="8c800cdf">double</span> <li><span class="dfn-paneled" id="5f90bbfb">undefined</span> <li><span class="dfn-paneled" id="e97a9688">unsigned long</span> <li><span class="dfn-paneled" id="450958f7">unsigned short</span> </ul> </ul> <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2> <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3> <dl> <dt id="biblio-css-cascade-5">[CSS-CASCADE-5] <dd>Elika Etemad; Miriam Suzanne; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-cascade-5/"><cite>CSS Cascading and Inheritance Level 5</cite></a>. 13 January 2022. CR. URL: <a href="https://www.w3.org/TR/css-cascade-5/">https://www.w3.org/TR/css-cascade-5/</a> <dt id="biblio-css-display-3">[CSS-DISPLAY-3] <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-display-3/"><cite>CSS Display Module Level 3</cite></a>. 30 March 2023. CR. URL: <a href="https://www.w3.org/TR/css-display-3/">https://www.w3.org/TR/css-display-3/</a> <dt id="biblio-css-easing-1">[CSS-EASING-1] <dd>Brian Birtles; Dean Jackson; Matt Rakow. <a href="https://www.w3.org/TR/css-easing-1/"><cite>CSS Easing Functions Level 1</cite></a>. 13 February 2023. CR. URL: <a href="https://www.w3.org/TR/css-easing-1/">https://www.w3.org/TR/css-easing-1/</a> <dt id="biblio-css-easing-2">[CSS-EASING-2] <dd><a href="https://www.w3.org/TR/css-easing-2/"><cite>CSS Easing Functions Level 2</cite></a>. 29 August 2024. WD. URL: <a href="https://www.w3.org/TR/css-easing-2/">https://www.w3.org/TR/css-easing-2/</a> <dt id="biblio-css-shapes-2">[CSS-SHAPES-2] <dd><a href="https://drafts.csswg.org/css-shapes-2/"><cite>CSS Shapes Module Level 2</cite></a>. Editor's Draft. URL: <a href="https://drafts.csswg.org/css-shapes-2/">https://drafts.csswg.org/css-shapes-2/</a> <dt id="biblio-css-syntax-3">[CSS-SYNTAX-3] <dd>Tab Atkins Jr.; Simon Sapin. <a href="https://www.w3.org/TR/css-syntax-3/"><cite>CSS Syntax Module Level 3</cite></a>. 24 December 2021. CR. URL: <a href="https://www.w3.org/TR/css-syntax-3/">https://www.w3.org/TR/css-syntax-3/</a> <dt id="biblio-css-values-3">[CSS-VALUES-3] <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-3/"><cite>CSS Values and Units Module Level 3</cite></a>. 22 March 2024. CR. URL: <a href="https://www.w3.org/TR/css-values-3/">https://www.w3.org/TR/css-values-3/</a> <dt id="biblio-css-values-4">[CSS-VALUES-4] <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-4/"><cite>CSS Values and Units Module Level 4</cite></a>. 12 March 2024. WD. URL: <a href="https://www.w3.org/TR/css-values-4/">https://www.w3.org/TR/css-values-4/</a> <dt id="biblio-css-will-change-1">[CSS-WILL-CHANGE-1] <dd>Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-will-change-1/"><cite>CSS Will Change Module Level 1</cite></a>. 5 May 2022. CR. URL: <a href="https://www.w3.org/TR/css-will-change-1/">https://www.w3.org/TR/css-will-change-1/</a> <dt id="biblio-css2">[CSS2] <dd>Bert Bos; et al. <a href="https://www.w3.org/TR/CSS21/"><cite>Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</cite></a>. 7 June 2011. REC. URL: <a href="https://www.w3.org/TR/CSS21/">https://www.w3.org/TR/CSS21/</a> <dt id="biblio-css3cascade">[CSS3CASCADE] <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-cascade-3/"><cite>CSS Cascading and Inheritance Level 3</cite></a>. 11 February 2021. REC. URL: <a href="https://www.w3.org/TR/css-cascade-3/">https://www.w3.org/TR/css-cascade-3/</a> <dt id="biblio-cssom-1">[CSSOM-1] <dd>Daniel Glazman; Emilio Cobos Álvarez. <a href="https://www.w3.org/TR/cssom-1/"><cite>CSS Object Model (CSSOM)</cite></a>. 26 August 2021. WD. URL: <a href="https://www.w3.org/TR/cssom-1/">https://www.w3.org/TR/cssom-1/</a> <dt id="biblio-dom">[DOM] <dd>Anne van Kesteren. <a href="https://dom.spec.whatwg.org/"><cite>DOM Standard</cite></a>. Living Standard. URL: <a href="https://dom.spec.whatwg.org/">https://dom.spec.whatwg.org/</a> <dt id="biblio-html">[HTML] <dd>Anne van Kesteren; et al. <a href="https://html.spec.whatwg.org/multipage/"><cite>HTML Standard</cite></a>. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a> <dt id="biblio-i18n-glossary">[I18N-GLOSSARY] <dd>Richard Ishida; Addison Phillips. <a href="https://www.w3.org/TR/i18n-glossary/"><cite>Internationalization Glossary</cite></a>. 17 October 2024. NOTE. URL: <a href="https://www.w3.org/TR/i18n-glossary/">https://www.w3.org/TR/i18n-glossary/</a> <dt id="biblio-rfc2119">[RFC2119] <dd>S. Bradner. <a href="https://datatracker.ietf.org/doc/html/rfc2119"><cite>Key words for use in RFCs to Indicate Requirement Levels</cite></a>. March 1997. Best Current Practice. URL: <a href="https://datatracker.ietf.org/doc/html/rfc2119">https://datatracker.ietf.org/doc/html/rfc2119</a> <dt id="biblio-wcag20">[WCAG20] <dd>Ben Caldwell; et al. <a href="https://www.w3.org/TR/WCAG20/"><cite>Web Content Accessibility Guidelines (WCAG) 2.0</cite></a>. 11 December 2008. REC. URL: <a href="https://www.w3.org/TR/WCAG20/">https://www.w3.org/TR/WCAG20/</a> <dt id="biblio-webidl">[WEBIDL] <dd>Edgar Chen; Timothy Gu. <a href="https://webidl.spec.whatwg.org/"><cite>Web IDL Standard</cite></a>. Living Standard. URL: <a href="https://webidl.spec.whatwg.org/">https://webidl.spec.whatwg.org/</a> </dl> <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3> <dl> <dt id="biblio-css3-transitions">[CSS3-TRANSITIONS] <dd>David Baron; et al. <a href="https://www.w3.org/TR/css-transitions-1/"><cite>CSS Transitions</cite></a>. 11 October 2018. WD. URL: <a href="https://www.w3.org/TR/css-transitions-1/">https://www.w3.org/TR/css-transitions-1/</a> </dl> <h2 class="no-num no-ref heading settled" id="property-index"><span class="content">Property Index</span><a class="self-link" href="#property-index"></a></h2> <div class="big-element-wrapper"> <table class="index"> <thead> <tr> <th scope="col">Name <th scope="col">Value <th scope="col">Initial <th scope="col">Applies to <th scope="col">Inh. <th scope="col">%ages <th scope="col">Anim­ation type <th scope="col">Canonical order <th scope="col">Com­puted value <tbody> <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-animation" id="ref-for-propdef-animation⑥">animation</a> <td>&lt;single-animation># <td>see individual properties <td>all elements <td>no <td>N/A <td>not animatable <td>per grammar <td>see individual properties <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-animation-delay" id="ref-for-propdef-animation-delay①⑥">animation-delay</a> <td>&lt;time># <td>0s <td>all elements <td>no <td>N/A <td>not animatable <td>per grammar <td>list, each item a duration <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-animation-direction" id="ref-for-propdef-animation-direction⑧">animation-direction</a> <td>&lt;single-animation-direction># <td>normal <td>all elements <td>no <td>N/A <td>not animatable <td>per grammar <td>list, each item a keyword as specified <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-animation-duration" id="ref-for-propdef-animation-duration⑥">animation-duration</a> <td>&lt;time [0s,∞]># <td>0s <td>all elements <td>no <td>N/A <td>not animatable <td>per grammar <td>list, each item a duration <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-animation-fill-mode" id="ref-for-propdef-animation-fill-mode①①">animation-fill-mode</a> <td>&lt;single-animation-fill-mode># <td>none <td>all elements <td>no <td>N/A <td>not animatable <td>per grammar <td>list, each item a keyword as specified <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-animation-iteration-count" id="ref-for-propdef-animation-iteration-count⑦">animation-iteration-count</a> <td>&lt;single-animation-iteration-count># <td>1 <td>all elements <td>no <td>N/A <td>not animatable <td>per grammar <td>list, each item either a number or the keyword infinite <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-animation-name" id="ref-for-propdef-animation-name②⑦">animation-name</a> <td>[ none | &lt;keyframes-name> ]# <td>none <td>all elements <td>no <td>N/A <td>not animatable <td>per grammar <td>list, each item either a case-sensitive css identifier or the keyword none <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-animation-play-state" id="ref-for-propdef-animation-play-state④">animation-play-state</a> <td>&lt;single-animation-play-state># <td>running <td>all elements <td>no <td>N/A <td>not animatable <td>per grammar <td>list, each item a keyword as specified <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-animation-timing-function" id="ref-for-propdef-animation-timing-function⑦">animation-timing-function</a> <td>&lt;easing-function># <td>ease <td>all elements <td>no <td>N/A <td>not animatable <td>per grammar <td>list, each item a computed &lt;easing-function> </table> </div> <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">IDL Index</span><a class="self-link" href="#idl-index"></a></h2> <pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed"><c- g>Exposed</c-></a>=<c- n>Window</c->] <c- b>interface</c-> <a href="#animationevent"><code><c- g>AnimationEvent</c-></code></a> : <a data-link-type="idl-name" href="https://dom.spec.whatwg.org/#event"><c- n>Event</c-></a> { <a class="idl-code" data-link-type="constructor" href="#dom-animationevent-animationevent"><c- g>constructor</c-></a>(<a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring"><c- n>CSSOMString</c-></a> <a href="#dom-animationevent-animationevent-type-animationeventinitdict-type"><code><c- g>type</c-></code></a>, <c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-animationeventinit"><c- n>AnimationEventInit</c-></a> <a href="#dom-animationevent-animationevent-type-animationeventinitdict-animationeventinitdict"><code><c- g>animationEventInitDict</c-></code></a> = {}); <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="CSSOMString" href="#dom-animationevent-animationname"><c- g>animationName</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-double"><c- b>double</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="double" href="#dom-animationevent-elapsedtime"><c- g>elapsedTime</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="CSSOMString" href="#dom-animationevent-pseudoelement"><c- g>pseudoElement</c-></a>; }; <c- b>dictionary</c-> <a href="#dictdef-animationeventinit"><code><c- g>AnimationEventInit</c-></code></a> : <a data-link-type="idl-name" href="https://dom.spec.whatwg.org/#dictdef-eventinit"><c- n>EventInit</c-></a> { <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring"><c- n>CSSOMString</c-></a> <a data-default="&quot;&quot;" data-type="CSSOMString" href="#dom-animationeventinit-animationname"><code><c- g>animationName</c-></code></a> = ""; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-double"><c- b>double</c-></a> <a data-default="0.0" data-type="double" href="#dom-animationeventinit-elapsedtime"><code><c- g>elapsedTime</c-></code></a> = 0.0; <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring"><c- n>CSSOMString</c-></a> <a data-default="&quot;&quot;" data-type="CSSOMString" href="#dom-animationeventinit-pseudoelement"><code><c- g>pseudoElement</c-></code></a> = ""; }; <c- b>partial</c-> <c- b>interface</c-> <a class="idl-code" data-link-type="interface" href="https://www.w3.org/TR/cssom-1/#cssrule"><c- g>CSSRule</c-></a> { <c- b>const</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-short"><c- b>unsigned</c-> <c- b>short</c-></a> <a href="#dom-cssrule-keyframes_rule"><code><c- g>KEYFRAMES_RULE</c-></code></a> = 7; <c- b>const</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-short"><c- b>unsigned</c-> <c- b>short</c-></a> <a href="#dom-cssrule-keyframe_rule"><code><c- g>KEYFRAME_RULE</c-></code></a> = 8; }; [<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed"><c- g>Exposed</c-></a>=<c- n>Window</c->] <c- b>interface</c-> <a href="#csskeyframerule"><code><c- g>CSSKeyframeRule</c-></code></a> : <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssrule"><c- n>CSSRule</c-></a> { <c- b>attribute</c-> <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="CSSOMString" href="#dom-csskeyframerule-keytext"><c- g>keyText</c-></a>; [<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SameObject"><c- g>SameObject</c-></a>, <a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#PutForwards"><c- g>PutForwards</c-></a>=<a class="idl-code" data-link-type="attribute"><c- n>cssText</c-></a>] <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://drafts.csswg.org/cssom-1/#cssstyleproperties"><c- n>CSSStyleProperties</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="CSSStyleProperties" href="#dom-csskeyframerule-style"><c- g>style</c-></a>; }; [<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed"><c- g>Exposed</c-></a>=<c- n>Window</c->] <c- b>interface</c-> <a href="#csskeyframesrule"><code><c- g>CSSKeyframesRule</c-></code></a> : <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssrule"><c- n>CSSRule</c-></a> { <c- b>attribute</c-> <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="CSSOMString" href="#dom-csskeyframesrule-name"><c- g>name</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssrulelist"><c- n>CSSRuleList</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="CSSRuleList" href="#dom-csskeyframesrule-cssrules"><c- g>cssRules</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long"><c- b>unsigned</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="unsigned long" href="#dom-csskeyframesrule-length"><c- g>length</c-></a>; <c- b>getter</c-> <a data-link-type="idl-name" href="#csskeyframerule"><c- n>CSSKeyframeRule</c-></a> (<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long"><c- b>unsigned</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="argument" href="#dom-csskeyframesrule-__getter__-index-index"><c- g>index</c-></a>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#dom-csskeyframesrule-appendrule"><c- g>appendRule</c-></a>(<a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="argument" href="#dom-csskeyframesrule-appendrule-rule-rule"><c- g>rule</c-></a>); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined"><c- b>undefined</c-></a> <a class="idl-code" data-link-type="method" href="#dom-csskeyframesrule-deleterule"><c- g>deleteRule</c-></a>(<a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="argument" href="#dom-csskeyframesrule-deleterule-select-select"><c- g>select</c-></a>); <a data-link-type="idl-name" href="#csskeyframerule"><c- n>CSSKeyframeRule</c-></a>? <a class="idl-code" data-link-type="method" href="#dom-csskeyframesrule-findrule"><c- g>findRule</c-></a>(<a data-link-type="idl-name" href="https://www.w3.org/TR/cssom-1/#cssomstring"><c- n>CSSOMString</c-></a> <a class="idl-code" data-link-type="argument" href="#dom-csskeyframesrule-findrule-select-select"><c- g>select</c-></a>); }; <c- b>partial</c-> <c- b>interface</c-> <c- b>mixin</c-> <a class="idl-code" data-link-type="interface" href="https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers"><c- g>GlobalEventHandlers</c-></a> { <c- b>attribute</c-> <a data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"><c- n>EventHandler</c-></a> <a data-type="EventHandler" href="#dom-globaleventhandlers-onanimationstart"><code><c- g>onanimationstart</c-></code></a>; <c- b>attribute</c-> <a data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"><c- n>EventHandler</c-></a> <a data-type="EventHandler" href="#dom-globaleventhandlers-onanimationiteration"><code><c- g>onanimationiteration</c-></code></a>; <c- b>attribute</c-> <a data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"><c- n>EventHandler</c-></a> <a data-type="EventHandler" href="#dom-globaleventhandlers-onanimationend"><code><c- g>onanimationend</c-></code></a>; <c- b>attribute</c-> <a data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"><c- n>EventHandler</c-></a> <a data-type="EventHandler" href="#dom-globaleventhandlers-onanimationcancel"><code><c- g>onanimationcancel</c-></code></a>; }; </pre> <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content">Issues Index</span><a class="self-link" href="#issues-index"></a></h2> <div style="counter-reset:issue"> <div class="issue"> This specification needs to define how the value is determined from the keyframes, like the section on <a href="https://drafts.csswg.org/css-transitions/#application">Application of transitions</a> does for CSS Transitions. <a class="issue-return" href="#issue-73aacf21" title="Jump to section">↵</a></div> <div class="issue">Need to <a href="https://lists.w3.org/Archives/Public/www-style/2015Jul/0391.html">specify how keyframes interact</a>. <a class="issue-return" href="#issue-c01277bc" title="Jump to section">↵</a></div> </div> <script>/* Boilerplate: script-dom-helper */ "use strict"; function query(sel) { return document.querySelector(sel); } function queryAll(sel) { return [...document.querySelectorAll(sel)]; } function iter(obj) { if(!obj) return []; var it = obj[Symbol.iterator]; if(it) return it; return Object.entries(obj); } function mk(tagname, attrs, ...children) { const el = document.createElement(tagname); for(const [k,v] of iter(attrs)) { if(k.slice(0,3) == "_on") { const eventName = k.slice(3); el.addEventListener(eventName, v); } else if(k[0] == "_") { // property, not attribute el[k.slice(1)] = v; } else { if(v === false || v == null) { continue; } else if(v === true) { el.setAttribute(k, ""); continue; } else { el.setAttribute(k, v); } } } append(el, children); return el; } /* Create shortcuts for every known HTML element */ [ "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "meta", "meter", "nav", "nobr", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "pre", "progress", "q", "s", "samp", "script", "section", "select", "small", "source", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "u", "ul", "var", "video", "wbr", "xmp", ].forEach(tagname=>{ mk[tagname] = (...args) => mk(tagname, ...args); }); function* nodesFromChildList(children) { for(const child of children.flat(Infinity)) { if(child instanceof Node) { yield child; } else { yield new Text(child); } } } function append(el, ...children) { for(const child of nodesFromChildList(children)) { if(el instanceof Node) el.appendChild(child); else el.push(child); } return el; } function insertAfter(el, ...children) { for(const child of nodesFromChildList(children)) { el.parentNode.insertBefore(child, el.nextSibling); } return el; } function clearContents(el) { el.innerHTML = ""; return el; } function parseHTML(markup) { if(markup.toLowerCase().trim().indexOf('<!doctype') === 0) { const doc = document.implementation.createHTMLDocument(""); doc.documentElement.innerHTML = markup; return doc; } else { const el = mk.template({}); el.innerHTML = markup; return el.content; } }</script> <script>/* Boilerplate: script-dfn-panel */ "use strict"; { let dfnPanelData = { "003fd744": {"dfnID":"003fd744","dfnText":"ease-out","external":true,"refSections":[{"refs":[{"id":"ref-for-valdef-cubic-bezier-easing-function-ease-out"}],"title":"4.5. \nThe animation-direction property"}],"url":"https://www.w3.org/TR/css-easing-2/#valdef-cubic-bezier-easing-function-ease-out"}, "035a0bad": {"dfnID":"035a0bad","dfnText":"output progress value","external":true,"refSections":[{"refs":[{"id":"ref-for-output-progress-value"}],"title":"4.3. \nThe animation-timing-function property"}],"url":"https://www.w3.org/TR/css-easing-2/#output-progress-value"}, "0b00b5c1": {"dfnID":"0b00b5c1","dfnText":"step easing function","external":true,"refSections":[{"refs":[{"id":"ref-for-step-easing-function"}],"title":"4.3. \nThe animation-timing-function property"}],"url":"https://www.w3.org/TR/css-easing-2/#step-easing-function"}, "0f78dbdd": {"dfnID":"0f78dbdd","dfnText":"CSSRule","external":true,"refSections":[{"refs":[{"id":"ref-for-cssrule"}],"title":"6.1. \nThe CSSRule Interface"},{"refs":[{"id":"ref-for-cssrule\u2460"}],"title":"6.1.1. \nIDL Definition"},{"refs":[{"id":"ref-for-cssrule\u2461"}],"title":"6.2.1. \nIDL Definition"},{"refs":[{"id":"ref-for-cssrule\u2462"}],"title":"6.3.1. \nIDL Definition"}],"url":"https://www.w3.org/TR/cssom-1/#cssrule"}, "128295ac": {"dfnID":"128295ac","dfnText":"<percentage>","external":true,"refSections":[{"refs":[{"id":"ref-for-percentage-value"}],"title":"3. \nDeclaring Keyframes"}],"url":"https://www.w3.org/TR/css-values-4/#percentage-value"}, "129bdae8": {"dfnID":"129bdae8","dfnText":"Event","external":true,"refSections":[{"refs":[{"id":"ref-for-event"}],"title":"5.1.1. \nIDL Definition"}],"url":"https://dom.spec.whatwg.org/#event"}, "1a017cd1": {"dfnID":"1a017cd1","dfnText":"none","external":true,"refSections":[{"refs":[{"id":"ref-for-valdef-display-none"},{"id":"ref-for-valdef-display-none\u2460"},{"id":"ref-for-valdef-display-none\u2461"},{"id":"ref-for-valdef-display-none\u2462"}],"title":"2. \nCSS Animations Model"}],"url":"https://www.w3.org/TR/css-display-3/#valdef-display-none"}, "1d798932": {"dfnID":"1d798932","dfnText":"<string>","external":true,"refSections":[{"refs":[{"id":"ref-for-string-value"},{"id":"ref-for-string-value\u2460"},{"id":"ref-for-string-value\u2461"},{"id":"ref-for-string-value\u2462"}],"title":"3. \nDeclaring Keyframes"}],"url":"https://www.w3.org/TR/css-values-4/#string-value"}, "1dd77088": {"dfnID":"1dd77088","dfnText":"input progress value","external":true,"refSections":[{"refs":[{"id":"ref-for-input-progress-value"}],"title":"4.3. \nThe animation-timing-function property"}],"url":"https://www.w3.org/TR/css-easing-2/#input-progress-value"}, "21ecf38f": {"dfnID":"21ecf38f","dfnText":"PutForwards","external":true,"refSections":[{"refs":[{"id":"ref-for-PutForwards"}],"title":"6.2.1. \nIDL Definition"}],"url":"https://webidl.spec.whatwg.org/#PutForwards"}, "26896c20": {"dfnID":"26896c20","dfnText":"CSSRuleList","external":true,"refSections":[{"refs":[{"id":"ref-for-cssrulelist"}],"title":"6.3.1. \nIDL Definition"},{"refs":[{"id":"ref-for-cssrulelist\u2460"}],"title":"6.3.2. \nAttributes"}],"url":"https://www.w3.org/TR/cssom-1/#cssrulelist"}, "2ccfe434": {"dfnID":"2ccfe434","dfnText":"display","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-display"},{"id":"ref-for-propdef-display\u2460"},{"id":"ref-for-propdef-display\u2461"},{"id":"ref-for-propdef-display\u2462"}],"title":"2. \nCSS Animations Model"}],"url":"https://www.w3.org/TR/css-display-3/#propdef-display"}, "36261173": {"dfnID":"36261173","dfnText":"longhand","external":true,"refSections":[{"refs":[{"id":"ref-for-longhand"}],"title":"4. \nDeclaring Animations"}],"url":"https://www.w3.org/TR/css-cascade-5/#longhand"}, "38cf5d56": {"dfnID":"38cf5d56","dfnText":"to","external":true,"refSections":[{"refs":[{"id":"ref-for-valdef-shape-to"},{"id":"ref-for-valdef-shape-to\u2460"},{"id":"ref-for-valdef-shape-to\u2461"}],"title":"3. \nDeclaring Keyframes"},{"refs":[{"id":"ref-for-valdef-shape-to\u2462"}],"title":"3.1. \nTiming functions for keyframes"},{"refs":[{"id":"ref-for-valdef-shape-to\u2463"}],"title":"4.8. \nThe animation-fill-mode property"},{"refs":[{"id":"ref-for-valdef-shape-to\u2464"}],"title":"6.2.2. \nAttributes"},{"refs":[{"id":"ref-for-valdef-shape-to\u2465"}],"title":"6.3.5. \nThe deleteRule method"},{"refs":[{"id":"ref-for-valdef-shape-to\u2466"},{"id":"ref-for-valdef-shape-to\u2467"}],"title":"6.3.6. \nThe findRule method"}],"url":"https://drafts.csswg.org/css-shapes-2/#valdef-shape-to"}, "3d312fb4": {"dfnID":"3d312fb4","dfnText":"<qualified-rule-list>","external":true,"refSections":[{"refs":[{"id":"ref-for-typedef-qualified-rule-list"}],"title":"3. \nDeclaring Keyframes"}],"url":"https://drafts.csswg.org/css-syntax-3/#typedef-qualified-rule-list"}, "44a7708c": {"dfnID":"44a7708c","dfnText":"EventInit","external":true,"refSections":[{"refs":[{"id":"ref-for-dictdef-eventinit"}],"title":"5.1.1. \nIDL Definition"}],"url":"https://dom.spec.whatwg.org/#dictdef-eventinit"}, "450958f7": {"dfnID":"450958f7","dfnText":"unsigned short","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-unsigned-short"},{"id":"ref-for-idl-unsigned-short\u2460"}],"title":"6.1.1. \nIDL Definition"}],"url":"https://webidl.spec.whatwg.org/#idl-unsigned-short"}, "451490eb": {"dfnID":"451490eb","dfnText":"owner node","external":true,"refSections":[{"refs":[{"id":"ref-for-cssstyledeclaration-owner-node"}],"title":"6.2.2. \nAttributes"}],"url":"https://www.w3.org/TR/cssom-1/#cssstyledeclaration-owner-node"}, "49a17925": {"dfnID":"49a17925","dfnText":"left","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-left"},{"id":"ref-for-propdef-left\u2460"},{"id":"ref-for-propdef-left\u2461"},{"id":"ref-for-propdef-left\u2462"}],"title":"3. \nDeclaring Keyframes"}],"url":"https://www.w3.org/TR/CSS21/visuren.html#propdef-left"}, "49a64d88": {"dfnID":"49a64d88","dfnText":"HTML elements","external":true,"refSections":[{"refs":[{"id":"ref-for-html-elements"}],"title":"5.3. Event\nhandlers on elements, Document objects, and Window\nobjects"}],"url":"https://html.spec.whatwg.org/multipage/infrastructure.html#html-elements"}, "4eb9d37e": {"dfnID":"4eb9d37e","dfnText":"|","external":true,"refSections":[{"refs":[{"id":"ref-for-comb-one"}],"title":"4.1. \nThe animation-name property"},{"refs":[{"id":"ref-for-comb-one\u2460"}],"title":"4.4. \nThe animation-iteration-count property"},{"refs":[{"id":"ref-for-comb-one\u2461"},{"id":"ref-for-comb-one\u2462"},{"id":"ref-for-comb-one\u2463"}],"title":"4.5. \nThe animation-direction property"},{"refs":[{"id":"ref-for-comb-one\u2464"}],"title":"4.6. \nThe animation-play-state property"},{"refs":[{"id":"ref-for-comb-one\u2465"},{"id":"ref-for-comb-one\u2466"},{"id":"ref-for-comb-one\u2467"}],"title":"4.8. \nThe animation-fill-mode property"},{"refs":[{"id":"ref-for-comb-one\u2468"}],"title":"4.9. \nThe animation shorthand property"}],"url":"https://www.w3.org/TR/css-values-4/#comb-one"}, "4f60cc66": {"dfnID":"4f60cc66","dfnText":"start","external":true,"refSections":[{"refs":[{"id":"ref-for-valdef-steps-start"}],"title":"4.3. \nThe animation-timing-function property"}],"url":"https://www.w3.org/TR/css-easing-2/#valdef-steps-start"}, "56031446": {"dfnID":"56031446","dfnText":"parent CSS rule","external":true,"refSections":[{"refs":[{"id":"ref-for-cssstyledeclaration-parent-css-rule"}],"title":"6.2.2. \nAttributes"}],"url":"https://www.w3.org/TR/cssom-1/#cssstyledeclaration-parent-css-rule"}, "5c96d703": {"dfnID":"5c96d703","dfnText":"background-image","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-background-image"}],"title":"4. \nDeclaring Animations"}],"url":"https://www.w3.org/TR/CSS21/colors.html#propdef-background-image"}, "5d7209e9": {"dfnID":"5d7209e9","dfnText":"Window","external":true,"refSections":[{"refs":[{"id":"ref-for-window"}],"title":"5.3. Event\nhandlers on elements, Document objects, and Window\nobjects"}],"url":"https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"}, "5f90bbfb": {"dfnID":"5f90bbfb","dfnText":"undefined","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-undefined"},{"id":"ref-for-idl-undefined\u2460"}],"title":"6.3.1. \nIDL Definition"},{"refs":[{"id":"ref-for-idl-undefined\u2461"}],"title":"6.3.3. \nThe indexed property getter"}],"url":"https://webidl.spec.whatwg.org/#idl-undefined"}, "612b2c54": {"dfnID":"612b2c54","dfnText":"case-sensitive","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-case-sensitive"}],"title":"3. \nDeclaring Keyframes"}],"url":"https://www.w3.org/TR/i18n-glossary/#dfn-case-sensitive"}, "61bb5e44": {"dfnID":"61bb5e44","dfnText":"<number>","external":true,"refSections":[{"refs":[{"id":"ref-for-number-value"},{"id":"ref-for-number-value\u2460"}],"title":"4.4. \nThe animation-iteration-count property"}],"url":"https://www.w3.org/TR/css-values-4/#number-value"}, "6eabcb67": {"dfnID":"6eabcb67","dfnText":"readonly flag","external":true,"refSections":[{"refs":[{"id":"ref-for-cssstyledeclaration-readonly-flag"}],"title":"6.2.2. \nAttributes"}],"url":"https://drafts.csswg.org/cssom-1/#cssstyledeclaration-readonly-flag"}, "762ce945": {"dfnID":"762ce945","dfnText":"GlobalEventHandlers","external":true,"refSections":[{"refs":[{"id":"ref-for-globaleventhandlers"}],"title":"6.4. \nExtensions to the GlobalEventHandlers Interface Mixin"},{"refs":[{"id":"ref-for-globaleventhandlers\u2460"}],"title":"6.4.1. \nIDL Definition"}],"url":"https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers"}, "81ec7485": {"dfnID":"81ec7485","dfnText":"will-change","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-will-change"}],"title":"2. \nCSS Animations Model"}],"url":"https://www.w3.org/TR/css-will-change-1/#propdef-will-change"}, "842014fe": {"dfnID":"842014fe","dfnText":"CSS identifier","external":true,"refSections":[{"refs":[{"id":"ref-for-css-css-identifier"}],"title":"4.1. \nThe animation-name property"}],"url":"https://www.w3.org/TR/css-values-4/#css-css-identifier"}, "85394472": {"dfnID":"85394472","dfnText":"Document","external":true,"refSections":[{"refs":[{"id":"ref-for-document"}],"title":"5.3. Event\nhandlers on elements, Document objects, and Window\nobjects"}],"url":"https://dom.spec.whatwg.org/#document"}, "889e932f": {"dfnID":"889e932f","dfnText":"Exposed","external":true,"refSections":[{"refs":[{"id":"ref-for-Exposed"}],"title":"5.1.1. \nIDL Definition"},{"refs":[{"id":"ref-for-Exposed\u2460"}],"title":"6.2.1. \nIDL Definition"},{"refs":[{"id":"ref-for-Exposed\u2461"}],"title":"6.3.1. \nIDL Definition"}],"url":"https://webidl.spec.whatwg.org/#Exposed"}, "8a110a7b": {"dfnID":"8a110a7b","dfnText":"CSS-wide keywords","external":true,"refSections":[{"refs":[{"id":"ref-for-css-wide-keywords"}],"title":"1.1. \nValue Definitions"}],"url":"https://www.w3.org/TR/css-values-4/#css-wide-keywords"}, "8c800cdf": {"dfnID":"8c800cdf","dfnText":"double","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-double"},{"id":"ref-for-idl-double\u2460"}],"title":"5.1.1. \nIDL Definition"},{"refs":[{"id":"ref-for-idl-double\u2461"}],"title":"5.1.2. \nAttributes"}],"url":"https://webidl.spec.whatwg.org/#idl-double"}, "95b5db38": {"dfnID":"95b5db38","dfnText":"step position","external":true,"refSections":[{"refs":[{"id":"ref-for-step-position"}],"title":"4.3. \nThe animation-timing-function property"}],"url":"https://www.w3.org/TR/css-easing-2/#step-position"}, "9852f862": {"dfnID":"9852f862","dfnText":"declarations","external":true,"refSections":[{"refs":[{"id":"ref-for-cssstyledeclaration-declarations"}],"title":"6.2.2. \nAttributes"}],"url":"https://www.w3.org/TR/cssom-1/#cssstyledeclaration-declarations"}, "99316c56": {"dfnID":"99316c56","dfnText":"event constructor","external":true,"refSections":[{"refs":[{"id":"ref-for-constructing-events"}],"title":"5.1.2. \nAttributes"}],"url":"https://dom.spec.whatwg.org/#constructing-events"}, "9d357000": {"dfnID":"9d357000","dfnText":"CSSOMString","external":true,"refSections":[{"refs":[{"id":"ref-for-cssomstring"},{"id":"ref-for-cssomstring\u2460"},{"id":"ref-for-cssomstring\u2461"},{"id":"ref-for-cssomstring\u2462"},{"id":"ref-for-cssomstring\u2463"}],"title":"5.1.1. \nIDL Definition"},{"refs":[{"id":"ref-for-cssomstring\u2464"},{"id":"ref-for-cssomstring\u2465"}],"title":"5.1.2. \nAttributes"},{"refs":[{"id":"ref-for-cssomstring\u2466"}],"title":"6.2.1. \nIDL Definition"},{"refs":[{"id":"ref-for-cssomstring\u2467"}],"title":"6.2.2. \nAttributes"},{"refs":[{"id":"ref-for-cssomstring\u2468"},{"id":"ref-for-cssomstring\u2460\u24ea"},{"id":"ref-for-cssomstring\u2460\u2460"},{"id":"ref-for-cssomstring\u2460\u2461"}],"title":"6.3.1. \nIDL Definition"},{"refs":[{"id":"ref-for-cssomstring\u2460\u2462"}],"title":"6.3.2. \nAttributes"},{"refs":[{"id":"ref-for-cssomstring\u2460\u2463"}],"title":"6.3.4. \nThe appendRule method"},{"refs":[{"id":"ref-for-cssomstring\u2460\u2464"}],"title":"6.3.5. \nThe deleteRule method"},{"refs":[{"id":"ref-for-cssomstring\u2460\u2465"}],"title":"6.3.6. \nThe findRule method"}],"url":"https://www.w3.org/TR/cssom-1/#cssomstring"}, "9d386f55": {"dfnID":"9d386f55","dfnText":"event handler event type","external":true,"refSections":[{"refs":[{"id":"ref-for-event-handler-event-type"},{"id":"ref-for-event-handler-event-type\u2460"}],"title":"5.3. Event\nhandlers on elements, Document objects, and Window\nobjects"}],"url":"https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type"}, "a0144f62": {"dfnID":"a0144f62","dfnText":"<custom-ident>","external":true,"refSections":[{"refs":[{"id":"ref-for-identifier-value"},{"id":"ref-for-identifier-value\u2460"},{"id":"ref-for-identifier-value\u2461"},{"id":"ref-for-identifier-value\u2462"},{"id":"ref-for-identifier-value\u2463"}],"title":"3. \nDeclaring Keyframes"}],"url":"https://www.w3.org/TR/css-values-4/#identifier-value"}, "a0336d84": {"dfnID":"a0336d84","dfnText":"||","external":true,"refSections":[{"refs":[{"id":"ref-for-comb-any"},{"id":"ref-for-comb-any\u2460"},{"id":"ref-for-comb-any\u2461"},{"id":"ref-for-comb-any\u2462"},{"id":"ref-for-comb-any\u2463"},{"id":"ref-for-comb-any\u2464"},{"id":"ref-for-comb-any\u2465"}],"title":"4.9. \nThe animation shorthand property"}],"url":"https://www.w3.org/TR/css-values-4/#comb-any"}, "a5c91173": {"dfnID":"a5c91173","dfnText":"SameObject","external":true,"refSections":[{"refs":[{"id":"ref-for-SameObject"}],"title":"6.2.1. \nIDL Definition"}],"url":"https://webidl.spec.whatwg.org/#SameObject"}, "a81b1fb8": {"dfnID":"a81b1fb8","dfnText":"<declaration-list>","external":true,"refSections":[{"refs":[{"id":"ref-for-typedef-declaration-list"},{"id":"ref-for-typedef-declaration-list\u2460"}],"title":"3. \nDeclaring Keyframes"}],"url":"https://www.w3.org/TR/css-syntax-3/#typedef-declaration-list"}, "a8cb81d7": {"dfnID":"a8cb81d7","dfnText":"<rule-list>","external":true,"refSections":[{"refs":[{"id":"ref-for-typedef-rule-list"}],"title":"3. \nDeclaring Keyframes"}],"url":"https://www.w3.org/TR/css-syntax-3/#typedef-rule-list"}, "active-duration": {"dfnID":"active-duration","dfnText":"active duration","external":false,"refSections":[{"refs":[{"id":"ref-for-active-duration"},{"id":"ref-for-active-duration\u2460"},{"id":"ref-for-active-duration\u2461"}],"title":"5.2. \nTypes of AnimationEvent"}],"url":"#active-duration"}, "animationevent": {"dfnID":"animationevent","dfnText":"AnimationEvent","external":false,"refSections":[],"url":"#animationevent"}, "at-ruledef-keyframes": {"dfnID":"at-ruledef-keyframes","dfnText":"@keyframes","external":false,"refSections":[{"refs":[{"id":"ref-for-at-ruledef-keyframes"},{"id":"ref-for-at-ruledef-keyframes\u2460"},{"id":"ref-for-at-ruledef-keyframes\u2461"},{"id":"ref-for-at-ruledef-keyframes\u2462"},{"id":"ref-for-at-ruledef-keyframes\u2463"},{"id":"ref-for-at-ruledef-keyframes\u2464"},{"id":"ref-for-at-ruledef-keyframes\u2465"},{"id":"ref-for-at-ruledef-keyframes\u2466"}],"title":"3. \nDeclaring Keyframes"},{"refs":[{"id":"ref-for-at-ruledef-keyframes\u2467"}],"title":"4.1. \nThe animation-name property"},{"refs":[{"id":"ref-for-at-ruledef-keyframes\u2468"}],"title":"6.3.4. \nThe appendRule method"}],"url":"#at-ruledef-keyframes"}, "b22ae7ee": {"dfnID":"b22ae7ee","dfnText":"event handler content attributes","external":true,"refSections":[{"refs":[{"id":"ref-for-event-handler-content-attributes"}],"title":"5.3. Event\nhandlers on elements, Document objects, and Window\nobjects"}],"url":"https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-content-attributes"}, "b35178c1": {"dfnID":"b35178c1","dfnText":"coordinated value list","external":true,"refSections":[{"refs":[{"id":"ref-for-coordinated-value-list"}],"title":"4. \nDeclaring Animations"}],"url":"https://www.w3.org/TR/css-values-4/#coordinated-value-list"}, "bb5f9e40": {"dfnID":"bb5f9e40","dfnText":"<time>","external":true,"refSections":[{"refs":[{"id":"ref-for-time-value"},{"id":"ref-for-time-value\u2460"},{"id":"ref-for-time-value\u2461"},{"id":"ref-for-time-value\u2462"}],"title":"4.2. \nThe animation-duration property"},{"refs":[{"id":"ref-for-time-value\u2463"},{"id":"ref-for-time-value\u2464"},{"id":"ref-for-time-value\u2465"}],"title":"4.7. \nThe animation-delay property"},{"refs":[{"id":"ref-for-time-value\u2466"},{"id":"ref-for-time-value\u2467"},{"id":"ref-for-time-value\u2468"},{"id":"ref-for-time-value\u2460\u24ea"}],"title":"4.9. \nThe animation shorthand property"}],"url":"https://www.w3.org/TR/css-values-3/#time-value"}, "be2d2b4c": {"dfnID":"be2d2b4c","dfnText":"SyntaxError","external":true,"refSections":[{"refs":[{"id":"ref-for-syntaxerror"}],"title":"6.2.2. \nAttributes"}],"url":"https://webidl.spec.whatwg.org/#syntaxerror"}, "c297b070": {"dfnID":"c297b070","dfnText":"#","external":true,"refSections":[{"refs":[{"id":"ref-for-mult-comma"}],"title":"4.1. \nThe animation-name property"},{"refs":[{"id":"ref-for-mult-comma\u2460"}],"title":"4.2. \nThe animation-duration property"},{"refs":[{"id":"ref-for-mult-comma\u2461"}],"title":"4.3. \nThe animation-timing-function property"},{"refs":[{"id":"ref-for-mult-comma\u2462"}],"title":"4.4. \nThe animation-iteration-count property"},{"refs":[{"id":"ref-for-mult-comma\u2463"}],"title":"4.5. \nThe animation-direction property"},{"refs":[{"id":"ref-for-mult-comma\u2464"}],"title":"4.6. \nThe animation-play-state property"},{"refs":[{"id":"ref-for-mult-comma\u2465"}],"title":"4.7. \nThe animation-delay property"},{"refs":[{"id":"ref-for-mult-comma\u2466"}],"title":"4.8. \nThe animation-fill-mode property"},{"refs":[{"id":"ref-for-mult-comma\u2467"}],"title":"4.9. \nThe animation shorthand property"}],"url":"https://www.w3.org/TR/css-values-4/#mult-comma"}, "csskeyframerule": {"dfnID":"csskeyframerule","dfnText":"CSSKeyframeRule","external":false,"refSections":[{"refs":[{"id":"ref-for-csskeyframerule"}],"title":"6.2. \nThe CSSKeyframeRule Interface"},{"refs":[{"id":"ref-for-csskeyframerule\u2460"}],"title":"6.2.2. \nAttributes"},{"refs":[{"id":"ref-for-csskeyframerule\u2461"},{"id":"ref-for-csskeyframerule\u2462"}],"title":"6.3.1. \nIDL Definition"},{"refs":[{"id":"ref-for-csskeyframerule\u2463"},{"id":"ref-for-csskeyframerule\u2464"}],"title":"6.3.3. \nThe indexed property getter"},{"refs":[{"id":"ref-for-csskeyframerule\u2465"}],"title":"6.3.4. \nThe appendRule method"},{"refs":[{"id":"ref-for-csskeyframerule\u2466"}],"title":"6.3.5. \nThe deleteRule method"},{"refs":[{"id":"ref-for-csskeyframerule\u2467"},{"id":"ref-for-csskeyframerule\u2468"}],"title":"6.3.6. \nThe findRule method"}],"url":"#csskeyframerule"}, "csskeyframesrule": {"dfnID":"csskeyframesrule","dfnText":"CSSKeyframesRule","external":false,"refSections":[{"refs":[{"id":"ref-for-csskeyframesrule"}],"title":"6.3. \nThe CSSKeyframesRule Interface"}],"url":"#csskeyframesrule"}, "d4689c67": {"dfnID":"d4689c67","dfnText":"event handler IDL attributes","external":true,"refSections":[{"refs":[{"id":"ref-for-event-handler-idl-attributes"},{"id":"ref-for-event-handler-idl-attributes\u2460"}],"title":"5.3. Event\nhandlers on elements, Document objects, and Window\nobjects"},{"refs":[{"id":"ref-for-event-handler-idl-attributes\u2461"}],"title":"6.4. \nExtensions to the GlobalEventHandlers Interface Mixin"}],"url":"https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-idl-attributes"}, "d8b99652": {"dfnID":"d8b99652","dfnText":"coordinating list base property","external":true,"refSections":[{"refs":[{"id":"ref-for-coordinating-list-base-property"}],"title":"4. \nDeclaring Animations"}],"url":"https://www.w3.org/TR/css-values-4/#coordinating-list-base-property"}, "d9c21938": {"dfnID":"d9c21938","dfnText":"coordinating list property group","external":true,"refSections":[{"refs":[{"id":"ref-for-coordinating-list-property"}],"title":"4. \nDeclaring Animations"}],"url":"https://www.w3.org/TR/css-values-4/#coordinating-list-property"}, "dictdef-animationeventinit": {"dfnID":"dictdef-animationeventinit","dfnText":"AnimationEventInit","external":false,"refSections":[{"refs":[{"id":"ref-for-dictdef-animationeventinit"}],"title":"5.1.1. \nIDL Definition"}],"url":"#dictdef-animationeventinit"}, "dom-animationevent-animationevent": {"dfnID":"dom-animationevent-animationevent","dfnText":"AnimationEvent(type, animationEventInitDict)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-animationevent-animationevent"}],"title":"5.1.1. \nIDL Definition"}],"url":"#dom-animationevent-animationevent"}, "dom-animationevent-animationevent-type-animationeventinitdict-animationeventinitdict": {"dfnID":"dom-animationevent-animationevent-type-animationeventinitdict-animationeventinitdict","dfnText":"animationEventInitDict","external":false,"refSections":[],"url":"#dom-animationevent-animationevent-type-animationeventinitdict-animationeventinitdict"}, "dom-animationevent-animationevent-type-animationeventinitdict-type": {"dfnID":"dom-animationevent-animationevent-type-animationeventinitdict-type","dfnText":"type","external":false,"refSections":[],"url":"#dom-animationevent-animationevent-type-animationeventinitdict-type"}, "dom-animationevent-animationname": {"dfnID":"dom-animationevent-animationname","dfnText":"animationName","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-animationevent-animationname"}],"title":"5.1.1. \nIDL Definition"}],"url":"#dom-animationevent-animationname"}, "dom-animationevent-elapsedtime": {"dfnID":"dom-animationevent-elapsedtime","dfnText":"elapsedTime","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-animationevent-elapsedtime"}],"title":"5.1.1. \nIDL Definition"},{"refs":[{"id":"ref-for-dom-animationevent-elapsedtime\u2460"},{"id":"ref-for-dom-animationevent-elapsedtime\u2461"},{"id":"ref-for-dom-animationevent-elapsedtime\u2462"},{"id":"ref-for-dom-animationevent-elapsedtime\u2463"},{"id":"ref-for-dom-animationevent-elapsedtime\u2464"}],"title":"5.2. \nTypes of AnimationEvent"}],"url":"#dom-animationevent-elapsedtime"}, "dom-animationevent-pseudoelement": {"dfnID":"dom-animationevent-pseudoelement","dfnText":"pseudoElement","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-animationevent-pseudoelement"}],"title":"5.1.1. \nIDL Definition"}],"url":"#dom-animationevent-pseudoelement"}, "dom-animationeventinit-animationname": {"dfnID":"dom-animationeventinit-animationname","dfnText":"animationName","external":false,"refSections":[],"url":"#dom-animationeventinit-animationname"}, "dom-animationeventinit-elapsedtime": {"dfnID":"dom-animationeventinit-elapsedtime","dfnText":"elapsedTime","external":false,"refSections":[],"url":"#dom-animationeventinit-elapsedtime"}, "dom-animationeventinit-pseudoelement": {"dfnID":"dom-animationeventinit-pseudoelement","dfnText":"pseudoElement","external":false,"refSections":[],"url":"#dom-animationeventinit-pseudoelement"}, "dom-csskeyframerule-keytext": {"dfnID":"dom-csskeyframerule-keytext","dfnText":"keyText","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-csskeyframerule-keytext"}],"title":"6.2.1. \nIDL Definition"},{"refs":[{"id":"ref-for-dom-csskeyframerule-keytext\u2460"},{"id":"ref-for-dom-csskeyframerule-keytext\u2461"}],"title":"6.2.2. \nAttributes"}],"url":"#dom-csskeyframerule-keytext"}, "dom-csskeyframerule-style": {"dfnID":"dom-csskeyframerule-style","dfnText":"style","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-csskeyframerule-style"}],"title":"6.2.1. \nIDL Definition"}],"url":"#dom-csskeyframerule-style"}, "dom-csskeyframesrule-__getter__": {"dfnID":"dom-csskeyframesrule-__getter__","dfnText":"indexed property\n\tgetter","external":false,"refSections":[],"url":"#dom-csskeyframesrule-__getter__"}, "dom-csskeyframesrule-__getter__-index-index": {"dfnID":"dom-csskeyframesrule-__getter__-index-index","dfnText":"index","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-csskeyframesrule-__getter__-index-index"}],"title":"6.3.1. \nIDL Definition"}],"url":"#dom-csskeyframesrule-__getter__-index-index"}, "dom-csskeyframesrule-appendrule": {"dfnID":"dom-csskeyframesrule-appendrule","dfnText":"appendRule","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-csskeyframesrule-appendrule"}],"title":"6.3.1. \nIDL Definition"}],"url":"#dom-csskeyframesrule-appendrule"}, "dom-csskeyframesrule-appendrule-rule-rule": {"dfnID":"dom-csskeyframesrule-appendrule-rule-rule","dfnText":"rule","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-csskeyframesrule-appendrule-rule-rule"}],"title":"6.3.1. \nIDL Definition"}],"url":"#dom-csskeyframesrule-appendrule-rule-rule"}, "dom-csskeyframesrule-cssrules": {"dfnID":"dom-csskeyframesrule-cssrules","dfnText":"cssRules","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-csskeyframesrule-cssrules"}],"title":"6.3.1. \nIDL Definition"}],"url":"#dom-csskeyframesrule-cssrules"}, "dom-csskeyframesrule-deleterule": {"dfnID":"dom-csskeyframesrule-deleterule","dfnText":"deleteRule","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-csskeyframesrule-deleterule"}],"title":"6.3.1. \nIDL Definition"}],"url":"#dom-csskeyframesrule-deleterule"}, "dom-csskeyframesrule-deleterule-select-select": {"dfnID":"dom-csskeyframesrule-deleterule-select-select","dfnText":"select","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-csskeyframesrule-deleterule-select-select"}],"title":"6.3.1. \nIDL Definition"}],"url":"#dom-csskeyframesrule-deleterule-select-select"}, "dom-csskeyframesrule-findrule": {"dfnID":"dom-csskeyframesrule-findrule","dfnText":"findRule","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-csskeyframesrule-findrule"}],"title":"6.3.1. \nIDL Definition"}],"url":"#dom-csskeyframesrule-findrule"}, "dom-csskeyframesrule-findrule-select-select": {"dfnID":"dom-csskeyframesrule-findrule-select-select","dfnText":"select","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-csskeyframesrule-findrule-select-select"}],"title":"6.3.1. \nIDL Definition"}],"url":"#dom-csskeyframesrule-findrule-select-select"}, "dom-csskeyframesrule-length": {"dfnID":"dom-csskeyframesrule-length","dfnText":"length","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-csskeyframesrule-length"}],"title":"6.3.1. \nIDL Definition"}],"url":"#dom-csskeyframesrule-length"}, "dom-csskeyframesrule-name": {"dfnID":"dom-csskeyframesrule-name","dfnText":"name","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-csskeyframesrule-name"}],"title":"6.3.1. \nIDL Definition"}],"url":"#dom-csskeyframesrule-name"}, "dom-cssrule-keyframe_rule": {"dfnID":"dom-cssrule-keyframe_rule","dfnText":"KEYFRAME_RULE","external":false,"refSections":[],"url":"#dom-cssrule-keyframe_rule"}, "dom-cssrule-keyframes_rule": {"dfnID":"dom-cssrule-keyframes_rule","dfnText":"KEYFRAMES_RULE","external":false,"refSections":[],"url":"#dom-cssrule-keyframes_rule"}, "dom-document-onanimationcancel": {"dfnID":"dom-document-onanimationcancel","dfnText":"onanimationcancel","external":false,"refSections":[],"url":"#dom-document-onanimationcancel"}, "dom-document-onanimationend": {"dfnID":"dom-document-onanimationend","dfnText":"onanimationend","external":false,"refSections":[],"url":"#dom-document-onanimationend"}, "dom-document-onanimationiteration": {"dfnID":"dom-document-onanimationiteration","dfnText":"onanimationiteration","external":false,"refSections":[],"url":"#dom-document-onanimationiteration"}, "dom-document-onanimationstart": {"dfnID":"dom-document-onanimationstart","dfnText":"onanimationstart","external":false,"refSections":[],"url":"#dom-document-onanimationstart"}, "dom-globaleventhandlers-onanimationcancel": {"dfnID":"dom-globaleventhandlers-onanimationcancel","dfnText":"onanimationcancel","external":false,"refSections":[],"url":"#dom-globaleventhandlers-onanimationcancel"}, "dom-globaleventhandlers-onanimationend": {"dfnID":"dom-globaleventhandlers-onanimationend","dfnText":"onanimationend","external":false,"refSections":[],"url":"#dom-globaleventhandlers-onanimationend"}, "dom-globaleventhandlers-onanimationiteration": {"dfnID":"dom-globaleventhandlers-onanimationiteration","dfnText":"onanimationiteration","external":false,"refSections":[],"url":"#dom-globaleventhandlers-onanimationiteration"}, "dom-globaleventhandlers-onanimationstart": {"dfnID":"dom-globaleventhandlers-onanimationstart","dfnText":"onanimationstart","external":false,"refSections":[],"url":"#dom-globaleventhandlers-onanimationstart"}, "e14541aa": {"dfnID":"e14541aa","dfnText":"shorthand","external":true,"refSections":[{"refs":[{"id":"ref-for-shorthand-property"}],"title":"4. \nDeclaring Animations"}],"url":"https://www.w3.org/TR/css-cascade-5/#shorthand-property"}, "e9189aba": {"dfnID":"e9189aba","dfnText":"event handlers","external":true,"refSections":[{"refs":[{"id":"ref-for-event-handlers"},{"id":"ref-for-event-handlers\u2460"}],"title":"5.3. Event\nhandlers on elements, Document objects, and Window\nobjects"}],"url":"https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers"}, "e97a9688": {"dfnID":"e97a9688","dfnText":"unsigned long","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-unsigned-long"},{"id":"ref-for-idl-unsigned-long\u2460"}],"title":"6.3.1. \nIDL Definition"},{"refs":[{"id":"ref-for-idl-unsigned-long\u2461"}],"title":"6.3.2. \nAttributes"},{"refs":[{"id":"ref-for-idl-unsigned-long\u2462"}],"title":"6.3.3. \nThe indexed property getter"}],"url":"https://webidl.spec.whatwg.org/#idl-unsigned-long"}, "ea6ea52c": {"dfnID":"ea6ea52c","dfnText":"ease-in","external":true,"refSections":[{"refs":[{"id":"ref-for-valdef-cubic-bezier-easing-function-ease-in"}],"title":"4.5. \nThe animation-direction property"}],"url":"https://www.w3.org/TR/css-easing-2/#valdef-cubic-bezier-easing-function-ease-in"}, "ec9c26d7": {"dfnID":"ec9c26d7","dfnText":"specified order","external":true,"refSections":[{"refs":[{"id":"ref-for-concept-declarations-specified-order"}],"title":"6.2.2. \nAttributes"}],"url":"https://www.w3.org/TR/cssom-1/#concept-declarations-specified-order"}, "eef9f659": {"dfnID":"eef9f659","dfnText":"<easing-function>","external":true,"refSections":[{"refs":[{"id":"ref-for-typedef-easing-function"},{"id":"ref-for-typedef-easing-function\u2460"}],"title":"4.3. \nThe animation-timing-function property"},{"refs":[{"id":"ref-for-typedef-easing-function\u2461"}],"title":"4.9. \nThe animation shorthand property"}],"url":"https://www.w3.org/TR/css-easing-2/#typedef-easing-function"}, "eventdef-globaleventhandlers-animationcancel": {"dfnID":"eventdef-globaleventhandlers-animationcancel","dfnText":"animationcancel","external":false,"refSections":[{"refs":[{"id":"ref-for-eventdef-globaleventhandlers-animationcancel"}],"title":"5.2. \nTypes of AnimationEvent"},{"refs":[{"id":"ref-for-eventdef-globaleventhandlers-animationcancel\u2460"}],"title":"5.3. Event\nhandlers on elements, Document objects, and Window\nobjects"}],"url":"#eventdef-globaleventhandlers-animationcancel"}, "eventdef-globaleventhandlers-animationend": {"dfnID":"eventdef-globaleventhandlers-animationend","dfnText":"animationend","external":false,"refSections":[{"refs":[{"id":"ref-for-eventdef-globaleventhandlers-animationend"}],"title":"2. \nCSS Animations Model"},{"refs":[{"id":"ref-for-eventdef-globaleventhandlers-animationend\u2460"},{"id":"ref-for-eventdef-globaleventhandlers-animationend\u2461"}],"title":"5.2. \nTypes of AnimationEvent"},{"refs":[{"id":"ref-for-eventdef-globaleventhandlers-animationend\u2462"}],"title":"5.3. Event\nhandlers on elements, Document objects, and Window\nobjects"}],"url":"#eventdef-globaleventhandlers-animationend"}, "eventdef-globaleventhandlers-animationiteration": {"dfnID":"eventdef-globaleventhandlers-animationiteration","dfnText":"animationiteration","external":false,"refSections":[{"refs":[{"id":"ref-for-eventdef-globaleventhandlers-animationiteration"}],"title":"5.2. \nTypes of AnimationEvent"},{"refs":[{"id":"ref-for-eventdef-globaleventhandlers-animationiteration\u2460"}],"title":"5.3. Event\nhandlers on elements, Document objects, and Window\nobjects"}],"url":"#eventdef-globaleventhandlers-animationiteration"}, "eventdef-globaleventhandlers-animationstart": {"dfnID":"eventdef-globaleventhandlers-animationstart","dfnText":"animationstart","external":false,"refSections":[{"refs":[{"id":"ref-for-eventdef-globaleventhandlers-animationstart"}],"title":"2. \nCSS Animations Model"},{"refs":[{"id":"ref-for-eventdef-globaleventhandlers-animationstart\u2460"}],"title":"5.2. \nTypes of AnimationEvent"},{"refs":[{"id":"ref-for-eventdef-globaleventhandlers-animationstart\u2461"}],"title":"5.3. Event\nhandlers on elements, Document objects, and Window\nobjects"}],"url":"#eventdef-globaleventhandlers-animationstart"}, "f0951476": {"dfnID":"f0951476","dfnText":"EventHandler","external":true,"refSections":[{"refs":[{"id":"ref-for-eventhandler"},{"id":"ref-for-eventhandler\u2460"},{"id":"ref-for-eventhandler\u2461"},{"id":"ref-for-eventhandler\u2462"}],"title":"6.4.1. \nIDL Definition"}],"url":"https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"}, "f9bcb636": {"dfnID":"f9bcb636","dfnText":"CSSStyleProperties","external":true,"refSections":[{"refs":[{"id":"ref-for-cssstyleproperties"}],"title":"6.2.1. \nIDL Definition"},{"refs":[{"id":"ref-for-cssstyleproperties\u2460"},{"id":"ref-for-cssstyleproperties\u2461"}],"title":"6.2.2. \nAttributes"}],"url":"https://drafts.csswg.org/cssom-1/#cssstyleproperties"}, "propdef-animation": {"dfnID":"propdef-animation","dfnText":"animation","external":false,"refSections":[{"refs":[{"id":"ref-for-propdef-animation"}],"title":"4. \nDeclaring Animations"},{"refs":[{"id":"ref-for-propdef-animation\u2460"},{"id":"ref-for-propdef-animation\u2461"},{"id":"ref-for-propdef-animation\u2462"},{"id":"ref-for-propdef-animation\u2463"},{"id":"ref-for-propdef-animation\u2464"}],"title":"4.9. \nThe animation shorthand property"}],"url":"#propdef-animation"}, "propdef-animation-delay": {"dfnID":"propdef-animation-delay","dfnText":"animation-delay","external":false,"refSections":[{"refs":[{"id":"ref-for-propdef-animation-delay"},{"id":"ref-for-propdef-animation-delay\u2460"}],"title":"2. \nCSS Animations Model"},{"refs":[{"id":"ref-for-propdef-animation-delay\u2461"},{"id":"ref-for-propdef-animation-delay\u2462"}],"title":"4.2. \nThe animation-duration property"},{"refs":[{"id":"ref-for-propdef-animation-delay\u2463"}],"title":"4.3. \nThe animation-timing-function property"},{"refs":[{"id":"ref-for-propdef-animation-delay\u2464"},{"id":"ref-for-propdef-animation-delay\u2465"}],"title":"4.7. \nThe animation-delay property"},{"refs":[{"id":"ref-for-propdef-animation-delay\u2466"},{"id":"ref-for-propdef-animation-delay\u2467"}],"title":"4.8. \nThe animation-fill-mode property"},{"refs":[{"id":"ref-for-propdef-animation-delay\u2468"}],"title":"4.9. \nThe animation shorthand property"},{"refs":[{"id":"ref-for-propdef-animation-delay\u2460\u24ea"},{"id":"ref-for-propdef-animation-delay\u2460\u2460"},{"id":"ref-for-propdef-animation-delay\u2460\u2461"},{"id":"ref-for-propdef-animation-delay\u2460\u2462"},{"id":"ref-for-propdef-animation-delay\u2460\u2463"},{"id":"ref-for-propdef-animation-delay\u2460\u2464"}],"title":"5.2. \nTypes of AnimationEvent"}],"url":"#propdef-animation-delay"}, "propdef-animation-direction": {"dfnID":"propdef-animation-direction","dfnText":"animation-direction","external":false,"refSections":[{"refs":[{"id":"ref-for-propdef-animation-direction"},{"id":"ref-for-propdef-animation-direction\u2460"}],"title":"4.2. \nThe animation-duration property"},{"refs":[{"id":"ref-for-propdef-animation-direction\u2461"}],"title":"4.3. \nThe animation-timing-function property"},{"refs":[{"id":"ref-for-propdef-animation-direction\u2462"}],"title":"4.4. \nThe animation-iteration-count property"},{"refs":[{"id":"ref-for-propdef-animation-direction\u2463"},{"id":"ref-for-propdef-animation-direction\u2464"}],"title":"4.5. \nThe animation-direction property"},{"refs":[{"id":"ref-for-propdef-animation-direction\u2465"},{"id":"ref-for-propdef-animation-direction\u2466"}],"title":"4.8. \nThe animation-fill-mode property"}],"url":"#propdef-animation-direction"}, "propdef-animation-duration": {"dfnID":"propdef-animation-duration","dfnText":"animation-duration","external":false,"refSections":[{"refs":[{"id":"ref-for-propdef-animation-duration"},{"id":"ref-for-propdef-animation-duration\u2460"}],"title":"4.2. \nThe animation-duration property"},{"refs":[{"id":"ref-for-propdef-animation-duration\u2461"}],"title":"4.4. \nThe animation-iteration-count property"},{"refs":[{"id":"ref-for-propdef-animation-duration\u2462"}],"title":"4.8. \nThe animation-fill-mode property"},{"refs":[{"id":"ref-for-propdef-animation-duration\u2463"}],"title":"4.9. \nThe animation shorthand property"},{"refs":[{"id":"ref-for-propdef-animation-duration\u2464"}],"title":"5.2. \nTypes of AnimationEvent"}],"url":"#propdef-animation-duration"}, "propdef-animation-fill-mode": {"dfnID":"propdef-animation-fill-mode","dfnText":"animation-fill-mode","external":false,"refSections":[{"refs":[{"id":"ref-for-propdef-animation-fill-mode"},{"id":"ref-for-propdef-animation-fill-mode\u2460"}],"title":"2. \nCSS Animations Model"},{"refs":[{"id":"ref-for-propdef-animation-fill-mode\u2461"},{"id":"ref-for-propdef-animation-fill-mode\u2462"},{"id":"ref-for-propdef-animation-fill-mode\u2463"}],"title":"4.2. \nThe animation-duration property"},{"refs":[{"id":"ref-for-propdef-animation-fill-mode\u2464"},{"id":"ref-for-propdef-animation-fill-mode\u2465"},{"id":"ref-for-propdef-animation-fill-mode\u2466"},{"id":"ref-for-propdef-animation-fill-mode\u2467"}],"title":"4.8. \nThe animation-fill-mode property"},{"refs":[{"id":"ref-for-propdef-animation-fill-mode\u2468"},{"id":"ref-for-propdef-animation-fill-mode\u2460\u24ea"}],"title":"4.9. \nThe animation shorthand property"}],"url":"#propdef-animation-fill-mode"}, "propdef-animation-iteration-count": {"dfnID":"propdef-animation-iteration-count","dfnText":"animation-iteration-count","external":false,"refSections":[{"refs":[{"id":"ref-for-propdef-animation-iteration-count"},{"id":"ref-for-propdef-animation-iteration-count\u2460"},{"id":"ref-for-propdef-animation-iteration-count\u2461"}],"title":"4.4. \nThe animation-iteration-count property"},{"refs":[{"id":"ref-for-propdef-animation-iteration-count\u2462"},{"id":"ref-for-propdef-animation-iteration-count\u2463"},{"id":"ref-for-propdef-animation-iteration-count\u2464"},{"id":"ref-for-propdef-animation-iteration-count\u2465"}],"title":"4.8. \nThe animation-fill-mode property"}],"url":"#propdef-animation-iteration-count"}, "propdef-animation-name": {"dfnID":"propdef-animation-name","dfnText":"animation-name","external":false,"refSections":[{"refs":[{"id":"ref-for-propdef-animation-name"},{"id":"ref-for-propdef-animation-name\u2460"},{"id":"ref-for-propdef-animation-name\u2461"},{"id":"ref-for-propdef-animation-name\u2462"},{"id":"ref-for-propdef-animation-name\u2463"},{"id":"ref-for-propdef-animation-name\u2464"},{"id":"ref-for-propdef-animation-name\u2465"},{"id":"ref-for-propdef-animation-name\u2466"}],"title":"2. \nCSS Animations Model"},{"refs":[{"id":"ref-for-propdef-animation-name\u2467"},{"id":"ref-for-propdef-animation-name\u2468"}],"title":"4. \nDeclaring Animations"},{"refs":[{"id":"ref-for-propdef-animation-name\u2460\u24ea"},{"id":"ref-for-propdef-animation-name\u2460\u2460"},{"id":"ref-for-propdef-animation-name\u2460\u2461"}],"title":"4.1. \nThe animation-name property"},{"refs":[{"id":"ref-for-propdef-animation-name\u2460\u2462"}],"title":"4.8. \nThe animation-fill-mode property"},{"refs":[{"id":"ref-for-propdef-animation-name\u2460\u2463"},{"id":"ref-for-propdef-animation-name\u2460\u2464"},{"id":"ref-for-propdef-animation-name\u2460\u2465"},{"id":"ref-for-propdef-animation-name\u2460\u2466"},{"id":"ref-for-propdef-animation-name\u2460\u2467"},{"id":"ref-for-propdef-animation-name\u2460\u2468"}],"title":"4.9. \nThe animation shorthand property"},{"refs":[{"id":"ref-for-propdef-animation-name\u2461\u24ea"},{"id":"ref-for-propdef-animation-name\u2461\u2460"},{"id":"ref-for-propdef-animation-name\u2461\u2461"},{"id":"ref-for-propdef-animation-name\u2461\u2462"}],"title":"5. \nAnimation Events"},{"refs":[{"id":"ref-for-propdef-animation-name\u2461\u2463"}],"title":"5.1.2. \nAttributes"},{"refs":[{"id":"ref-for-propdef-animation-name\u2461\u2464"}],"title":"5.2. \nTypes of AnimationEvent"},{"refs":[{"id":"ref-for-propdef-animation-name\u2461\u2465"}],"title":"6.3.2. \nAttributes"}],"url":"#propdef-animation-name"}, "propdef-animation-play-state": {"dfnID":"propdef-animation-play-state","dfnText":"animation-play-state","external":false,"refSections":[{"refs":[{"id":"ref-for-propdef-animation-play-state"},{"id":"ref-for-propdef-animation-play-state\u2460"},{"id":"ref-for-propdef-animation-play-state\u2461"}],"title":"4.6. \nThe animation-play-state property"},{"refs":[{"id":"ref-for-propdef-animation-play-state\u2462"}],"title":"5.2. \nTypes of AnimationEvent"}],"url":"#propdef-animation-play-state"}, "propdef-animation-timing-function": {"dfnID":"propdef-animation-timing-function","dfnText":"animation-timing-function","external":false,"refSections":[{"refs":[{"id":"ref-for-propdef-animation-timing-function"},{"id":"ref-for-propdef-animation-timing-function\u2460"}],"title":"3. \nDeclaring Keyframes"},{"refs":[{"id":"ref-for-propdef-animation-timing-function\u2461"}],"title":"3.1. \nTiming functions for keyframes"},{"refs":[{"id":"ref-for-propdef-animation-timing-function\u2462"},{"id":"ref-for-propdef-animation-timing-function\u2463"},{"id":"ref-for-propdef-animation-timing-function\u2464"},{"id":"ref-for-propdef-animation-timing-function\u2465"}],"title":"4.3. \nThe animation-timing-function property"}],"url":"#propdef-animation-timing-function"}, "typedef-keyframe-block": {"dfnID":"typedef-keyframe-block","dfnText":"<keyframe-block>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-keyframe-block"},{"id":"ref-for-typedef-keyframe-block\u2460"},{"id":"ref-for-typedef-keyframe-block\u2461"},{"id":"ref-for-typedef-keyframe-block\u2462"},{"id":"ref-for-typedef-keyframe-block\u2463"}],"title":"3. \nDeclaring Keyframes"}],"url":"#typedef-keyframe-block"}, "typedef-keyframe-selector": {"dfnID":"typedef-keyframe-selector","dfnText":"<keyframe-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-keyframe-selector"},{"id":"ref-for-typedef-keyframe-selector\u2460"}],"title":"3. \nDeclaring Keyframes"}],"url":"#typedef-keyframe-selector"}, "typedef-keyframes-name": {"dfnID":"typedef-keyframes-name","dfnText":"<keyframes-name>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-keyframes-name"}],"title":"3. \nDeclaring Keyframes"},{"refs":[{"id":"ref-for-typedef-keyframes-name\u2460"},{"id":"ref-for-typedef-keyframes-name\u2461"},{"id":"ref-for-typedef-keyframes-name\u2462"}],"title":"4.1. \nThe animation-name property"},{"refs":[{"id":"ref-for-typedef-keyframes-name\u2463"},{"id":"ref-for-typedef-keyframes-name\u2464"}],"title":"4.9. \nThe animation shorthand property"}],"url":"#typedef-keyframes-name"}, "typedef-single-animation": {"dfnID":"typedef-single-animation","dfnText":"<single-animation>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-single-animation"},{"id":"ref-for-typedef-single-animation\u2460"},{"id":"ref-for-typedef-single-animation\u2461"}],"title":"4.9. \nThe animation shorthand property"}],"url":"#typedef-single-animation"}, "typedef-single-animation-direction": {"dfnID":"typedef-single-animation-direction","dfnText":"<single-animation-direction>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-single-animation-direction"}],"title":"4.5. \nThe animation-direction property"},{"refs":[{"id":"ref-for-typedef-single-animation-direction\u2460"}],"title":"4.9. \nThe animation shorthand property"}],"url":"#typedef-single-animation-direction"}, "typedef-single-animation-fill-mode": {"dfnID":"typedef-single-animation-fill-mode","dfnText":"<single-animation-fill-mode>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-single-animation-fill-mode"}],"title":"4.8. \nThe animation-fill-mode property"},{"refs":[{"id":"ref-for-typedef-single-animation-fill-mode\u2460"}],"title":"4.9. \nThe animation shorthand property"}],"url":"#typedef-single-animation-fill-mode"}, "typedef-single-animation-iteration-count": {"dfnID":"typedef-single-animation-iteration-count","dfnText":"<single-animation-iteration-count>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-single-animation-iteration-count"}],"title":"4.4. \nThe animation-iteration-count property"},{"refs":[{"id":"ref-for-typedef-single-animation-iteration-count\u2460"}],"title":"4.9. \nThe animation shorthand property"}],"url":"#typedef-single-animation-iteration-count"}, "typedef-single-animation-play-state": {"dfnID":"typedef-single-animation-play-state","dfnText":"<single-animation-play-state>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-single-animation-play-state"}],"title":"4.6. \nThe animation-play-state property"},{"refs":[{"id":"ref-for-typedef-single-animation-play-state\u2460"}],"title":"4.9. \nThe animation shorthand property"}],"url":"#typedef-single-animation-play-state"}, "valdef-animation-delay-time": {"dfnID":"valdef-animation-delay-time","dfnText":"<time>","external":false,"refSections":[],"url":"#valdef-animation-delay-time"}, "valdef-animation-direction-alternate": {"dfnID":"valdef-animation-direction-alternate","dfnText":"alternate","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-animation-direction-alternate"}],"title":"4.4. \nThe animation-iteration-count property"},{"refs":[{"id":"ref-for-valdef-animation-direction-alternate\u2460"}],"title":"4.8. \nThe animation-fill-mode property"}],"url":"#valdef-animation-direction-alternate"}, "valdef-animation-direction-alternate-reverse": {"dfnID":"valdef-animation-direction-alternate-reverse","dfnText":"alternate-reverse","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-animation-direction-alternate-reverse"}],"title":"4.8. \nThe animation-fill-mode property"}],"url":"#valdef-animation-direction-alternate-reverse"}, "valdef-animation-direction-normal": {"dfnID":"valdef-animation-direction-normal","dfnText":"normal","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-animation-direction-normal"}],"title":"4.8. \nThe animation-fill-mode property"}],"url":"#valdef-animation-direction-normal"}, "valdef-animation-direction-reverse": {"dfnID":"valdef-animation-direction-reverse","dfnText":"reverse","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-animation-direction-reverse"}],"title":"4.8. \nThe animation-fill-mode property"}],"url":"#valdef-animation-direction-reverse"}, "valdef-animation-duration-time-0s": {"dfnID":"valdef-animation-duration-time-0s","dfnText":"<time [0s,\u221e]>","external":false,"refSections":[],"url":"#valdef-animation-duration-time-0s"}, "valdef-animation-fill-mode-backwards": {"dfnID":"valdef-animation-fill-mode-backwards","dfnText":"backwards","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-animation-fill-mode-backwards"}],"title":"4.2. \nThe animation-duration property"},{"refs":[{"id":"ref-for-valdef-animation-fill-mode-backwards\u2460"},{"id":"ref-for-valdef-animation-fill-mode-backwards\u2461"}],"title":"4.8. \nThe animation-fill-mode property"},{"refs":[{"id":"ref-for-valdef-animation-fill-mode-backwards\u2462"}],"title":"4.9. \nThe animation shorthand property"}],"url":"#valdef-animation-fill-mode-backwards"}, "valdef-animation-fill-mode-both": {"dfnID":"valdef-animation-fill-mode-both","dfnText":"both","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-animation-fill-mode-both"}],"title":"2. \nCSS Animations Model"},{"refs":[{"id":"ref-for-valdef-animation-fill-mode-both\u2460"},{"id":"ref-for-valdef-animation-fill-mode-both\u2461"}],"title":"4.2. \nThe animation-duration property"}],"url":"#valdef-animation-fill-mode-both"}, "valdef-animation-fill-mode-forwards": {"dfnID":"valdef-animation-fill-mode-forwards","dfnText":"forwards","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-animation-fill-mode-forwards"}],"title":"2. \nCSS Animations Model"},{"refs":[{"id":"ref-for-valdef-animation-fill-mode-forwards\u2460"}],"title":"4.2. \nThe animation-duration property"},{"refs":[{"id":"ref-for-valdef-animation-fill-mode-forwards\u2461"}],"title":"4.8. \nThe animation-fill-mode property"}],"url":"#valdef-animation-fill-mode-forwards"}, "valdef-animation-fill-mode-none": {"dfnID":"valdef-animation-fill-mode-none","dfnText":"none","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-animation-fill-mode-none"}],"title":"4.2. \nThe animation-duration property"},{"refs":[{"id":"ref-for-valdef-animation-fill-mode-none\u2460"}],"title":"4.9. \nThe animation shorthand property"}],"url":"#valdef-animation-fill-mode-none"}, "valdef-animation-iteration-count-infinite": {"dfnID":"valdef-animation-iteration-count-infinite","dfnText":"infinite","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-animation-iteration-count-infinite"},{"id":"ref-for-valdef-animation-iteration-count-infinite\u2460"}],"title":"4.4. \nThe animation-iteration-count property"}],"url":"#valdef-animation-iteration-count-infinite"}, "valdef-animation-iteration-count-number-0": {"dfnID":"valdef-animation-iteration-count-number-0","dfnText":"<number [0,\u221e]>","external":false,"refSections":[],"url":"#valdef-animation-iteration-count-number-0"}, "valdef-animation-name-keyframes-name": {"dfnID":"valdef-animation-name-keyframes-name","dfnText":"<keyframes-name>","external":false,"refSections":[],"url":"#valdef-animation-name-keyframes-name"}, "valdef-animation-name-none": {"dfnID":"valdef-animation-name-none","dfnText":"none","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-animation-name-none"}],"title":"3. \nDeclaring Keyframes"},{"refs":[{"id":"ref-for-valdef-animation-name-none\u2460"}],"title":"4.1. \nThe animation-name property"},{"refs":[{"id":"ref-for-valdef-animation-name-none\u2461"}],"title":"4.9. \nThe animation shorthand property"}],"url":"#valdef-animation-name-none"}, "valdef-animation-play-state-paused": {"dfnID":"valdef-animation-play-state-paused","dfnText":"paused","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-animation-play-state-paused"},{"id":"ref-for-valdef-animation-play-state-paused\u2460"}],"title":"4.6. \nThe animation-play-state property"},{"refs":[{"id":"ref-for-valdef-animation-play-state-paused\u2461"}],"title":"5. \nAnimation Events"},{"refs":[{"id":"ref-for-valdef-animation-play-state-paused\u2462"}],"title":"5.2. \nTypes of AnimationEvent"}],"url":"#valdef-animation-play-state-paused"}, "valdef-animation-play-state-running": {"dfnID":"valdef-animation-play-state-running","dfnText":"running","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-animation-play-state-running"},{"id":"ref-for-valdef-animation-play-state-running\u2460"},{"id":"ref-for-valdef-animation-play-state-running\u2461"}],"title":"4.6. \nThe animation-play-state property"},{"refs":[{"id":"ref-for-valdef-animation-play-state-running\u2462"}],"title":"5.2. \nTypes of AnimationEvent"}],"url":"#valdef-animation-play-state-running"}, }; document.addEventListener("DOMContentLoaded", ()=>{ genAllDfnPanels(); document.body.addEventListener("click", (e) => { // If not handled already, just hide all dfn panels. hideAllDfnPanels(); }); }); window.addEventListener("resize", () => { // Pin any visible dfn panel queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(el=>positionDfnPanel(el)); }); function genAllDfnPanels() { for(const panelData of Object.values(dfnPanelData)) { const dfnID = panelData.dfnID; const dfn = document.getElementById(dfnID); if(!dfn) { console.log(`Can't find dfn#${dfnID}.`, panelData); continue; } dfn.panelData = panelData; insertDfnPopupAction(dfn); } } function genDfnPanel(dfn, { dfnID, url, dfnText, refSections, external }) { const dfnPanel = mk.aside({ class: "dfn-panel on", id: `infopanel-for-${dfnID}`, "data-for": dfnID, "aria-labelled-by":`infopaneltitle-for-${dfnID}`, }, mk.span({id:`infopaneltitle-for-${dfnID}`, style:"display:none"}, `Info about the '${dfnText}' ${external?"external":""} reference.`), mk.a({href:url, class:"dfn-link"}, url), refSections.length == 0 ? [] : mk.b({}, "Referenced in:"), mk.ul({}, ...refSections.map(section=> mk.li({}, ...section.refs.map((ref, refI)=> [ mk.a({ href: `#${ref.id}` }, (refI == 0) ? section.title : `(${refI + 1})` ), " ", ] ), ), ), ), genLinkingSyntaxes(dfn), ); dfnPanel.addEventListener('click', (event) => { if (event.target.nodeName == 'A') { scrollToTargetAndHighlight(event); pinDfnPanel(dfnPanel); } event.stopPropagation(); refocusOnTarget(event); }); dfnPanel.addEventListener('keydown', (event) => { if(event.keyCode == 27) { // Escape key hideDfnPanel({dfnPanel}); event.stopPropagation(); event.preventDefault(); } }); dfnPanel.dfn = dfn; dfn.dfnPanel = dfnPanel; return dfnPanel; } function hideAllDfnPanels() { // Delete the currently-active dfn panel. queryAll(".dfn-panel").forEach(dfnPanel=>hideDfnPanel({dfnPanel})); } function showDfnPanel(dfn) { hideAllDfnPanels(); // Only display one at a time. dfn.setAttribute("aria-expanded", "true"); const dfnPanel = genDfnPanel(dfn, dfn.panelData); // Give the dfn a unique tabindex, and then // give all the tabbable panel bits successive indexes. let tabIndex = 100; dfn.tabIndex = tabIndex++; const tabbable = dfnPanel.querySelectorAll(":is(a, button)"); for (const el of tabbable) { el.tabIndex = tabIndex++; } append(document.body, dfnPanel); positionDfnPanel(dfnPanel); } function positionDfnPanel(dfnPanel) { const dfn = dfnPanel.dfn; const dfnPos = getBounds(dfn); dfnPanel.style.top = dfnPos.bottom + "px"; dfnPanel.style.left = dfnPos.left + "px"; const panelPos = dfnPanel.getBoundingClientRect(); const panelMargin = 8; const maxRight = document.body.parentNode.clientWidth - panelMargin; if (panelPos.right > maxRight) { const overflowAmount = panelPos.right - maxRight; const newLeft = Math.max(panelMargin, dfnPos.left - overflowAmount); dfnPanel.style.left = newLeft + "px"; } } function pinDfnPanel(dfnPanel) { // Switch it to "activated" state, which pins it. dfnPanel.classList.add("activated"); dfnPanel.style.position = "fixed"; dfnPanel.style.left = null; dfnPanel.style.top = null; } function hideDfnPanel({dfn, dfnPanel}) { if(!dfnPanel) dfnPanel = dfn.dfnPanel; if(!dfn) dfn = dfnPanel.dfn; dfn.dfnPanel = undefined; dfnPanel.dfn = undefined; dfn.setAttribute("aria-expanded", "false"); dfn.tabIndex = undefined; dfnPanel.remove() } function toggleDfnPanel(dfn) { if(dfn.dfnPanel) { hideDfnPanel(dfn); } else { showDfnPanel(dfn); } } function insertDfnPopupAction(dfn) { dfn.setAttribute('role', 'button'); dfn.setAttribute('aria-expanded', 'false') dfn.tabIndex = 0; dfn.classList.add('has-dfn-panel'); dfn.addEventListener('click', (event) => { toggleDfnPanel(dfn); event.stopPropagation(); }); dfn.addEventListener('keypress', (event) => { const kc = event.keyCode; // 32->Space, 13->Enter if(kc == 32 || kc == 13) { toggleDfnPanel(dfn); event.stopPropagation(); event.preventDefault(); } }); } function refocusOnTarget(event) { const target = event.target; setTimeout(() => { // Refocus on the event.target element. // This is needed after browser scrolls to the destination. target.focus(); }); } // TODO: shared util // Returns the root-level absolute position {left and top} of element. function getBounds(el, relativeTo=document.body) { const relativeRect = relativeTo.getBoundingClientRect(); const elRect = el.getBoundingClientRect(); const top = elRect.top - relativeRect.top; const left = elRect.left - relativeRect.left; return { top, left, bottom: top + elRect.height, right: left + elRect.width, } } function scrollToTargetAndHighlight(event) { let hash = event.target.hash; if (hash) { hash = decodeURIComponent(hash.substring(1)); const dest = document.getElementById(hash); if (dest) { dest.classList.add('highlighted'); setTimeout(() => dest.classList.remove('highlighted'), 1000); } } } // Functions, divided by link type, that wrap an autolink's // contents with the appropriate outer syntax. // Alternately, a string naming another type they format // the same as. function needsFor(type) { switch(type) { case "descriptor": case "value": case "element-attr": case "attr-value": case "element-state": case "method": case "constructor": case "argument": case "attribute": case "const": case "dict-member": case "event": case "enum-value": case "stringifier": case "serializer": case "iterator": case "maplike": case "setlike": case "state": case "mode": case "context": case "facet": return true; default: return false; } } function refusesFor(type) { switch(type) { case "property": case "element": case "interface": case "namespace": case "callback": case "dictionary": case "enum": case "exception": case "typedef": case "http-header": case "permission": return true; default: return false; } } function linkFormatterFromType(type) { switch(type) { case 'scheme': case 'permission': case 'dfn': return (text) => `[=${text}=]`; case 'abstract-op': return (text) => `[\$${text}\$]`; case 'function': case 'at-rule': case 'selector': case 'value': return (text) => `''${text}''`; case 'http-header': return (text) => `[:${text}:]`; case 'interface': case 'constructor': case 'method': case 'argument': case 'attribute': case 'callback': case 'dictionary': case 'dict-member': case 'enum': case 'enum-value': case 'exception': case 'const': case 'typedef': case 'stringifier': case 'serializer': case 'iterator': case 'maplike': case 'setlike': case 'extended-attribute': case 'event': case 'idl': return (text) => `{{${text}}}`; case 'element-state': case 'element-attr': case 'attr-value': case 'element': return (element) => `<{${element}}>`; case 'grammar': return (text) => `${text} (within a <pre class=prod>)`; case 'type': return (text)=> `<<${text}>>`; case 'descriptor': case 'property': return (text) => `'${text}'`; default: return; }; }; function genLinkingSyntaxes(dfn) { if(dfn.tagName != "DFN") return; const type = dfn.getAttribute('data-dfn-type'); if(!type) { console.log(`<dfn> doesn't have a data-dfn-type:`, dfn); return []; } // Return a function that wraps link text based on the type const linkFormatter = linkFormatterFromType(type); if(!linkFormatter) { console.log(`<dfn> has an unknown data-dfn-type:`, dfn); return []; } let ltAlts; if(dfn.hasAttribute('data-lt')) { ltAlts = dfn.getAttribute('data-lt') .split("|") .map(x=>x.trim()); } else { ltAlts = [dfn.textContent.trim()]; } if(type == "type") { // lt of "<foo>", but "foo" is the interior; // <<foo/bar>> is how you write it with a for, // not <foo/<bar>> or whatever. for(var i = 0; i < ltAlts.length; i++) { const lt = ltAlts[i]; const match = /<(.*)>/.exec(lt); if(match) { ltAlts[i] = match[1]; } } } let forAlts; if(dfn.hasAttribute('data-dfn-for')) { forAlts = dfn.getAttribute('data-dfn-for') .split(",") .map(x=>x.trim()); } else { forAlts = ['']; } let linkingSyntaxes = []; if(!needsFor(type)) { for(const lt of ltAlts) { linkingSyntaxes.push(linkFormatter(lt)); } } if(!refusesFor(type)) { for(const f of forAlts) { linkingSyntaxes.push(linkFormatter(`${f}/${ltAlts[0]}`)) } } return [ mk.b({}, 'Possible linking syntaxes:'), mk.ul({}, ...linkingSyntaxes.map(link => { const copyLink = async () => await navigator.clipboard.writeText(link); return mk.li({}, mk.div({ class: 'link-item' }, mk.button({ class: 'copy-icon', title: 'Copy', type: 'button', _onclick: copyLink, tabindex: 0, }, mk.span({ class: 'icon' }) ), mk.span({}, link) ) ); }) ) ]; } } </script> <script>/* Boilerplate: script-link-titles */ "use strict"; { let linkTitleData = { "https://www.w3.org/TR/css-easing-2/#typedef-easing-function": "Expands to: linear", "https://www.w3.org/TR/css-values-3/#time-value": "Expands to: ms | s", }; function setTypeTitles() { for(let el of document.querySelectorAll("a[href]")) { if(el.href in linkTitleData && !el.hasAttribute("title")) { el.setAttribute("title", linkTitleData[el.href]); } } } document.addEventListener("DOMContentLoaded", setTypeTitles); } </script> <script>/* Boilerplate: script-ref-hints */ "use strict"; { let refsData = { "#active-duration": {"displayText":"active duration","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"active duration","type":"dfn","url":"#active-duration"}, "#at-ruledef-keyframes": {"displayText":"@keyframes","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"@keyframes","type":"at-rule","url":"#at-ruledef-keyframes"}, "#csskeyframerule": {"displayText":"CSSKeyframeRule","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"CSSKeyframeRule","type":"interface","url":"#csskeyframerule"}, "#csskeyframesrule": {"displayText":"CSSKeyframesRule","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"CSSKeyframesRule","type":"interface","url":"#csskeyframesrule"}, "#dictdef-animationeventinit": {"displayText":"AnimationEventInit","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"AnimationEventInit","type":"dictionary","url":"#dictdef-animationeventinit"}, "#dom-animationevent-animationevent": {"displayText":"AnimationEvent(type, animationEventInitDict)","export":true,"for_":["AnimationEvent"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"AnimationEvent(type, animationEventInitDict)","type":"constructor","url":"#dom-animationevent-animationevent"}, "#dom-animationevent-animationname": {"displayText":"animationName","export":true,"for_":["AnimationEvent"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"animationName","type":"attribute","url":"#dom-animationevent-animationname"}, "#dom-animationevent-elapsedtime": {"displayText":"elapsedTime","export":true,"for_":["AnimationEvent"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"elapsedTime","type":"attribute","url":"#dom-animationevent-elapsedtime"}, "#dom-animationevent-pseudoelement": {"displayText":"pseudoElement","export":true,"for_":["AnimationEvent"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"pseudoElement","type":"attribute","url":"#dom-animationevent-pseudoelement"}, "#dom-csskeyframerule-keytext": {"displayText":"keyText","export":true,"for_":["CSSKeyframeRule"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"keyText","type":"attribute","url":"#dom-csskeyframerule-keytext"}, "#dom-csskeyframerule-style": {"displayText":"style","export":true,"for_":["CSSKeyframeRule"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"style","type":"attribute","url":"#dom-csskeyframerule-style"}, "#dom-csskeyframesrule-__getter__-index-index": {"displayText":"index","export":true,"for_":["CSSKeyframesRule/__getter__(index)"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"index","type":"argument","url":"#dom-csskeyframesrule-__getter__-index-index"}, "#dom-csskeyframesrule-appendrule": {"displayText":"appendRule(rule)","export":true,"for_":["CSSKeyframesRule"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"appendRule(rule)","type":"method","url":"#dom-csskeyframesrule-appendrule"}, "#dom-csskeyframesrule-appendrule-rule-rule": {"displayText":"rule","export":true,"for_":["CSSKeyframesRule/appendRule(rule)"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"rule","type":"argument","url":"#dom-csskeyframesrule-appendrule-rule-rule"}, "#dom-csskeyframesrule-cssrules": {"displayText":"cssRules","export":true,"for_":["CSSKeyframesRule"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"cssRules","type":"attribute","url":"#dom-csskeyframesrule-cssrules"}, "#dom-csskeyframesrule-deleterule": {"displayText":"deleteRule(select)","export":true,"for_":["CSSKeyframesRule"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"deleteRule(select)","type":"method","url":"#dom-csskeyframesrule-deleterule"}, "#dom-csskeyframesrule-deleterule-select-select": {"displayText":"select","export":true,"for_":["CSSKeyframesRule/deleteRule(select)"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"select","type":"argument","url":"#dom-csskeyframesrule-deleterule-select-select"}, "#dom-csskeyframesrule-findrule": {"displayText":"findRule(select)","export":true,"for_":["CSSKeyframesRule"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"findRule(select)","type":"method","url":"#dom-csskeyframesrule-findrule"}, "#dom-csskeyframesrule-findrule-select-select": {"displayText":"select","export":true,"for_":["CSSKeyframesRule/findRule(select)"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"select","type":"argument","url":"#dom-csskeyframesrule-findrule-select-select"}, "#dom-csskeyframesrule-length": {"displayText":"length","export":true,"for_":["CSSKeyframesRule"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"length","type":"attribute","url":"#dom-csskeyframesrule-length"}, "#dom-csskeyframesrule-name": {"displayText":"name","export":true,"for_":["CSSKeyframesRule"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"name","type":"attribute","url":"#dom-csskeyframesrule-name"}, "#eventdef-globaleventhandlers-animationcancel": {"displayText":"animationcancel","export":true,"for_":["GlobalEventHandlers"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"animationcancel","type":"event","url":"#eventdef-globaleventhandlers-animationcancel"}, "#eventdef-globaleventhandlers-animationend": {"displayText":"animationend","export":true,"for_":["GlobalEventHandlers"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"animationend","type":"event","url":"#eventdef-globaleventhandlers-animationend"}, "#eventdef-globaleventhandlers-animationiteration": {"displayText":"animationiteration","export":true,"for_":["GlobalEventHandlers"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"animationiteration","type":"event","url":"#eventdef-globaleventhandlers-animationiteration"}, "#eventdef-globaleventhandlers-animationstart": {"displayText":"animationstart","export":true,"for_":["GlobalEventHandlers"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"animationstart","type":"event","url":"#eventdef-globaleventhandlers-animationstart"}, "#propdef-animation": {"displayText":"animation","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"animation","type":"property","url":"#propdef-animation"}, "#propdef-animation-delay": {"displayText":"animation-delay","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"animation-delay","type":"property","url":"#propdef-animation-delay"}, "#propdef-animation-direction": {"displayText":"animation-direction","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"animation-direction","type":"property","url":"#propdef-animation-direction"}, "#propdef-animation-duration": {"displayText":"animation-duration","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"animation-duration","type":"property","url":"#propdef-animation-duration"}, "#propdef-animation-fill-mode": {"displayText":"animation-fill-mode","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"animation-fill-mode","type":"property","url":"#propdef-animation-fill-mode"}, "#propdef-animation-iteration-count": {"displayText":"animation-iteration-count","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"animation-iteration-count","type":"property","url":"#propdef-animation-iteration-count"}, "#propdef-animation-name": {"displayText":"animation-name","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"animation-name","type":"property","url":"#propdef-animation-name"}, "#propdef-animation-play-state": {"displayText":"animation-play-state","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"animation-play-state","type":"property","url":"#propdef-animation-play-state"}, "#propdef-animation-timing-function": {"displayText":"animation-timing-function","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"animation-timing-function","type":"property","url":"#propdef-animation-timing-function"}, "#typedef-keyframe-block": {"displayText":"<keyframe-block>","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"<keyframe-block>","type":"type","url":"#typedef-keyframe-block"}, "#typedef-keyframe-selector": {"displayText":"<keyframe-selector>","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"<keyframe-selector>","type":"type","url":"#typedef-keyframe-selector"}, "#typedef-keyframes-name": {"displayText":"<keyframes-name>","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"<keyframes-name>","type":"type","url":"#typedef-keyframes-name"}, "#typedef-single-animation": {"displayText":"<single-animation>","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"<single-animation>","type":"type","url":"#typedef-single-animation"}, "#typedef-single-animation-direction": {"displayText":"<single-animation-direction>","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"<single-animation-direction>","type":"type","url":"#typedef-single-animation-direction"}, "#typedef-single-animation-fill-mode": {"displayText":"<single-animation-fill-mode>","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"<single-animation-fill-mode>","type":"type","url":"#typedef-single-animation-fill-mode"}, "#typedef-single-animation-iteration-count": {"displayText":"<single-animation-iteration-count>","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"<single-animation-iteration-count>","type":"type","url":"#typedef-single-animation-iteration-count"}, "#typedef-single-animation-play-state": {"displayText":"<single-animation-play-state>","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"<single-animation-play-state>","type":"type","url":"#typedef-single-animation-play-state"}, "#valdef-animation-direction-alternate": {"displayText":"alternate","export":true,"for_":["animation-direction"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"alternate","type":"value","url":"#valdef-animation-direction-alternate"}, "#valdef-animation-direction-alternate-reverse": {"displayText":"alternate-reverse","export":true,"for_":["animation-direction"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"alternate-reverse","type":"value","url":"#valdef-animation-direction-alternate-reverse"}, "#valdef-animation-direction-normal": {"displayText":"normal","export":true,"for_":["animation-direction"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"normal","type":"value","url":"#valdef-animation-direction-normal"}, "#valdef-animation-direction-reverse": {"displayText":"reverse","export":true,"for_":["animation-direction"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"reverse","type":"value","url":"#valdef-animation-direction-reverse"}, "#valdef-animation-fill-mode-backwards": {"displayText":"backwards","export":true,"for_":["animation-fill-mode"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"backwards","type":"value","url":"#valdef-animation-fill-mode-backwards"}, "#valdef-animation-fill-mode-both": {"displayText":"both","export":true,"for_":["animation-fill-mode"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"both","type":"value","url":"#valdef-animation-fill-mode-both"}, "#valdef-animation-fill-mode-forwards": {"displayText":"forwards","export":true,"for_":["animation-fill-mode"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"forwards","type":"value","url":"#valdef-animation-fill-mode-forwards"}, "#valdef-animation-fill-mode-none": {"displayText":"none","export":true,"for_":["animation-fill-mode"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"none","type":"value","url":"#valdef-animation-fill-mode-none"}, "#valdef-animation-iteration-count-infinite": {"displayText":"infinite","export":true,"for_":["animation-iteration-count"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"infinite","type":"value","url":"#valdef-animation-iteration-count-infinite"}, "#valdef-animation-name-none": {"displayText":"none","export":true,"for_":["animation-name"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"none","type":"value","url":"#valdef-animation-name-none"}, "#valdef-animation-play-state-paused": {"displayText":"paused","export":true,"for_":["animation-play-state"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"paused","type":"value","url":"#valdef-animation-play-state-paused"}, "#valdef-animation-play-state-running": {"displayText":"running","export":true,"for_":["animation-play-state"],"level":"1","normative":true,"shortname":"css-animations","spec":"css-animations-1","status":"local","text":"running","type":"value","url":"#valdef-animation-play-state-running"}, "https://dom.spec.whatwg.org/#constructing-events": {"displayText":"event constructor","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-animations","spec":"","status":"anchor-block","text":"event constructor","type":"dfn","url":"https://dom.spec.whatwg.org/#constructing-events"}, "https://dom.spec.whatwg.org/#dictdef-eventinit": {"displayText":"EventInit","export":true,"for_":[],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"EventInit","type":"dictionary","url":"https://dom.spec.whatwg.org/#dictdef-eventinit"}, "https://dom.spec.whatwg.org/#document": {"displayText":"Document","export":true,"for_":[],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"Document","type":"interface","url":"https://dom.spec.whatwg.org/#document"}, "https://dom.spec.whatwg.org/#event": {"displayText":"Event","export":true,"for_":[],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"Event","type":"interface","url":"https://dom.spec.whatwg.org/#event"}, "https://drafts.csswg.org/css-shapes-2/#valdef-shape-to": {"displayText":"to","export":true,"for_":["shape()","<by-to>"],"level":"2","normative":true,"shortname":"css-shapes","spec":"css-shapes-2","status":"current","text":"to","type":"value","url":"https://drafts.csswg.org/css-shapes-2/#valdef-shape-to"}, "https://drafts.csswg.org/css-syntax-3/#typedef-qualified-rule-list": {"displayText":"<qualified-rule-list>","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-syntax","spec":"css-syntax-3","status":"current","text":"<qualified-rule-list>","type":"type","url":"https://drafts.csswg.org/css-syntax-3/#typedef-qualified-rule-list"}, "https://drafts.csswg.org/cssom-1/#cssstyledeclaration-readonly-flag": {"displayText":"readonly flag","export":true,"for_":["CSSStyleDeclaration"],"level":"1","normative":true,"shortname":"cssom","spec":"cssom-1","status":"current","text":"readonly flag","type":"dfn","url":"https://drafts.csswg.org/cssom-1/#cssstyledeclaration-readonly-flag"}, "https://drafts.csswg.org/cssom-1/#cssstyleproperties": {"displayText":"CSSStyleProperties","export":true,"for_":[],"level":"1","normative":true,"shortname":"cssom","spec":"cssom-1","status":"current","text":"CSSStyleProperties","type":"interface","url":"https://drafts.csswg.org/cssom-1/#cssstyleproperties"}, "https://html.spec.whatwg.org/multipage/infrastructure.html#html-elements": {"displayText":"HTML elements","export":true,"for_":[],"level":"","normative":true,"shortname":"html","spec":"html","status":"anchor-block","text":"html elements","type":"dfn","url":"https://html.spec.whatwg.org/multipage/infrastructure.html#html-elements"}, "https://html.spec.whatwg.org/multipage/nav-history-apis.html#window": {"displayText":"Window","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"Window","type":"interface","url":"https://html.spec.whatwg.org/multipage/nav-history-apis.html#window"}, "https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-content-attributes": {"displayText":"event handler content attributes","export":true,"for_":[],"level":"","normative":true,"shortname":"html","spec":"html","status":"anchor-block","text":"event handler content attributes","type":"dfn","url":"https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-content-attributes"}, "https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type": {"displayText":"event handler event type","export":true,"for_":[],"level":"","normative":true,"shortname":"html","spec":"html","status":"anchor-block","text":"event handler event type","type":"dfn","url":"https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type"}, "https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-idl-attributes": {"displayText":"event handler IDL attributes","export":true,"for_":[],"level":"","normative":true,"shortname":"html","spec":"html","status":"anchor-block","text":"event handler idl attributes","type":"dfn","url":"https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-idl-attributes"}, "https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers": {"displayText":"event handlers","export":true,"for_":[],"level":"","normative":true,"shortname":"html","spec":"html","status":"anchor-block","text":"event handlers","type":"dfn","url":"https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers"}, "https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler": {"displayText":"EventHandler","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"EventHandler","type":"typedef","url":"https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"}, "https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers": {"displayText":"GlobalEventHandlers","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"GlobalEventHandlers","type":"interface","url":"https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers"}, "https://webidl.spec.whatwg.org/#Exposed": {"displayText":"Exposed","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"Exposed","type":"extended-attribute","url":"https://webidl.spec.whatwg.org/#Exposed"}, "https://webidl.spec.whatwg.org/#PutForwards": {"displayText":"PutForwards","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"PutForwards","type":"extended-attribute","url":"https://webidl.spec.whatwg.org/#PutForwards"}, "https://webidl.spec.whatwg.org/#SameObject": {"displayText":"SameObject","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"SameObject","type":"extended-attribute","url":"https://webidl.spec.whatwg.org/#SameObject"}, "https://webidl.spec.whatwg.org/#idl-double": {"displayText":"double","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"double","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-double"}, "https://webidl.spec.whatwg.org/#idl-undefined": {"displayText":"undefined","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"undefined","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-undefined"}, "https://webidl.spec.whatwg.org/#idl-unsigned-long": {"displayText":"unsigned long","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"unsigned long","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-unsigned-long"}, "https://webidl.spec.whatwg.org/#idl-unsigned-short": {"displayText":"unsigned short","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"unsigned short","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-unsigned-short"}, "https://webidl.spec.whatwg.org/#syntaxerror": {"displayText":"SyntaxError","export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"SyntaxError","type":"exception","url":"https://webidl.spec.whatwg.org/#syntaxerror"}, "https://www.w3.org/TR/CSS21/colors.html#propdef-background-image": {"displayText":"background-image","export":true,"for_":[],"level":"1","normative":true,"shortname":"css","spec":"css21","status":"snapshot","text":"background-image","type":"property","url":"https://www.w3.org/TR/CSS21/colors.html#propdef-background-image"}, "https://www.w3.org/TR/CSS21/visuren.html#propdef-left": {"displayText":"left","export":true,"for_":[],"level":"1","normative":true,"shortname":"css","spec":"css21","status":"snapshot","text":"left","type":"property","url":"https://www.w3.org/TR/CSS21/visuren.html#propdef-left"}, "https://www.w3.org/TR/css-cascade-5/#longhand": {"displayText":"longhand","export":true,"for_":[],"level":"5","normative":true,"shortname":"css-cascade","spec":"css-cascade-5","status":"snapshot","text":"longhand","type":"dfn","url":"https://www.w3.org/TR/css-cascade-5/#longhand"}, "https://www.w3.org/TR/css-cascade-5/#shorthand-property": {"displayText":"shorthand","export":true,"for_":[],"level":"5","normative":true,"shortname":"css-cascade","spec":"css-cascade-5","status":"snapshot","text":"shorthand","type":"dfn","url":"https://www.w3.org/TR/css-cascade-5/#shorthand-property"}, "https://www.w3.org/TR/css-display-3/#propdef-display": {"displayText":"display","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-display","spec":"css-display-3","status":"snapshot","text":"display","type":"property","url":"https://www.w3.org/TR/css-display-3/#propdef-display"}, "https://www.w3.org/TR/css-display-3/#valdef-display-none": {"displayText":"none","export":true,"for_":["display","<display-box>"],"level":"3","normative":true,"shortname":"css-display","spec":"css-display-3","status":"snapshot","text":"none","type":"value","url":"https://www.w3.org/TR/css-display-3/#valdef-display-none"}, "https://www.w3.org/TR/css-easing-2/#input-progress-value": {"displayText":"input progress value","export":false,"for_":[],"level":"2","normative":true,"shortname":"css-easing","spec":"css-easing-2","status":"snapshot","text":"input progress value","type":"dfn","url":"https://www.w3.org/TR/css-easing-2/#input-progress-value"}, "https://www.w3.org/TR/css-easing-2/#output-progress-value": {"displayText":"output progress value","export":false,"for_":[],"level":"2","normative":true,"shortname":"css-easing","spec":"css-easing-2","status":"snapshot","text":"output progress value","type":"dfn","url":"https://www.w3.org/TR/css-easing-2/#output-progress-value"}, "https://www.w3.org/TR/css-easing-2/#step-easing-function": {"displayText":"step easing function","export":false,"for_":[],"level":"2","normative":true,"shortname":"css-easing","spec":"css-easing-2","status":"snapshot","text":"step easing function","type":"dfn","url":"https://www.w3.org/TR/css-easing-2/#step-easing-function"}, "https://www.w3.org/TR/css-easing-2/#step-position": {"displayText":"step position","export":false,"for_":[],"level":"2","normative":true,"shortname":"css-easing","spec":"css-easing-2","status":"snapshot","text":"step position","type":"dfn","url":"https://www.w3.org/TR/css-easing-2/#step-position"}, "https://www.w3.org/TR/css-easing-2/#typedef-easing-function": {"displayText":"<easing-function>","export":true,"for_":[],"level":"2","normative":true,"shortname":"css-easing","spec":"css-easing-2","status":"snapshot","text":"<easing-function>","type":"type","url":"https://www.w3.org/TR/css-easing-2/#typedef-easing-function"}, "https://www.w3.org/TR/css-easing-2/#valdef-cubic-bezier-easing-function-ease-in": {"displayText":"ease-in","export":true,"for_":["<cubic-bezier-easing-function>"],"level":"2","normative":true,"shortname":"css-easing","spec":"css-easing-2","status":"snapshot","text":"ease-in","type":"value","url":"https://www.w3.org/TR/css-easing-2/#valdef-cubic-bezier-easing-function-ease-in"}, "https://www.w3.org/TR/css-easing-2/#valdef-cubic-bezier-easing-function-ease-out": {"displayText":"ease-out","export":true,"for_":["<cubic-bezier-easing-function>"],"level":"2","normative":true,"shortname":"css-easing","spec":"css-easing-2","status":"snapshot","text":"ease-out","type":"value","url":"https://www.w3.org/TR/css-easing-2/#valdef-cubic-bezier-easing-function-ease-out"}, "https://www.w3.org/TR/css-easing-2/#valdef-steps-start": {"displayText":"start","export":true,"for_":["steps()"],"level":"2","normative":true,"shortname":"css-easing","spec":"css-easing-2","status":"snapshot","text":"start","type":"value","url":"https://www.w3.org/TR/css-easing-2/#valdef-steps-start"}, "https://www.w3.org/TR/css-syntax-3/#typedef-declaration-list": {"displayText":"<declaration-list>","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-syntax","spec":"css-syntax-3","status":"snapshot","text":"<declaration-list>","type":"type","url":"https://www.w3.org/TR/css-syntax-3/#typedef-declaration-list"}, "https://www.w3.org/TR/css-syntax-3/#typedef-rule-list": {"displayText":"<rule-list>","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-syntax","spec":"css-syntax-3","status":"snapshot","text":"<rule-list>","type":"type","url":"https://www.w3.org/TR/css-syntax-3/#typedef-rule-list"}, "https://www.w3.org/TR/css-values-3/#time-value": {"displayText":"<time>","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-values","spec":"css-values-3","status":"snapshot","text":"<time>","type":"type","url":"https://www.w3.org/TR/css-values-3/#time-value"}, "https://www.w3.org/TR/css-values-4/#comb-any": {"displayText":"||","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"||","type":"grammar","url":"https://www.w3.org/TR/css-values-4/#comb-any"}, "https://www.w3.org/TR/css-values-4/#comb-one": {"displayText":"|","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"|","type":"grammar","url":"https://www.w3.org/TR/css-values-4/#comb-one"}, "https://www.w3.org/TR/css-values-4/#coordinated-value-list": {"displayText":"coordinated value list","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"coordinated value list","type":"dfn","url":"https://www.w3.org/TR/css-values-4/#coordinated-value-list"}, "https://www.w3.org/TR/css-values-4/#coordinating-list-base-property": {"displayText":"coordinating list base property","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"coordinating list base property","type":"dfn","url":"https://www.w3.org/TR/css-values-4/#coordinating-list-base-property"}, "https://www.w3.org/TR/css-values-4/#coordinating-list-property": {"displayText":"coordinating list property group","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"coordinating list property group","type":"dfn","url":"https://www.w3.org/TR/css-values-4/#coordinating-list-property"}, "https://www.w3.org/TR/css-values-4/#css-css-identifier": {"displayText":"CSS identifier","export":true,"for_":["CSS"],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"css identifier","type":"dfn","url":"https://www.w3.org/TR/css-values-4/#css-css-identifier"}, "https://www.w3.org/TR/css-values-4/#css-wide-keywords": {"displayText":"CSS-wide keywords","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"css-wide keywords","type":"dfn","url":"https://www.w3.org/TR/css-values-4/#css-wide-keywords"}, "https://www.w3.org/TR/css-values-4/#identifier-value": {"displayText":"<custom-ident>","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"<custom-ident>","type":"type","url":"https://www.w3.org/TR/css-values-4/#identifier-value"}, "https://www.w3.org/TR/css-values-4/#mult-comma": {"displayText":"#","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"#","type":"grammar","url":"https://www.w3.org/TR/css-values-4/#mult-comma"}, "https://www.w3.org/TR/css-values-4/#number-value": {"displayText":"<number>","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"<number>","type":"type","url":"https://www.w3.org/TR/css-values-4/#number-value"}, "https://www.w3.org/TR/css-values-4/#percentage-value": {"displayText":"<percentage>","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"<percentage>","type":"type","url":"https://www.w3.org/TR/css-values-4/#percentage-value"}, "https://www.w3.org/TR/css-values-4/#string-value": {"displayText":"<string>","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"snapshot","text":"<string>","type":"type","url":"https://www.w3.org/TR/css-values-4/#string-value"}, "https://www.w3.org/TR/css-will-change-1/#propdef-will-change": {"displayText":"will-change","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-will-change","spec":"css-will-change-1","status":"snapshot","text":"will-change","type":"property","url":"https://www.w3.org/TR/css-will-change-1/#propdef-will-change"}, "https://www.w3.org/TR/cssom-1/#concept-declarations-specified-order": {"displayText":"specified order","export":false,"for_":[],"level":"1","normative":true,"shortname":"cssom","spec":"cssom-1","status":"snapshot","text":"specified order","type":"dfn","url":"https://www.w3.org/TR/cssom-1/#concept-declarations-specified-order"}, "https://www.w3.org/TR/cssom-1/#cssomstring": {"displayText":"CSSOMString","export":true,"for_":[],"level":"1","normative":true,"shortname":"cssom","spec":"cssom-1","status":"snapshot","text":"CSSOMString","type":"interface","url":"https://www.w3.org/TR/cssom-1/#cssomstring"}, "https://www.w3.org/TR/cssom-1/#cssrule": {"displayText":"CSSRule","export":true,"for_":[],"level":"1","normative":true,"shortname":"cssom","spec":"cssom-1","status":"snapshot","text":"CSSRule","type":"interface","url":"https://www.w3.org/TR/cssom-1/#cssrule"}, "https://www.w3.org/TR/cssom-1/#cssrulelist": {"displayText":"CSSRuleList","export":true,"for_":[],"level":"1","normative":true,"shortname":"cssom","spec":"cssom-1","status":"snapshot","text":"CSSRuleList","type":"interface","url":"https://www.w3.org/TR/cssom-1/#cssrulelist"}, "https://www.w3.org/TR/cssom-1/#cssstyledeclaration-declarations": {"displayText":"declarations","export":true,"for_":["CSSStyleDeclaration"],"level":"1","normative":true,"shortname":"cssom","spec":"cssom-1","status":"snapshot","text":"declarations","type":"dfn","url":"https://www.w3.org/TR/cssom-1/#cssstyledeclaration-declarations"}, "https://www.w3.org/TR/cssom-1/#cssstyledeclaration-owner-node": {"displayText":"owner node","export":true,"for_":["CSSStyleDeclaration"],"level":"1","normative":true,"shortname":"cssom","spec":"cssom-1","status":"snapshot","text":"owner node","type":"dfn","url":"https://www.w3.org/TR/cssom-1/#cssstyledeclaration-owner-node"}, "https://www.w3.org/TR/cssom-1/#cssstyledeclaration-parent-css-rule": {"displayText":"parent CSS rule","export":true,"for_":["CSSStyleDeclaration"],"level":"1","normative":true,"shortname":"cssom","spec":"cssom-1","status":"snapshot","text":"parent css rule","type":"dfn","url":"https://www.w3.org/TR/cssom-1/#cssstyledeclaration-parent-css-rule"}, "https://www.w3.org/TR/i18n-glossary/#dfn-case-sensitive": {"displayText":"case-sensitive","export":true,"for_":[],"level":"1","normative":false,"shortname":"i18n-glossary","spec":"i18n-glossary","status":"snapshot","text":"case-sensitive","type":"dfn","url":"https://www.w3.org/TR/i18n-glossary/#dfn-case-sensitive"}, }; function mkRefHint(link, ref) { const linkText = link.textContent; let dfnTextElements = ''; if (ref.displayText.toLowerCase() != linkText.toLowerCase()) { // Give the original term if it's being displayed in a different way. // But allow casing differences, they're insignificant. dfnTextElements = mk.li({}, mk.b({}, "Term: "), mk.span({}, ref.displayText) ); } const forList = ref.for_; let forListElements; if(forList.length == 0) { forListElements = []; } else if(forList.length == 1) { forListElements = mk.li({}, mk.b({}, "For: "), mk.span({}, forList[0]), ); } else { forListElements = mk.li({}, mk.b({}, "For: "), mk.ul({}, ...forList.map(forItem => mk.li({}, mk.span({}, forItem) ), ), ), ); } const url = ref.url; const safeUrl = encodeURIComponent(url); const hintPanel = mk.aside({ class: "ref-hint", id: `ref-hint-for-${safeUrl}`, "data-for": url, "aria-labelled-by": `ref-hint-for-${safeUrl}`, }, mk.ul({}, dfnTextElements, mk.li({}, mk.b({}, "URL: "), mk.a({ href: url, class: "ref" }, url), ), mk.li({}, mk.b({}, "Type: "), mk.span({}, `${ref.type}`), ), mk.li({}, mk.b({}, "Spec: "), mk.span({}, `${ref.spec ? ref.spec : ''}`), ), forListElements ), ); hintPanel.forLink = link; setupRefHintEventListeners(link, hintPanel); return hintPanel; } function hideAllRefHints() { queryAll(".ref-hint").forEach(el=>hideRefHint(el)); } function hideRefHint(refHint) { const link = refHint.forLink; link.setAttribute("aria-expanded", "false"); if(refHint.teardownEventListeners) { refHint.teardownEventListeners(); } refHint.remove(); } function showRefHint(link) { if(link.classList.contains("dfn-link")) return; const url = link.getAttribute("href"); const ref = refsData[url]; if(!ref) return; hideAllRefHints(); // Only display one at this time. const refHint = mkRefHint(link, ref); append(document.body, refHint); link.setAttribute("aria-expanded", "true"); positionRefHint(refHint); } function setupRefHintEventListeners(link, refHint) { if (refHint.teardownEventListeners) return; // Add event handlers to hide the refHint after the user moves away // from both the link and refHint, if not hovering either within one second. let timeout = null; const startHidingRefHint = (event) => { if (timeout) { clearTimeout(timeout); } timeout = setTimeout(() => { hideRefHint(refHint); }, 1000); } const resetHidingRefHint = (event) => { if (timeout) clearTimeout(timeout); timeout = null; }; link.addEventListener("mouseleave", startHidingRefHint); link.addEventListener("mouseenter", resetHidingRefHint); link.addEventListener("blur", startHidingRefHint); link.addEventListener("focus", resetHidingRefHint); refHint.addEventListener("mouseleave", startHidingRefHint); refHint.addEventListener("mouseenter", resetHidingRefHint); refHint.addEventListener("blur", startHidingRefHint); refHint.addEventListener("focus", resetHidingRefHint); refHint.teardownEventListeners = () => { // remove event listeners resetHidingRefHint(); link.removeEventListener("mouseleave", startHidingRefHint); link.removeEventListener("mouseenter", resetHidingRefHint); link.removeEventListener("blur", startHidingRefHint); link.removeEventListener("focus", resetHidingRefHint); refHint.removeEventListener("mouseleave", startHidingRefHint); refHint.removeEventListener("mouseenter", resetHidingRefHint); refHint.removeEventListener("blur", startHidingRefHint); refHint.removeEventListener("focus", resetHidingRefHint); }; } function positionRefHint(refHint) { const link = refHint.forLink; const linkPos = getBounds(link); refHint.style.top = linkPos.bottom + "px"; refHint.style.left = linkPos.left + "px"; const panelPos = refHint.getBoundingClientRect(); const panelMargin = 8; const maxRight = document.body.parentNode.clientWidth - panelMargin; if (panelPos.right > maxRight) { const overflowAmount = panelPos.right - maxRight; const newLeft = Math.max(panelMargin, linkPos.left - overflowAmount); refHint.style.left = newLeft + "px"; } } // TODO: shared util // Returns the root-level absolute position {left and top} of element. function getBounds(el, relativeTo=document.body) { const relativeRect = relativeTo.getBoundingClientRect(); const elRect = el.getBoundingClientRect(); const top = elRect.top - relativeRect.top; const left = elRect.left - relativeRect.left; return { top, left, bottom: top + elRect.height, right: left + elRect.width, } } function showRefHintListener(e) { // If the target isn't in a link (or is a link), // just ignore it. let link = e.target.closest("a"); if(!link) return; // If the target is in a ref-hint panel // (aka a link in the already-open one), // also just ignore it. if(link.closest(".ref-hint")) return; // Otherwise, show the panel for the link. showRefHint(link); } function hideAllHintsListener(e) { // If the click is inside a ref-hint panel, ignore it. if(e.target.closest(".ref-hint")) return; // Otherwise, close all the current panels. hideAllRefHints(); } document.addEventListener("DOMContentLoaded", () => { document.body.addEventListener("mousedown", showRefHintListener); document.body.addEventListener("focus", showRefHintListener); document.body.addEventListener("click", hideAllHintsListener); }); window.addEventListener("resize", () => { // Hide any open ref hint. hideAllRefHints(); }); } </script>

Pages: 1 2 3 4 5 6 7 8 9 10