Skip to content

Commit 0e7b633

Browse files
author
Sylvain Galineau
committed
[css-animations] @Keyframes rules cascade; include example
1 parent 43fff14 commit 0e7b633

2 files changed

Lines changed: 271 additions & 209 deletions

File tree

css-animations/Overview.bs

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,60 @@ Keyframes</h2>
194194
Issue: Need to describe what happens if a property is not present in all keyframes.
195195

196196
The @keyframes rule that is used by an animation will be the last one encountered in sorted rules
197-
order that matches the name of the animation specified by the 'animation-name' property. @keyframes
198-
rules do not cascade; therefore, an animation will never derive keyframes from more than one
197+
order that matches the name of the animation specified by the 'animation-name' property. It must be
198+
noted that @keyframes rules cascade; therefore, an animation may derive keyframes from more than one
199199
@keyframes rule.
200200

201-
Note: Since empty @keyframes rule are valid, they may hide the keyframes of those
201+
<div class='example'>
202+
<pre>
203+
div {
204+
animation-name: slide-right;
205+
animation-duration: 2s;
206+
}
207+
208+
@keyframes slide-right {
209+
210+
from {
211+
margin-left: 0px;
212+
}
213+
214+
50% {
215+
margin-left: 110px;
216+
opacity: 1;
217+
}
218+
219+
50% {
220+
opacity: 0.9;
221+
}
222+
223+
to {
224+
margin-left: 200px;
225+
}
226+
227+
}
228+
</pre>
229+
230+
At the 1s mark, the slide-right animation will have the same state as if we had defined the 50% rule like this:
231+
232+
<pre>
233+
234+
@keyframes slide-right {
235+
236+
50% {
237+
margin-left: 110px;
238+
opacity: 0.9;
239+
}
240+
241+
to {
242+
margin-left: 200px;
243+
}
244+
245+
}
246+
</pre>
247+
248+
</div>
249+
250+
Note: Since empty @keyframes rules are valid, they may hide the keyframes of those
202251
preceding animation definitions with a matching name.
203252

204253
To determine the set of keyframes, all of the values in the selectors are sorted in increasing order
@@ -985,7 +1034,7 @@ Working Group Resolutions that are pending editing</h2>
9851034
<li>2013-02-20 minutes
9861035
<ul>
9871036
<li><del>Øyvind's clarification accepted</del>
988-
<li>keyframe rules cascade
1037+
<li><del>keyframe rules cascade</del>
9891038
<li>mark pseudoElement at-risk
9901039
</ul>
9911040
<li>2013-05-30 minutes

0 commit comments

Comments
 (0)