6. ~API
参考: 上で述べた抽象~modelに加えて,この仕様は、~modelに対する~APIも定義する。 この~interfaceは、次のために利用できる ⇒# 宣言的~手段により生産された~animationを拡張したり, 検分するため / 手続き的~approachの方が相応しいときに,~animationを直に生産するため ◎ This section is non-normative ◎ In addition to the abstract model described above, Web Animations also defines a programming interface to the model. This interface can be used to inspect and extend animations produced by declarative means or for directly producing animations when a procedural approach is more suitable.
6.1. ~APIにおける時刻~値
~APIにおいては、`時刻~値$は `double?^I 型で表現される。 値 ~NULL が時刻~値`未解決$を表現する。 【すなわち、未解決は ~NULL の別名。】 ◎ Time values are represented in the programming interface with the type double. Unresolved time values are represented by the value null.
正の無限大 `+Infinity^jv6.2. `AnimationTimeline^I ~interface
`時列線$は、~WAnim~APIにおいては `AnimationTimeline$I ~interfaceで表現される。 ◎ Timelines are represented in the Web Animations API by the AnimationTimeline interface.
[`Exposed$=Window] interface `AnimationTimeline@I { readonly attribute `double$? `currentTime$m; };
- `currentTime@m ◎ currentTime, of type double, readonly, nullable
- 取得子は、此れの`現-時刻$tLを返す(此れは`作動中$でないときは ~NULL になる)。 ◎ Returns the current time for this timeline or null if this timeline is inactive.
6.3. `DocumentTimeline^I ~interface
~WAnim~APIにおいては、`文書~時列線$は — `既定の文書~時列線$も含め — `DocumentTimeline$I ~interfaceで表現される。 ◎ Document timelines, including the default document timeline, are represented in the Web Animations API by the DocumentTimeline interface.
dictionary `DocumentTimelineOptions@I { `DOMHighResTimeStamp$I `originTime$m = 0; }; [`Exposed$=Window, `DocumentTimeline$mC(optional `DocumentTimelineOptions$I %options)] interface `DocumentTimeline@I : `AnimationTimeline$I { };
- `DocumentTimelineOptions^II`originTime@m1 ◎ originTime, of type DOMHighResTimeStamp, defaulting to 0
- 時列線~用の`起点~時刻$を,`時刻~起点$に相対的な~milli-秒による実数-として指定する。 ◎ The origin time for the timeline specified as a real number of milliseconds relative to the time origin.
- `DocumentTimeline(options)@m0 ◎ DocumentTimeline (options)
- この構築子は、次のようにされた`文書~時列線$を表現する,新たな `DocumentTimeline$I を返す ⇒# `属する文書$ ~SET `現在の大域~obj$である `Window$I に`結付けられている文書$, `起点~時刻$ ~SET %options の `DocumentTimelineOptions^II`originTime$m1 ◎ Creates a new DocumentTimeline. The Document with which the timeline is associated is the Document associated with the Window that is the current global object.
- %options 引数は、新たに作成される時列線~用の環境設定~parameterたちを与える。 この仕様は `originTime$m1 ~memberのみを定義するが、他の仕様は,この集合を拡張しても~MAY。 ◎ Configuration parameters for the newly-created timeline. This specification defines only the originTime member but other specifications may extend this set.
6.4. `Animation^I ~interface
`~animation$は、~WAnim~APIにおいては `Animation$I ~interfaceで表現される。 ◎ Animations are represented in the Web Animations API by the Animation interface.
[`Exposed$=Window, `Animation$mC(optional `AnimationEffect$I? %effect = null, optional `AnimationTimeline$I? %timeline)] interface `Animation@I : `EventTarget$I { attribute `DOMString$ `id$m; attribute `AnimationEffect$I? `effect$m; attribute `AnimationTimeline$I? `timeline$m; attribute `double$? `startTime$m; attribute `double$? `currentTime$m; attribute `double$ `playbackRate$m; readonly attribute `AnimationPlayState$I `playState$m; readonly attribute `boolean$ `pending$m; readonly attribute Promise<`Animation$I> `ready$m; readonly attribute Promise<`Animation$I> `finished$m; attribute `EventHandler$I `onfinish$m; attribute `EventHandler$I `oncancel$m; void `cancel$m(); void `finish$m(); void `play$m(); void `pause$m(); void `updatePlaybackRate$m(`double$ %playbackRate); void `reverse$m(); };
- `Animation(effect, timeline)@m ◎ Animation (effect, timeline)
-
新たな `Animation$I ~objを作成する。 ◎ Creates a new Animation object\
-
被呼出時には、次を走らす: ◎ using the following procedure.
- %~animation ~LET 新たな `Animation$I ~obj ◎ Let animation be a new Animation object.
- ~IF[ %timeline 引数は与えられていない ] ⇒ %timeline ~SET `現在の大域~obj$である `Window$I に`結付けられている文書$の`既定の文書~時列線$ ◎ ↓
- `時列線を設定する$( %~animation, %timeline ) ◎ Run the procedure to set the timeline of an animation on animation passing timeline as the new timeline or, if a timeline argument is missing, passing the default document timeline of the Document associated with the Window that is the current global object.
- `~target効果を設定する$( %~animation, %effect ) ◎ Run the procedure to set the target effect of an animation on animation passing source as the new effect.
- %effect 引数(省略可)は、 ~NULL でないならば,新たに作成する`~animation$にアテがう`~target効果$を指定する。 ◎ effect • An optional value which, if not null, specifies the target effect to assign to the newly created animation.
- %timeline 引数(省略可)は、新たに作成される`~animation$に結付ける`時列線$を指定する。 与えられていない場合、`現在の大域~obj$( `Window$I )に`結付けられている文書$の`既定の文書~時列線$が利用される。 ◎ timeline • An optional value which, if present, specifies the timeline with which to associate the newly-created animation. If missing, the default document timeline of the Document associated with the Window that is the current global object is used.
- `id@m ◎ id, of type DOMString
- この~animationを識別するために利用される文字列。 ◎ A string used to identify the animation.
- 【 取得子は、最後に設定された値を返す。 設定子は、この属性を所与の値に設定する(一意性は、要求されていない)。 初期~時には、(他の値で初期化されない限り)空~文字列にされる。 】
- `effect@m ◎ effect, of type AnimationEffect, nullable
- 取得子は、此れの`~target効果$を返す。 ◎ The target effect associated with this animation.\
- 設定して,この~animationの`~target効果$を更新できる — 設定子は、次を走らす ⇒ `~target効果を設定する$( 此れ, 所与の値 ) ◎ Setting this attribute updates the object’s target effect using the procedure to set the target effect of an animation.
- `timeline@m ◎ timeline, of type AnimationTimeline, nullable
- 取得子は、此れの`時列線$Anを返す。 ◎ The timeline associated with this animation.\
- 設定して,この~animationの`時列線$Anを更新できる — 設定子は、次を走らす ⇒ `時列線を設定する$( 此れ, 所与の値 ) ◎ Setting this attribute updates the object’s timeline using the procedure to set the timeline of an animation.
- `startTime@m ◎ startTime, of type double, nullable
- 取得子は、此れの`開始-時刻$を返す。 ◎ Returns the start time of this animation.\
- 設定して,この~animationの`開始-時刻$を新たな値に更新できる — 設定子は、次を走らす ⇒ `開始-時刻を設定する$( 此れ ) ◎ Setting this attribute updates the start time using the procedure to set the start time of this object to the new value.
- `currentTime@m ◎ currentTime, of type double, nullable
- 取得子は、此れの`現-時刻$を返す。 ◎ The current time of this animation.\
- 設定して,この~animationの`現-時刻$を変更できる — 設定子は、次を走らす ⇒ `現-時刻を設定する$( 此れ, 所与の値 ) ◎ Setting this attribute follows the procedure to set the current time of this object to the new value.
- `playbackRate@m ◎ playbackRate, of type double
- 取得子は、此れの`再生~rate$を返す。 ◎ The playback rate of this animation.\
- 設定して,この~animationの`再生~rate$を変更できる — 設定子は、次を走らす ⇒ `再生~rateを設定する$( 此れ, 所与の値 ) ◎ Setting this attribute follows the procedure to set the playback rate of this object to the new value.
- 注記: この属性を設定すれば、`再生~rate$の同期的な更新を遂行できる。 すなわち、別々の~thread等で走らせている~animationの再生~状態と同期しようと試みることはない。 したがって、~animationが再生中の間に `playbackRate$m を設定した場合,~jumpを生じさせ得る。 ◎ Setting this attribute performs a synchronous update to the playback rate meaning that it does not make any attempt to synchronize with the playback state of animations running on a separate process or thread. As a result, setting the playbackRate for an in-flight animation may cause it to jump.
- 注記: ~animationが再生中のときでも,`再生~rate$を滑らかに更新するためには、非同期的 `updatePlaybackRate()$m ~methodを利用すること。 ◎ To set the the playback rate for an in-flight animation such that it smoothly updates, use the asynchronous updatePlaybackRate() method.
- `playState@m ◎ playState, of type AnimationPlayState, readonly
- 取得子は、此れの`再生-状態$に対応する `AnimationPlayState$I 値を返す。 ◎ The play state of this animation.
- `pending@m ◎ pending, of type boolean, readonly
- 取得子は、此れは次を[ 満たすならば ~T / 満たさないならば ~F ]を返す ⇒ [ `処理待ち再生-~task$ ~NEQ ε ]~OR[ `処理待ち静止-~task$ ~NEQ ε ] ◎ Returns true if this animation has a pending play task or a pending pause task.
- `ready@m ◎ ready, of type Promise<Animation>, readonly
- 取得子は、此れの`現在の準備済み~promise$を返す ◎ Returns the current ready promise for this object.
- `finished@m ◎ finished, of type Promise<Animation>, readonly
- 取得子は、此れの`現在の完遂d~promise$を返す。 ◎ Returns the current finished promise for this object.
- `onfinish@m ◎ onfinish, of type EventHandler
- `finish$et ~event用の~event~handler。 ◎ The event handler for the finish event.
- `oncancel@m ◎ oncancel, of type EventHandler
- `cancel$et ~event用の~event~handler。 ◎ The event handler for the cancel event.
- `cancel()@m ◎ void cancel()
- この~animationにより生じたすべての効果を消去して, 再生を中止する。 ◎ Clears all effects caused by this animation and aborts its playback\
- 被呼出時には、次を走らす ⇒ `~animationを取消す$( 此れ ) ◎ by running the cancel an animation procedure for this object.
- `finish()@m ◎ void finish()
- この~animationを、現在の方向において`~target効果$の終端へ~seekする。 ◎ Seeks the animation to the end of the target effect in the current direction\
- 被呼出時には、次を走らす(例外が投出され得る) ⇒ `~animationを完遂する$( 此れ ) ◎ by running the finish an animation procedure for this object. ◎ 不要 DOMException of type InvalidStateError • Raised if this animation’s playback rate is zero, or if this animation’s playback rate is > zero and the end time of this animation’s target effect is infinity.
- `play()@m ◎ void play()
- この~animationの再生を始める/再開する。 ◎ Begins or resumes playback of the animation by\
- 被呼出時には、次を走らす ⇒ `~animationを再生する$( 此れ, `自動巻戻しあり^i ) ◎ running the procedure to play an animation passing true as the value of the auto-rewind flag.
- `pause()@m ◎ void pause()
- この~animationの再生を休止する。 ◎ Suspends the playback of this animation\
- 被呼出時には、次を走らす ⇒ `~animationを静止する$( 此れ ) ◎ by running the procedure to pause an animation for this object.
- `updatePlaybackRate(playbackRate)@m ◎ void updatePlaybackRate(playbackRate)
- この~animationの`再生~rate$を非同期的に更新する。 ◎ Performs an asynchronous update of the playback rate of this animation\
- 被呼出時には、次を走らす ⇒ `再生~rateを継目無く更新する$( 此れ, %playbackRate ) ◎ by performing the seamlessly update the playback rate procedure, passing playbackRate as the new playback rate.
- %playbackRate は、更新に利用する再生~rateを有限~実数-で指定する。 ◎ playbackRate • A finite real number specifying the updated playback rate to use.
- `reverse()@m ◎ void reverse()
- この~animationの`再生~rate$を反転した上で、それを利用して再生する。 ◎ Inverts the playback rate of this animation and plays it\
- 被呼出時には、次を走らす: ⇒ `~animationを逆転する$( 此れ ) ◎ using the reverse an animation procedure for this object.\
- `play()$m と同じく,この~methodは~animationの静止-を解くことに加え、~animationが 逆方向への再生-をすでに完遂していた場合は、`~target効果$の始端へ~seekする。 ◎ As with play(), this method unpauses the animation and, if the animation has already finished playing in the reversed direction, seeks to the start of the target effect.
6.4.1. `AnimationPlayState^I 列挙
enum `AnimationPlayState@I { "`idle@m", "`running@m", "`paused@m", "`finished@m" };
- `idle^l
- `遊休中$iに対応する。 ◎ Corresponds to the idle play state.
- `running^l
- `稼働中$iに対応する。 ◎ Corresponds to the running play state.
- `paused^l
- `静止中$iに対応する。 ◎ Corresponds to the paused play state.
- `finished^l
- `完遂d$iに対応する。 ◎ Corresponds to the finished play state.
6.5. `AnimationEffect^I ~interface
`~animation効果$は、~WAnim~APIにおいては,抽象 `AnimationEffect$I ~interfaceで表現される。 ◎ Animation effects are represented in the Web Animations API by the abstract AnimationEffect interface.
[`Exposed$=Window] interface `AnimationEffect@I { `EffectTiming$I `getTiming$m(); `ComputedEffectTiming$I `getComputedTiming$m(); void `updateTiming$m(optional `OptionalEffectTiming$I %timing); };
注記: 将来においては、~animation効果が`計時~model$secから離れた所でも駆動できるよう,次のような~memberを公開し得る:
any onupdate(double? %progress, double %currentIteration, Animatable? %target, any %underlyingValue)◎ In future, we may expose any onupdate (double? progress, double currentIteration, Animatable? target, any underlyingValue) so that the animation effects can be driven apart from the timing model.
- `getTiming()@m
- この`~animation効果$用に指定された計時~propたちを返す。 ◎ Returns the specified timing properties for this animation effect.
- 返される `EffectTiming$I ~objを成す各~memberと`計時~model$secを成す各~propとの対応関係については、その~interfaceを見よ。 ◎ For the correspondance between the members of the returned EffectTiming object and properties of the timing model, see the the EffectTiming interface.
- `getComputedTiming()@m
- この`~animation効果$用に計算される計時~propたちを返す。 ◎ Returns the calculated timing properties for this animation effect.
-
[ `getTiming()$m, `getComputedTiming()$m ]が返す `EffectTiming$I ~objを成す一部の~memberは,共通するが、それらの値は次の仕方で相違し得る: ◎ Although some of the attributes of the object returned by getTiming() and getComputedTiming() are common, their values may differ in the following ways:
-
`duration$m1 ⇒ `getTiming()$m は文字列 `auto^l を返すこともある一方で、 `getComputedTiming()$m は — その~memberの定義に述べるように — `反復~所要時間$を表す実数を返さ~MUST。 ◎ duration – while getTiming() may return the string auto, getComputedTiming() must return a number corresponding to the calculated value of the iteration duration as defined in the description of the duration member of the EffectTiming interface.
仕様のこの~levelでは、 `auto^l 値は,単純に 0 に置換されることを意味する。 ◎ In this level of the specification, that simply means that an auto value is replaced by zero.
-
`fill$m1 ⇒ `getTiming()$m は文字列 `auto^l を返すこともある一方で、 `getComputedTiming()$m は — その~memberの定義に述べるように — 計時~計算に利用する特定の `FillMode$I を返さ~MUST。 ◎ fill – likewise, while getTiming() may return the string auto, getComputedTiming() must return the specific FillMode used for timing calculations as defined in the description of the fill member of the EffectTiming interface.
この仕様のこの~levelでは、 `auto^l 値は 単純に `FillMode$I `none^l に置換されることを意味する。 ◎ In this level of the specification, that simply means that an auto value is replaced by the none FillMode.
-
- 注記: 他の計時~memberは,将来には `auto^l の様な値を含むように拡張される見込みが高い。 作者には、計時~計算を遂行するときには,アリ~なら `getComputedTiming()$m を利用することが奨励される — 指定d値に許容される範囲や型が変更されたときの非互換性を避けるため。 ◎ Note: It is likely that other timing members may be extended in future to include auto-like values. When performing timing calculations, authors are encouraged to use getComputedTiming() where possible to avoid incompatibility should the range or type of allowed specified values be changed.
- `getComputedTiming()$m が返す `ComputedEffectTiming$I 辞書には、 `getTiming()$m に比較して,追加の計時~情報も定義される。 ◎ In addition to possible differences in the values returned, compared to getTiming(), getComputedTiming() returns additional timing information as defined by the ComputedEffectTiming dictionary.
- `updateTiming(timing)@m
- この`~animation効果$に指定された計時~propたちを更新する。 ◎ Updates the specified timing properties of this animation effect\
- 被呼出時には、次を走らす ⇒ `~animation効果の計時~propを更新する$( 此れ, %timing ) ◎ by performing the procedure to update the timing properties of an animation effect passing the timing parameter as input.
- %timing 引数は、更新する計時~propたちを与える。 改変される計時~propは、 %timing 上に`在する$~memberに対応するものに限られる。 ◎ optional OptionalEffectTiming timing • The timing properties to update. The timing properties corresponding to any members not present on timing will not be modified.
`remove()^m ~method【この仕様には定義されていない】を利用して[ 親~group/~animation ]から効果を除去できる。 それを~level 1 に保って,単純に~animationから~animation効果を除去するものと定義するべきか? `2082$issue ◎ The remove() method can be used to remove an effect from either its parent group or animation. Should we keep it in level 1 and define it simply as removing the animation effect from its animation? <https://github.com/w3c/csswg-drafts/issues/2082>
6.5.1. `EffectTiming^I, `OptionalEffectTiming^I 辞書
`EffectTiming$I 辞書は、 `AnimationEffect$I の計時~propたちを表現する。 ◎ The EffectTiming dictionary represents the timing properties of an AnimationEffect.
`OptionalEffectTiming$I 辞書は、 `EffectTiming$I 辞書の変種であり,一部の~memberのみ`在する$ことも許容する。 `AnimationEffect$I ~interfaceの `updateTiming()$m1 ~methodは、これを利用して,`~animation効果$の計時~propたちに対する差分~更新を遂行する。 ◎ The OptionalEffectTiming dictionary is a variant of the EffectTiming dictionary that allows some members to be not present. This is used by the updateTiming() method of the AnimationEffect interface to perform a delta update to the timing properties of an animation effect.
dictionary `EffectTiming@I { `double$ `delay$m = 0; `double$ `endDelay$m = 0; `FillMode$I `fill$m = "auto"; `double$ `iterationStart$m = 0.0; `unrestricted double$ `iterations$m = 1.0; (`unrestricted double$ or `DOMString$) `duration$m = "auto"; `PlaybackDirection$I `direction$m = "normal"; `DOMString$ `easing$m = "linear"; }; dictionary `OptionalEffectTiming@II { `double$ `delay$m; `double$ `endDelay$m; `FillMode$I `fill$m; `double$ `iterationStart$m; `unrestricted double$ `iterations$m; (`unrestricted double$ or `DOMString$) `duration$m; `PlaybackDirection$I `direction$m; `DOMString$ `easing$m; };
- `delay@m ◎ delay, of type double, defaulting to 0
- `開始-遅延$を与える — それは、当の`~animation効果$を`~targetにしている~animation$の`開始-時刻$から 当の`~animation効果$の`作動~区間$の始端まで ]の~milli-秒数を表現する。 ◎ The start delay which represents the number of milliseconds from the start time of the associated animation to the start of the active interval.
- `endDelay@m ◎ endDelay, of type double, defaulting to 0
- `終止-遅延$を与える — それは、当の`~animation効果$の[ `作動~区間$の終端から`終止-時刻$まで ]の~milli-秒数を表現する。 ◎ The end delay which represents the number of milliseconds from the end of an animation effect’s active interval until its end time.
- `fill@m ◎ fill, of type FillMode, defaulting to "auto"
- `延伸~mode$を与える — それは、当の`~animation効果$の`作動~区間$の外側における挙動を定義する。 ◎ The fill mode which defines the behavior of the animation effect outside its active interval.
- 計時~計算を遂行するときには、特別な文字列~値 `auto^l は,`計時~model$secにより認識されるいずれかの`延伸~mode$に展開される — すなわち,次に対応する`延伸~mode$を利用する ⇒# 当の`~animation効果$は`~keyframe効果$であるならば `なし^i ( `none^l )/ ~ELSE_ `両方^i ( `both^l ) ◎ When performing timing calculations the special string value auto is expanded to one of the fill modes recognized by the timing model as follows, ◎ If the animation effect to which the fill mode is being is applied is a keyframe effect, • Use none as the fill mode. ◎ Otherwise, • Use both as the fill mode.
- `iterationStart@m ◎ iterationStart, of type double, defaulting to 0.0
- 当の`~animation効果$の`反復~始端$~propを与える — それは 0 以上の有限~実数-であり、~animation効果が始まるのは[ どの反復~indexの反復~内のどの進捗からか 【 0 から数えて どの回の反復か, その回の どの割合分からか】 ]を表現する。 ◎ The animation effect’s iteration start property which is a finite real number greater than or equal to zero representing the iteration index at which the animation effect begins and its progress through that iteration.
- 例えば,値 0.5 は、~animation効果は 1 回目の反復の中間点から始まることを指示する。 値 1.2 は、~animation効果は 2 回目の反復の 20% から始まることを指示する。 ◎ For example, a value of 0.5 indicates that the animation effect begins half way through its first iteration. A value of 1.2 indicates the animation effect begins 20% of the way through its second iteration.
- 注記: `iterations$m の値は、実質的に `iterationStart$m に加算される — 例えば `iterations$m が 2 にされた~animation効果は、 `iterationStart$m が 0.5 にされても 2 周~繰返すことになるが,各`反復~区間$の中間点で始まって中間点で終端することになる。 ◎ Note that the value of iterations is effectively added to the iterationStart such that an animation effect with an iterationStart of ‘0.5’ and iterations of ‘2’ will still repeat twice however it will begin and end half-way through its iteration interval.
- 注記: 1 以上の `iterationStart$m 値が有用になるのは、概して[ `反復~組成-演算~型$が `累積-^i である~animation効果と併用されたときか, または `現-反復$ ~indexが有意になるとき ]に限られる。 ◎ iterationStart values greater than or equal to one are typically only useful in combination with an animation effect that has an iteration composite operation of accumulate or when the current iteration index is otherwise significant.
- `iterations@m ◎ iterations, of type unrestricted double, defaulting to 1.0
- 当の`~animation効果$の`反復~回数$を与える — それは、 0 以上の実数-(正の無限大も含む)であり,~animation効果が繰返す回数を表現する。 ◎ The animation effect’s iteration count property which is a real number greater than or equal to zero (including positive infinity) representing the number of times to the animation effect repeats.
- これは、正の無限大に設定されても~MAY — 当の`~animation効果$は、永遠に繰返されることになる(効果の所要時間が 0 でない限り — その事例では即時に完遂することになる)。 ◎ This may be set to +Infinity to cause the animation effect to repeat forever (unless the duration of the effect is zero, in which case it will finish immediately).
- `duration@m ◎ duration, of type (unrestricted double or DOMString), defaulting to "auto"
- `反復~所要時間$を 0 以上の実数-(正の無限大も含む)で与える。 当の`~animation効果$の 1 回の反復を完了するまでにかかる時間を表現する。 ◎ The iteration duration which is a real number greater than or equal to zero (including positive infinity) representing the time taken to complete a single iteration of the animation effect.
- `AnimationEffect^II この~levelのこの仕様では、文字列~値 `auto^l は —[ `計時~model$secにおける計算 / `getComputedTiming()$m1 が返す値の `duration$m ~memberの結果 ]の目的においては — 0 に扱うとする。 しかしながら, 作者が指定した `auto^l 値に対しては、~UAは[ `getTiming()$m1 が返す値の `duration$m ~memberは `auto^l を返す ]ようにし~MUST。 ◎ In this level of this specification, the string value auto is treated as the value zero for the purpose of timing model calculations and for the result of the duration member returned from getComputedTiming(). If the author specifies the auto value user agents must, however, return auto for the duration member returned from getTiming().
- これは、前方互換性に備えるためにある — この仕様の将来~levelは、~group効果を導入することになり,そこでの `auto^l 値は子~効果の所要時間も含むよう拡げることが期待されるので。 ◎ This is a forwards-compatiblity measure since a future level of this specification is expected to introduce group effects where the auto value expands to include the duration of the child effects.
- `direction@m ◎ direction, of type PlaybackDirection, defaulting to "normal"
- 当の`~animation効果$の`再生~方向$を与える — それは、再生は[ 前方, 後方 ]のどちらへ進行するか, および 再生~方向は 各~反復ごとに交替するかを定義する ◎ The playback direction of the animation effect which defines whether playback proceeds forwards, backwards, or alternates on each iteration.
- `easing@m ◎ easing, of type DOMString, defaulting to "linear"
- `計時~関数$を与える — それは、時刻を伸縮して,加減速( `easing^en )効果を生産するために利用される。 ◎ The timing function used to scale the time to produce easing effects.
- 文字列の構文は、 `timing-function$t 生成規則により定義される。 `CSS-TIMING-1$r ◎ The syntax of the string is defined by the <timing-function> production [CSS-TIMING-1].
6.5.2. `FillMode^I 列挙
enum `FillMode@I { "`none@m", "`forwards@m", "`backwards@m", "`both@m", "`auto@m" };
- `none^l
- 延伸しない。 ◎ No fill.
- `forwards^l
- 前方へ延伸する。 ◎ Fill forwards.
- `backwards^l
- 後方へ延伸する。 ◎ Fill backwards.
- `both^l
- 後方, 前方へ延伸する。 ◎ Fill backwards and forwards.
- `auto^l
- 延伸しない。 この仕様の後継~levelでは、これは,他の型の`~animation効果$用に異なる挙動を生産し得る。 ◎ No fill. In a subsequent level of this specification, this may produce different behavior for other types of animation effects.
6.5.3. `PlaybackDirection^I 列挙
enum `PlaybackDirection@I { "`normal@m", "`reverse@m", "`alternate@m", "`alternate-reverse@m" };
- `normal^l
- すべての反復は、指定されたとおりに再生される。 ◎ All iterations are played as specified.
- `reverse^l
- すべての反復は、指定された順序と逆方向に再生される。 ◎ All iterations are played in the reverse direction from the order they are specified.
- `alternate^l
- 偶数~番【 0 番が初回】の反復は、指定されたとおりに再生される。 奇数~番の反復は、指定された順序と逆方向に再生される。 ◎ Even iterations are played as specified, odd iterations are played in the reverse direction from the order they are specified.
- `alternate-reverse^l
- 偶数~番【 0 番が初回】の反復は指定された順序の逆方向に再生される。 奇数~番の反復は指定されたとおりに再生される。 ◎ Even iterations are played in the reverse direction from the order they are specified, odd iterations are played as specified.
6.5.4. `AnimationEffect^I の計時の更新-法
`~animation効果の計時~propを更新する@ ときは、所与の ( %効果, [ `EffectTiming$I0 / `OptionalEffectTiming$I ]~obj %入力 ) に対し,次を遂行する: ◎ To update the timing properties of an animation effect, effect, from an EffectTiming or OptionalEffectTiming object, input, perform the following steps:
-
下の表 A の~EACH( %行 ) に対し ⇒ ~IF[ %入力 には %行 の 1 列目に与える~memberは`在する$ ]~AND[ その~memberの値は %行 の 2 列目に与える条件を満たさない ] ⇒ ~THROW `TypeError^E
表 A ~member 条件(空欄は無条件) ~prop `delay$m `開始-遅延$ `endDelay$m `終止-遅延$ `fill$m `延伸~mode$ `iterationStart$m 0 以上 `反復~始端$ `iterations$m `NaN^jv でない, かつ 0 以上 `反復~回数$ `duration$m [ 文字列である ]~OR[ `NaN^jv でない, かつ 0 以上 ] `反復~所要時間$ `direction$m `再生~方向$ `easing$m `timing-function$t 生成規則に合致する `計時~関数$ 注記: `RangeError^E ではなく `TypeError^E を利用している理由は、~WebIDLの [`EnforceRange$] 注釈の挙動に~~正確に~~倣うようにするためである — 将来に,その注釈を浮動小数点~値にも利用-可能にするべく。
◎ If the iterationStart member of input is present and less than zero, throw a TypeError and abort this procedure. ◎ Note: The reason for using a TypeError rather than a RangeError is to mirror the behavior of WebIDL’s [EnforceRange] annotation should that annotation be able to be used with floating-point values in the future. ◎ If the iterations member of input is present, and less than zero or is the value NaN, throw a TypeError and abort this procedure. ◎ If the duration member of input is present, and less than zero or is the value NaN, throw a TypeError and abort this procedure. ◎ If the easing member of input is present but cannot be parsed using the <timing-function> production [CSS-TIMING-1], throw a TypeError and abort this procedure. - 上の表 A の~EACH( %行 ) に対し ⇒ ~IF[ %行 の 1 列目に与える %入力 の~memberは`在する$ ] ⇒ %効果 の[ %行 の 3 列目に与える~prop ] ~SET その~memberの値 ◎ Assign each member present in input to the corresponding timing property of effect as follows: • delay → start delay • endDelay → end delay • fill → fill mode • iterationStart → iteration start • iterations → iteration count • duration → iteration duration • direction → playback direction • easing → timing function
6.5.5. `ComputedEffectTiming^I 辞書
`計時~model$secにより計算される各種~計時~propたちは、 `ComputedEffectTiming$I 辞書~objを利用して公開される。 ◎ Timing properties calculated by the timing model are exposed using ComputedEffectTiming dictionary objects.
dictionary `ComputedEffectTiming@I : `EffectTiming$I { `unrestricted double$ `endTime$m; `unrestricted double$ `activeDuration$m; `double$? `localTime$m; `double$? `progress$m; `unrestricted double$? `currentIteration$m; };
- `endTime@m ◎ endTime, of type unrestricted double
- 当の`~animation効果$の`終止-時刻$にされる — `局所~時刻$ 0 からの~milli-秒で表される(すなわち、[ 当の`~animation効果$を`~targetにしている~animation$ ~NEQ ε ]ならば,その`~animation$の`開始-時刻$からの)。 これは、`~animation効果$の ( `作動-区間$の終端 ~PLUS `終止-遅延$ ) に対応する。 ◎ The end time of the animation effect expressed in milliseconds since zero local time (that is, since the associated animation’s start time if this animation effect is associated with an animation). This corresponds to the end of the animation effect’s active interval plus any end delay.
- `activeDuration@m ◎ activeDuration, of type unrestricted double
- 当の`~animation効果$の`作動~所要時間$にされる。 ◎ The active duration of this animation effect.
- `localTime@m ◎ localTime, of type double, nullable
- 当の`~animation効果$の`局所~時刻$にされる。 ◎ The local time of this animation effect.
- これは、[ 当の`~animation効果$を`~targetにしている~animation$ ~EQ ε ]ならば ~NULL にされる。 ◎ This will be null if this animation effect is not associated with an animation.
- `progress@m ◎ progress, of type double, nullable
- 当の`~animation効果$の現在の`反復~進捗$にされる。 ◎ The current iteration progress of this animation effect.
- `currentIteration@m ◎ currentIteration, of type unrestricted double, nullable
- `現-反復$の 0 回から数えた~indexにされる。 ◎ The current iteration index beginning with zero for the first iteration.
- ほとんどの事例では,これは(正の)整数にされるが、[ 所要時間 0 にされ,無限~回 繰返す~animation ]に対しては、値は正の無限大にされる。 ◎ In most cases this will be a (positive) integer. However, for a zero-duration animation that repeats infinite times, the value will be positive Infinity.
- 時刻に対する`未解決$と同じく,`現-反復$に対する未解決は ~NULL 値で表現される。 ◎ As with unresolved times, an unresolved current iteration is represented by a null value.
6.6. `KeyframeEffect^I ~interface
`~keyframe効果$は `KeyframeEffect$I ~interfaceにより表現される。 ◎ Keyframe effects are represented by the KeyframeEffect interface.
[`Exposed$=Window, `KeyframeEffect$mC( (`Element$I or `CSSPseudoElement$I)? %target, `object$? %keyframes, optional (`unrestricted double$ or `KeyframeEffectOptions$I) %options ), Constructor(`KeyframeEffect$I %source) ] interface `KeyframeEffect@I : `AnimationEffect$I { attribute (`Element$I or `CSSPseudoElement$I)? `target$m; attribute `IterationCompositeOperation$I `iterationComposite$m; attribute `CompositeOperation$I `composite$m; sequence<`object$> `getKeyframes$m(); void `setKeyframes$m(`object$? %keyframes); };
- `KeyframeEffect(target, keyframes, options)@m ◎ KeyframeEffect (target, keyframes, options)
-
新たな `KeyframeEffect$I ~objを作成する。 被呼出時には、次を走らす: ◎ Creates a new KeyframeEffect object using the following procedure:
- %効果 ~LET 新たな `KeyframeEffect$I ~obj ◎ Create a new KeyframeEffect object, effect.
- %効果 の`~target要素$ ~SET %target ◎ Set the target element of effect to target.
- %計時~入力 ~LET %options に応じて ⇒# `KeyframeEffectOptions$I ~objであるならば %options / ~ELSE_ 新たな `EffectTiming$I ~obj(各~memberはそれぞれの既定~値に設定される) ◎ Let timing input be the result corresponding to the first matching condition from below. • If options is a KeyframeEffectOptions object, •• Let timing input be options. • If options is a double, •• Let timing input be a new EffectTiming object with all members set to their default values and duration set to options. • Otherwise (options is undefined), •• Let timing input be a new EffectTiming object with all members set to their default values.
- ~IF[ %options は `double^c 型である ] ⇒ %計時~入力 の `duration$m1 ~SET %options ◎ ↑
- `~animation効果の計時~propを更新する$( %効果, %計時~入力 ) (例外が投出され得る) ◎ Call the procedure to update the timing properties of an animation effect of effect from timing input. ◎ If that procedure causes an exception to be thrown, propagate the exception and abort this procedure.
-
~IF[ %options は `KeyframeEffectOptions$I ~objである ] ⇒ %効果 の ⇒# `iterationComposite$m ~SET %options の `iterationComposite$m1 値, `composite$m ~SET %options の `composite$m1 値 ◎ If options is a KeyframeEffectOptions object, assign the iterationComposite, and composite, properties of effect to the corresponding value from options.
これらの~propをアテがうときには、 `KeyframeEffect$I ~interface上の対応する設定子~用に定義される~errorの取扱いを適用する 【と記されているが、定義されてない(単に~WebIDLによる既定の挙動に従う?)】。 それらの設定子のどれかが %options が指定する値に対し例外を投出するよう要求する場合、同じ例外が,この手続きから`投出され$~MUST ◎ When assigning these properties, the error-handling defined for the corresponding setters on the KeyframeEffect interface is applied. If any of those setters require an exception to be thrown for the values specified by options, this procedure must throw the same exception and abort all further steps.
- %効果 用の`~keyframe$が成す集合を,[ %keyframes に`~keyframes引数の処理-法$secを適用した結果 ]で初期化する ◎ Initialize the set of keyframes by performing the procedure defined for setKeyframes() passing keyframes as the input.
- %target 引数は[ `~target要素$/~target疑似要素 ]を与える。 また,特定の要素を~targetにしない~animation用には、 ~NULL にされて~MAY。 ◎ (Element or CSSPseudoElement)? target • The target element or target pseudo-element. This may be null for animations that do not target a specific element.
- %keyframes 引数は、利用する`~keyframe$の集合を与える。 この引数の形式と処理は、`~keyframes引数の処理-法$secにて定義される。 ◎ object? keyframes • The set of keyframes to use. The format and processing of this argument is defined in §6.6.3 Processing a keyframes argument.
- %options 引数は、当の効果の[ `反復~所要時間$を指定する実数, または 計時と挙動を指定する~propたちが成す~collection ]を与える。 ◎ optional KeyframeEffectOptions options • Either a number specifying the iteration duration of the effect, or a collection of properties specifying the timing and behavior of the effect.
- この構築子の用法~例は、 § 新たな `KeyframeEffect^I ~objの作成-法 に与えられる。 ◎ Examples of the usage of this constructor are given in §6.6.1 Creating a new KeyframeEffect object.
- `KeyframeEffect(source)^m ◎ KeyframeEffect (source)
-
%source と同じ~propたちを伴う,新たな `KeyframeEffect$I ~objを作成する。 被呼出時には、次を走らす: ◎ Creates a new KeyframeEffect object with the same properties as source using the following procedure:
- %効果 ~LET 新たな `KeyframeEffect$I ~obj ◎ Create a new KeyframeEffect object, effect.
- %効果 の[ 次に挙げる各~prop ] ~SET %source の対応する~prop ⇒# `~target要素$, `~keyframe$, `反復~組成-演算~型$, `組成-演算~型$ ◎ Set the following properties of effect using the corresponding values of source: • target element, • keyframes, • iteration composite operation, • composite operation, and
- %効果 の[ 次に挙げる各~計時~prop ] ~SET %source に指定された対応する~prop ⇒# `開始-遅延$, `終止-遅延$, `延伸~mode$, `反復~始端$, `反復~回数$, `反復~所要時間$, `再生~方向$, `計時~関数$ ◎ all specified timing properties: • start delay, • end delay, • fill mode, • iteration start, • iteration count, • iteration duration, • playback direction, and • timing function.
- 注記: `KeyframeEffect(target, keyframes, options)$m0 構築子と違って、例外は投出されない — %~source 上に指定されている どの計時~propも妥当と見做せるので。 ◎ Note: Unlike the KeyframeEffect(target, keyframes, options) constructor, we do not need to re-throw exceptions since the timing properties specified on source can be assumed to be valid.
- %source 引数は、新たな`~keyframe効果$を定義する各種~propの複製-元になる`~keyframe効果$を与える。 ◎ KeyframeEffect source • The keyframe effect from which to copy the properties that define the new keyframe effect.
- `target@m ◎ target, of type (Element or CSSPseudoElement), nullable
- 取得子は、此れの`~target要素$を返す。 これは、 ~NULL にもなり得る — 例えば、~audio~APIを利用して音響を生産する~animationなど,特定の要素を~targetにしない~animation。 ◎ The element or pseudo-element being animated by this object. This may be null for animations that do not target a specific element such as an animation that produces a sound using an audio API.
- `iterationComposite@m ◎ iterationComposite, of type IterationCompositeOperation
- 取得子は、此れの`反復~組成-演算~型$に対応する `IterationCompositeOperation$I 列挙~値を返す。 ◎ The iteration composite operation property of this keyframe effect as specified by one of the IterationCompositeOperation enumeration values.
- 設定子は、次を走らす ⇒ 此れの`反復~組成-演算~型$ ~SET 所与の値に対応するそれ ◎ On setting, sets the iteration composite operation property of this animation effect to the provided value.
- `composite@m ◎ composite, of type CompositeOperation
- 取得子は、`効果~stack$と組成するときに利用される,此れの`組成-演算~型$に対応する `CompositeOperation$I 列挙~値を返す。 ◎ The composite operation used to composite this keyframe effect with the effect stack, as specified by one of the CompositeOperation enumeration values.
- 設定子は、次を走らす ⇒ 此れの`組成-演算~型$ ~SET 所与の値に対応するそれ ◎ On setting, sets the composite operation property of this animation effect to the provided value.
- `getKeyframes()@m ◎ sequence<object> getKeyframes()
- 此れを成している一連の~keyframeを返す — それぞれに`算出d~keyframe~offset$を伴わせて。 ◎ Returns the keyframes that make up this effect along with their computed keyframe offsets.
-
参考: この~methodの結果は、次の形式による~objたちが成す連列になる: ◎ This section is non-normative ◎ The result of this method is a sequence of objects of the following format:
dictionary ComputedKeyframe { /* 無数の~propの ( 名前 / 値 ) ~pair: ◎ ... property-value pairs ... i.e. DOMString propertyName DOMString propertyName1; DOMString propertyName2; ... */ double? offset = null; double computedOffset; DOMString easing = "linear"; CompositeOperation? composite = null; };
各~memberの意味と値は、次に従う: ◎ The meaning and values of each member is as follows:
- `offset^c
- この`~keyframe$の`~keyframe~offset$を指定する[ ~NULL または 閉区間 [0, 1] に入る実数 ]になる。 ◎ The keyframe offset of the keyframe specified as a number between 0.0 and 1.0 inclusive, or null.
- これは、隣接する`~keyframe$の間隔が自動的に~~決定される場合には, ~NULL になる。 ◎ This will be null if the keyframe is to be automatically spaced between adjacent keyframes.
- `computedOffset^c
- `欠落~keyframe~offsetを算出する$手続きを走らす一部として,この`~keyframe$用に計算された`算出d~keyframe~offset$になる。 ◎ The computed keyframe offset for this keyframe calculated as part of running the compute missing keyframe offsets procedure.
- `offset^c ~memberと違って, ~NULL になることは決してない。 ◎ Unlike the offset member, the computedOffset is never null.
- `easing^c
- `計時~関数$を与える — [ この~keyframeから次t~keyframeまでの,時刻の進捗 ]を変形するために利用される。 ◎ The timing function used to transform the progress of time from this keyframe until the next keyframe in the series.
- `composite^c
- `~keyframeに特有の組成-演算~型$を与える — この~keyframe内に指定された各~値を`下層~値$と結合するために利用される。 ◎ The keyframe-specific composite operation used to combine the values specified in this keyframe with the underlying value.
- この~memberは、[ `~keyframe効果$に指定された`組成-演算~型$ ]が利用される場合には, ~NULL になる。 ◎ This member will be null if the composite operation specified on the keyframe effect is being used.
`~keyframe$は[ 現在の~WebIDLでは表せない, `partially open-ended^en 辞書~型 【固定的な何個かの~memberに加えて、名前が不定な 不定個の~memberも持つ型】 ]により表現されるので、この~methodの結果を準備するために利用する手続きは,下に与える注釈文にて定義される: ◎ Since keyframes are represented by a partially open-ended dictionary type that is not currently able to be expressed with WebIDL, the procedure used to prepare the result of this method is defined in prose below:
- %結果 ~LET 空~連列 ◎ Let result be an empty sequence of objects.
- %~keyframe~list ~LET `欠落~keyframe~offsetを算出する$( この`~keyframe効果$用の`~keyframe$たち ) ◎ Let keyframes be the result of applying the procedure to compute missing keyframe offsets to the keyframes for this keyframe effect.
-
%~keyframe~list 内の ~EACH( %~keyframe ) に対し: ◎ For each keyframe in keyframes perform the following steps:
-
辞書~obj %出力~keyframe を初期化する — 次の定義を利用して: ◎ Initialize a dictionary object, output keyframe, using the following definition:
dictionary `BaseComputedKeyframe@I { `double$? `offset@m = null; `double$ `computedOffset@m; `DOMString$ `easing@m = "linear"; `CompositeOperation$I? `composite@m = null; };
- %出力~keyframe の ⇒# `offset$m ~member ~SET %~keyframe の`~keyframe~offset$, `computedOffset$m ~member ~SET %~keyframe の`算出d~keyframe~offset$, `easing$m ~member ~SET %~keyframe の~keyframeに特有の`計時~関数$, `composite$m ~member ~SET %~keyframe の`~keyframeに特有の組成-演算~型$ ◎ Set the offset, computedOffset, easing, and composite members of output keyframe to the respective keyframe offset, computed keyframe offset, keyframe-specific timing function, and keyframe-specific composite operation values of keyframe.
-
%~keyframe 内に指定された ~EACH( ~animation~property-value~pair %宣言 ) に対し: ◎ For each animation property-value pair specified on keyframe, declaration, perform the following steps:
- %~prop名 ~LET `~animation~prop名から~IDL属性~名を得る$( %宣言 の~prop名 ) ◎ Let property name be the result of applying the animation property name to IDL attribute name algorithm to the property name of declaration.
- %~IDL値 ~LET `~CSS値を直列化する$( %宣言 ) `CSSOM$r ◎ Let IDL value be the result of serializing the property value of declaration by passing declaration to the algorithm to serialize a CSS value [CSSOM].
- %値 ~LET %~IDL値 を~ES文字列~値に変換した結果 ◎ Let value be the result of converting IDL value to an ECMAScript String value.
- %出力~keyframe 上の `DefineOwnProperty$sl 内部~methodを~callする — 次を渡して ⇒# ~prop名 %~prop名, ~prop記述子 { [[Writable]]: `true^jv, [[Enumerable]]: `true^jv, [[Configurable]]: `true^jv, [[Value]]: %値 }, `Boolean^jc ~flag `false^jv ◎ Call the [[DefineOwnProperty]] internal method on output keyframe with property name property name, Property Descriptor { [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true, [[Value]]: value } and Boolean flag false.
- %結果 に %出力~keyframe を付加する ◎ Append output keyframe to result.
-
- ~RET %結果 ◎ Return result.
- `setKeyframes(keyframes)@m ◎ void setKeyframes(object? keyframes)
- 被呼出時には、此れを成す`~keyframe$の集合を,[ `~keyframes引数の処理-法$secに従って, %keyframes 引数を処理した結果 ]に置換する。 その手続きが例外を投出した場合、この効果の`~keyframe$は改変されない。 ◎ Replaces the set of keyframes that make up this effect. ◎ object? keyframes • A series of keyframes whose format and processing is defined by §6.6.3 Processing a keyframes argument. ◎ This effect’s set of keyframes is replaced with the result of performing the procedure to process a keyframes argument. If that procedure throws an exception, this effect’s keyframes are not modified.
6.6.1. 新たな `KeyframeEffect^I ~objの作成-法
~INFORMATIVE注記: `KeyframeEffect()$m0 構築子は、新たな `KeyframeEffect$I ~objを作成するための,いくつかの~approachを提供する。 ◎ The KeyframeEffect constructor offers a number of approaches to creating new KeyframeEffect objects.
最も単純な場合: ある %elem の `left^p ~propを 3 秒かけて `100px^v へ変化させる `KeyframeEffect$I ~objは、次のようにして構築できる: ◎ At its simplest, a KeyframeEffect object that changes the ‘left’ property of elem to 100px over three seconds can be constructed as follows:
var %effect = new KeyframeEffect(elem, { left: '100px' }, 3000);
~keyframeたちが成す~listを表現している 2 個目の~parameterには、複数の~propたちを指定して~MAY (`~keyframes引数の処理-法$secを見よ。) ◎ The second parameter, representing the list of keyframes, may specify multiple properties. (See §6.6.3 Processing a keyframes argument.)
複数の~propたちを一括して指定する例: ◎ // Specify multiple properties at once
var %effectA = new KeyframeEffect(elem, { left: '100px', top: '300px' }, 3000);
複数の~keyframeを指定する例: ◎ // Specify multiple keyframes
var %effectB = new KeyframeEffect(elem, [ { left: '100px' }, { left: '300px' } ], 3000);
3 個目の~parameterは、~animationの計時を表現する — それには、単純に[ 上のような`反復~所要時間$を表現する ~milli-秒による実数 ]の他にも、次のように `EffectTiming$I 辞書を利用して,`開始-遅延$などの他の計時~propを指定して~MAY: ◎ The third parameter, representing the animation’s timing, may simply be a number representing the iteration duration in milliseconds as above, or, to specify further timing properties such as the start delay, an EffectTiming object can be used, as follows:
var %effect = new KeyframeEffect( %elem, { left: '100px' }, { duration: 3000, delay: 2000 } );
所要時間 `duration^m が指定されなかった場合、値 0 が利用される。 よって,次のように、補間なしに,単純に ある~propを設定する~animationを作成することもアリである: ◎ If the duration is not specified, a value of zero is used. It is possible to create an animation that simply sets a property without any interpolation as follows:
var %effect = new KeyframeEffect( %elem, { visibility: 'hidden' }, { fill: 'forwards' } );
作成した `KeyframeEffect$I は、 `Animation()$m0 に与えた上で,その~animationを `play()^m することにより再生できる。 しかしながら、[ これを自動的に遂行する,単純な[ 効果~用の `Element.animate^c ]]で短絡する方が簡便になる — 例えば: ◎ Having created a KeyframeEffect, it can be played by adding it to an Animation and then playing that animation. For simple effects, however, the Element.animate shortcut is more convenient since it performs these steps automatically. For example,
%elem.animate({ left: '100px' }, 3000);
6.6.2. ~prop名と~IDL名
`~animation~prop名から~IDL属性~名を得る@ ときは、所与の ( 文字列 %~prop名 ) に対し,次を走らす: ◎ The animation property name to IDL attribute name algorithm for property is as follows:
- ~IF[ %~prop名 は `custom-property-name$t 生成規則に合致する ] ⇒ ~RET %~prop名 ◎ If property follows the <custom-property-name> production, return property.
- ~IF[ %~prop名 ~EQ "`float$p" ] ⇒ ~RET `cssFloat^l ◎ If property refers to the CSS float property, return the string "cssFloat".
- ~IF[ %~prop名 ~EQ "`offset$p" ] ⇒ ~RET `cssOffset^l ◎ If property refers to the CSS offset property, return the string "cssOffset".
- ~RET `~CSS~prop名から~IDL属性~名を得る$( %~prop名 ) `CSSOM$r ◎ Otherwise, return the result of applying the CSS property to IDL attribute algorithm [CSSOM] to property.
`~IDL属性~名から~animation~prop名を得る@ ときは、所与の ( 文字列 %属性~名 ) に対し,次を走らす: ◎ The IDL attribute name to animation property name algorithm for attribute is as follows:
- ~IF[ %属性~名 は `custom-property-name$t 生成規則に合致する ] ⇒ ~RET %属性~名 ◎ If attribute conforms to the <custom-property-name> production, return attribute.
- ~IF[ %属性~名 ~EQ `cssFloat^l ] ⇒ ~RET "`float$p" ◎ If attribute is the string "cssFloat", then return an animation property representing the CSS float property.
- ~IF[ %属性~名 ~EQ `cssOffset^l ] ⇒ ~RET "`offset$p" ◎ If attribute is the string "cssOffset", then return an animation property representing the CSS offset property.
- ~RET `~IDL属性~名から~CSS~prop名を得る$( %属性~名 ) `CSSOM$r ◎ Otherwise, return the result of applying the IDL attribute to CSS property algorithm [CSSOM] to attribute.
6.6.3. %keyframes 引数の処理-法
参考: 次のどの~methodも引数として~keyframeの集合を受容する ⇒# `KeyframeEffect()$m0 構築子, `KeyframeEffect$I ~interface上の `setKeyframes()$m1, `Animatable$I ~interface~mixinの `animate()$m1 ◎ This section is non-normative ◎ The following methods all accept a set of keyframes as an argument: • the KeyframeEffect(target, keyframes, options) constructor, • the setKeyframes() method on the KeyframeEffect interface, • the animate() method of the Animatable interface mixin.
この引数は、下に示すような 2 種の形で指定できる。 ◎ This argument may be specified in the one of two forms as illustrated below.
次の 2 つの式は同じ結果を生産する: ◎ // The following two expressions produce the same result:
%elem.animate([ { color: 'blue' }, { color: 'green' }, { color: 'red' }, { color: 'yellow' } ], 2000); %elem.animate({ color: [ 'blue', 'green', 'red', 'yellow' ] }, 2000);
同様に、次の 2 つの[ 複数~propからなる~animation ]用の式も等価になる: ◎ // Likewise, for a multi-property animation, the following two expressions are equivalent:
%elem.animate([ { color: 'blue', left: '0px' }, { color: 'green', left: '-20px' }, { color: 'red', left: '100px' }, { color: 'yellow', left: '50px'} ], 2000); %elem.animate({ color: [ 'blue', 'green', 'red', 'yellow' ], left: [ '0px', '-20px', '100px', '50px' ] }, 2000);
ついでに、次の 3 つの式も互いに等価になる: ◎ // Incidentally, the following three expressions are all equivalent:
%elem.animate([ { color: 'red' } ], 1000); %elem.animate({ color: [ 'red' ] }, 1000); %elem.animate({ color: 'red' }, 1000);
1 種目の形(配列~形)は,~keyframeたちが成す配列からなり、各~keyframeには,各~animation用~propごとに 1 個~以下の値を指定できる。 2 種目の形(~obj形)は、1 個の~objからなり,各~animation用~propには[ 単独の~animation値/~animation値の配列 ]を指定できる。 ◎ The first form (the array-form) consists of an array of keyframes where each keyframe may specify at most one value per animation property. The second form (the object-form) consists of an object where each animation property may specify a single animation value or an array of animation values.
1 種目の配列~形が,正準的な形とされ、 `KeyframeEffect$I の `getKeyframes()$m1 ~methodが返す形である。 ◎ The first array-form is the canonical form and is the form returned by the getKeyframes() method.
`~keyframe~offset$は、下に示すように どちらの形でも指定できる: ◎ Keyframe offsets can be specified using either form as illustrated below:
~offsetを伴わない~keyframeの~offsetは、自動的に算出される — 次の例の[ 1, 3, 5 ]個目の~keyframeは,順に[ 0, 0.65, 1 ]になる: ◎ The keyframes without offsets will automatically have offsets computed as 0 for the first keyframe, 0.65 for the middle keyframe, and 1 for the final keyframe.
%elem.animate([ { color: 'blue' }, { color: 'green', offset: 0.5 }, { color: 'red' }, { color: 'yellow', offset: 0.8 }, { color: 'pink' } ], 2000);
次の例は、上と同じ結果を生産する。 最後の値を指定する必要はないことに注意 — それは自動的に ~NULL と扱われ、前の事例と同じく,自動的にアテがわれることになる。 ◎ The following produces the same result. Note that it is not necessary to specify the last value: it will automatically be treated as 'null' and then the automatic assignment will apply as with the previous case.
%elem.animate({ color: [ 'blue', 'green', 'red', 'yellow', 'pink' ], offset: [ null, 0.5, null, 0.8 ] }, 2000);
同様に[ `計時~関数$ / `~keyframeに特有の組成-演算~型$ ]も,どちらの形で指定されても~MAY。 配列~形では、各`~keyframe$ごとに異なる値を指定することが許容される。 一方で,~obj形では、値の~listは — 各~keyframeに値がアテがわれるまで,必要に応じて — 繰返されることになる。 ◎ Likewise timing functions and keyframe-specific composite operations may be specified in either form. The array-form allows specifying different values for each keyframe whilst for the object-form, the list of values will be repeated as needed until each keyframe has been assigned a value.
計時~関数は,連続する 2 つの~keyframeの合間に適用されるので、最後の~keyframe上に計時~関数を指定しても,無視されることになる。 次の 2 つは、同じ結果を生産する: ◎ // Since timing functions apply _between_ keyframes, even if we specify a a timing function on the last keyframe it will be ignored.
%elem.animate([
{ color: 'blue', easing: 'ease-in' },
{ color: 'green', easing: 'ease-out' },
{ color: 'yellow' }
], 2000);
// The following produces the same result.
%elem.animate({
color: [ 'blue', 'green', 'yellow' ],
easing: [ 'ease-in', 'ease-out' ]
}, 2000);
次のものには、繰返しの挙動により,どの~keyframeにも単純に同じ値がアテがわれる: ◎ // The repeating behavior makes assigning the same value to all keyframes simple:
%elem.animate({ color: [ 'blue', 'green', 'yellow' ], easing: 'ease-in-out' }, 2000);
どちらの形でも、 `easing^c ~propは,~keyframeに特有の計時~関数を設定することに注意。 これは、 `EffectTiming$I ~objを利用して指定された`計時~関数$からは独立になる — 後者の計時~関数は、`~keyframe効果$の`反復~所要時間$全体に適用される。 ◎ Note that the easing property in either form sets the keyframe-specific timing function. This is independent from the timing function that applies to the entire iteration duration of the keyframe effect as specified using a KeyframeEffectOptions object (or KeyframeAnimationOptions object when using the animate() method of the Animatable interface mixin).
次の例の 2 つの文は、異なる結果を生産する: ◎ In the following example, the two statements produce different results.
ここでは、各~色~値の合間に `ease-in-out^v が適用される: ◎ Here, 'ease-in-out' is applied between each color value.
%elem.animate({ color: [ 'blue', 'green', 'yellow' ], easing: 'ease-in-out' }, 2000);
一方,次の事例では、~animation全体にかけて — すなわち、 `blue^v から `yellow^v にかけて — `ease-in-out^v が適用される。 ◎ // However, in this case, 'ease-in-out' is applied across the whole span of the animation, that is from 'blue' to 'yellow'.
%elem.animate( { color: [ 'blue', 'green', 'yellow' ] }, { duration: 2000, easing: 'ease-in-out' } );
%keyframes 引数の型は、 `partially open-ended^en 辞書~型に依拠するので,~WebIDLでは表せない。 ◎ The type of the keyframes argument cannot be expressed in WebIDL since it relies on a partially-open dictionary type.
この引数の型は、概念的には,~WebIDLの “様な” 次の定義に等価になる: ◎ Conceptually, the type of this argument is equivalent to the following WebIDL-like definition:
dictionary Keyframe { /* 無数の~propの ( 名前 / 値 ) ~pair: ◎ ... property-value pairs ... i.e. DOMString propertyName DOMString propertyName1; DOMString propertyName2; ... */ double? offset = null; DOMString easing = "linear"; CompositeOperation? composite = null; }; dictionary PropertyIndexedKeyframes { /* 無数の~propの ( 名前 / 値~list ) ~pair: ◎ ... property-value and property-valuelist pairs ... i.e. (DOMString or sequence<DOMString>) propertyName (DOMString or sequence<DOMString>) propertyName1; (DOMString or sequence<DOMString>) propertyName2; ... */ (double? or sequence<double?>) offset = []; (DOMString or sequence<DOMString>) easing = []; (CompositeOperation? or sequence<CompositeOperation?>) composite = []; }; typedef (sequence<Keyframe> or PropertyIndexedKeyframes) KeyframeArgument;
`KeyframeArgument^I を成す~memberの意味と許容される値は、次のようになる: ◎ The meaning and allowed values of each argument is as follows:
- `offset^m
- 当の`~keyframe$の`~keyframe~offset$を与える — 閉区間 [0, 1] に入る実数, または ~NULL を指定する。 ◎ The keyframe offset of the keyframe specified as a number between 0.0 and 1.0 inclusive or null.
- 値 ~NULL は、隣接する`~keyframe$の間隔を自動的に~~決定するべきであることを指示する。 ◎ A null value indicates that the keyframe should be automatically spaced between adjacent keyframes.
- 閉区間 [0, 1] の外側にある~offsetを指定した場合、 `TypeError^E が投出される。 ◎ Specifying an offset outside the range [0.0, 1.0] will cause a TypeError to be thrown.
- ~offsetを指定している~keyframeは、~offsetの昇順に供され~MUST — 隣接する複数の~keyframeの~offsetは、等しくされていてもよい。 ◎ Keyframes that specify an offset must be provided in increasing order of offset. Adjacent and equal offsets, however, are permitted.
- `easing^m
- `計時~関数$を与える — [ ~keyframeから次t~keyframeまでの,時刻の進捗 ]を変形するときに利用される。 ◎ The timing function used to transform the progress of time from this keyframe until the next keyframe in the series.
- この文字列の構文解析-法に結付けらる構文と~errorの取扱いは、 `EffectTiming$I ~interfaceの `easing$m1 属性~用に定義されるものに一致する。 ◎ The syntax and error-handling associated with parsing this string is identical to that defined for the easing attribute of the EffectTiming interface.
- `composite^m
- `~keyframeに特有の組成-演算~型$を与える — ~keyframe内に指定された各~値を`下層~値$に結合するときに利用される。 ◎ The keyframe-specific composite operation used to combine the values specified in this keyframe with the underlying value.
- ~NULL を与えた場合、当の`~keyframe効果$上に指定された`組成-演算~型$が利用されることになる。 ◎ If null, the composite operation specified on the keyframe effect will be used.
この型は,~WebIDLでは表せないので、その処理は,以下に与える注釈文で定義される。 ◎ Since this type cannot be expressed in WebIDL, its processing is defined in prose following.
%keyframes 引数とる各種~methodは、その引数を入力に`~keyframes引数を処理する$ 手続きを走らせて,その結果を維持する。 ◎ For each method that takes a keyframes argument, the procedure to process a keyframes argument is run on the input and the result of that procedure is retained.
最初に 2 つの~support用の定義を定義する。 ◎ First we define two supporting definitions.
`完了~recordを検査する@ ときは、所与の ( ~ES演算を~callして得られた`完了~record$ %結果 ) に対し,次を走らす: ◎ The instruction, check the completion record of result, where result is a completion record from calling an ECMAScript operation, is equivalent to the following steps:
-
~IF[ %結果 は`中途~完了$である ] ⇒ ~THROW [ %結果 の `value^sl ~fieldが包含する例外 ] ◎ If result is an abrupt completion, throw the exception contained in the [[value]] field of result and abort the procedure.
`type^sl ~IN { `break^jv, `continue^jv, `return^jv } の場合に何をするべきか? ◎ What should we do if the [[type]] is break, continue, or return? Can it be?
- ~RET %結果 の `value^sl ~field値 ◎ Replace result with the value contained in the [[value]] field of result.
`~keyframeに類する~objを処理する@ 手続きは、所与の ( ~ES~obj %~keyframe入力, %~listを許容する~flag ~IN { `~listを許容する^i, ε }(省略時は ε )) に対し,次を走らす — これは、各~prop名を[ %~listを許容する~flag に応じて[ ε ならば `DOMString^I 値 / ~ELSE_ 何個かの `DOMString^I 値が成す連列 ]に対応付ける~mapを返す: ◎ The procedure to process a keyframe-like object, takes two arguments: • an ECMAScript object, keyframe input, and • an allow lists boolean flag ◎ and returns a map from either property names to DOMString values if allow lists is false, or from property names to sequences of DOMString values otherwise, using the following procedure:
-
%型 ~LET %~listを許容する~flag に応じて ⇒# ~T ならば `BasePropertyIndexedKeyframe$I / ~F ならば `BaseKeyframe$I ◎ Run the procedure to convert an ECMAScript value to a dictionary type [WEBIDL] with keyframe input as the ECMAScript value, and the dictionary type depending on the value of the allow lists flag as follows: ◎ If allow lists is true, • Use the following dictionary type:
dictionary `BasePropertyIndexedKeyframe@I { (`double$? or sequence<`double$?>) `offset@m = []; (`DOMString$ or sequence<`DOMString$>) `easing@m = []; (`CompositeOperation$I? or sequence<`CompositeOperation$I?>) `composite@m = []; };
◎ Otherwise, • Use the following dictionary type,
dictionary `BaseKeyframe@I { `double$? `offset@m = null; `DOMString$ `easing@m = "linear"; `CompositeOperation$I? `composite@m = null; };
- %~keyframe出力 ~LET `~ES値から辞書~型に変換する$( %~keyframe入力, %型 ) `WEBIDL$r ◎ Store the result of this procedure as keyframe output.
- %~animate可能な~propたち ~LET 実装が~animate可能な すべての~propに対する[ `~animation~prop名から~IDL属性~名を得る$( その~propの名前 ) ]の結果たちからなる集合 — これらには、下位propに~animate可能なものを含む略式~propも含まれるとする ◎ Build up a list of animatable properties as follows: • Let animatable properties be a list of property names (including shorthand properties that have longhand sub-properties that are animatable) that can be animated by the implementation. • Convert each property name in animatable properties to the equivalent IDL attribute by applying the animation property name to IDL attribute name algorithm.
-
`EnumerableOwnNames$jA( %~keyframe入力 ) の結果を成す ~EACH( %~prop名 ) に対し,~Unicode符号位置に基づく昇順に: ◎ Let input properties be the result of calling the EnumerableOwnNames operation with keyframe input as the object. ◎ Make up a new list animation properties that consists of all of the properties that are in both input properties and animatable properties, or which are in input properties and conform to the <custom-property-name> production. ◎ Sort animation properties in ascending order by the Unicode codepoints that define each property name. ◎ For each property name in animation properties,
- ~IF[ %~prop名 は `custom-property-name$t 生成規則に合致しない ]~AND[ %~prop名 ~NIN %~animate可能な~propたち ] ⇒ ~CONTINUE ◎ ↑
- %生の値 ~LET %~keyframe入力 上で `Get$sl( %~prop名, %~keyframe入力 ) を~callした結果 ◎ Let raw value be the result of calling the [[Get]] internal method on keyframe input, with property name as the property key and keyframe input as the receiver.
- %生の値 ~SET `完了~recordを検査する$( %生の値 ) ◎ Check the completion record of raw value.
-
~IF[ %~listを許容する~flag ~EQ ~T ]: ◎ Convert raw value to a DOMString or sequence of DOMStrings property values as follows: ◎ If allow lists is true,
- %~prop値たち ~LET `(DOMString or sequence<DOMString>)^c 型の`~IDL値に変換する$( %生の値 ) `WEBIDL$r ◎ Let property values be the result of converting raw value to IDL type (DOMString or sequence<DOMString>) using the procedures defined for converting an ECMAScript value to an IDL value [WEBIDL].
- ~IF[ %~prop値たち は `DOMString^I 型である ] ⇒ %~prop値たち ~SET %~prop値たち のみからなる新たな `sequence<DOMString>^c 型の値 ◎ If property values is a single DOMString, replace property values with a sequence of DOMStrings with the original value of property values as the only element.
- ~ELSE ⇒ %~prop値たち ~SET `DOMString^I 型の値に変換する( %生の値 ) `WEBIDL$r ◎ Otherwise, • Let property values be the result of converting raw value to a DOMString using the procedure for converting an ECMAScript value to a DOMString [WEBIDL].
- %正規化-済み~prop名 ~LET `~IDL属性~名から~animation~prop名を得る$( %~prop名 ) ◎ Calculate the normalized property name as the result of applying the IDL attribute name to animation property name algorithm to property name.
- %~keyframe出力[ %正規化-済み~prop名 ] ~SET %~prop値たち ◎ Add a property to to keyframe output with normalized property name as the property name, and property values as the property value.
- ~RET %~keyframe出力 ◎ Return keyframe output.
`~keyframes引数を処理する@ 手続きは、所与の ( ~nullableな~ES~obj %~obj ) に対し, 0 個~以上の`~keyframe$からなる連列を返す: ◎ The procedure to process a keyframes argument takes a nullable ECMAScript object, object, as input and returns a sequence of keyframes using the following procedure:
- ~IF[ %~obj ~EQ ~NULL ] ⇒ ~RET 空~連列 ◎ If object is null, return an empty sequence of keyframes.
- %対象~keyframe~list ~LET 空~連列 ◎ Let processed keyframes be an empty sequence of keyframes.
-
%~method ~LET `完了~recordを検査する$( `GetMethod$jA( %~obj,
@@iterator
) ◎ Let method be the result of GetMethod(object, @@iterator). ◎ Check the completion record of method. -
~IF[ %~method ~NEQ `undefined^jv ]: ◎ Perform the steps corresponding to the first matching condition from below, ◎ If method is not undefined,
- %反復子 ~LET `GetIterator$jA( %~obj, %~method ) ◎ Let iter be GetIterator(object, method).
- %反復子 ~SET `完了~recordを検査する$( %反復子 ) ◎ Check the completion record of iter.
-
~WHILE 無条件: ◎ Repeat:
- %次t ~LET `IteratorStep$jA( %反復子 ) ◎ Let next be IteratorStep(iter).
- %次t ~SET `完了~recordを検査する$( %次t ) ◎ Check the completion record of next.
- ~IF[ %次t ~EQ ~F ] ⇒ ~BREAK ◎ If next is false abort this loop.
- %次t~item ~LET `IteratorValue$jA( %次t ) ◎ Let nextItem be IteratorValue(next).
- %次t~item ~SET `完了~recordを検査する$( %次t~item ) ◎ Check the completion record of nextItem.
- ~IF[ `Type$jA( %次t~item ) ~NIN { `Undefined^jc, `Null^jc, `Object^jc } ] ⇒ ~THROW `TypeError^E ◎ If Type(nextItem) is not Undefined, Null or Object, then throw a TypeError and abort these steps.
- %対象~keyframe~list に次の結果を付加する ⇒ `~keyframeに類する~objを処理する$( %次t~item ) ◎ Append to processed keyframes the result of running the procedure to process a keyframe-like object passing nextItem as the keyframe input and with the allow lists flag set to false.
-
~ELSE: ◎ Otherwise,
- %~keyframe~map ~LET `~keyframeに類する~objを処理する$( %~obj, `~listを許容する^i ) ◎ Let property-indexed keyframe be the result of running the procedure to process a keyframe-like object passing object as the keyframe input and with the allow lists flag set to true.
-
%~keyframe~map を成す ~EACH( %~prop名 → %~prop値たち ) に対し: ◎ For each member, m, in property-indexed keyframe, perform the following steps:
- ~IF[ %~prop名 ~IN { `composite^l, `easing^l, `offset^l } ] ⇒ ~CONTINUE ◎ Let property name be the key for m. ◎ If property name is “composite”, or “easing”, or “offset”, skip the remaining steps in this loop and continue from the next member in property-indexed keyframe after m. ◎ Let property values be the value for m.
- %~prop用の~keyframeたち ~LET 空~連列 ◎ Let property keyframes be an empty sequence of keyframes.
-
%~prop値たち 内の ~EACH( %値 ) に対し: ◎ For each value, v, in property values perform the following steps:
- %~keyframe ~LET 新たな`~keyframe$ ◎ Let k be a new keyframe with a null keyframe offset.
- %~keyframe の`~keyframe~offset$ ~SET ~NULL
- %~keyframe[ %~prop名 ] ~SET %値 ◎ Add the property-value pair, property name → v, to k.
- %~prop用の~keyframeたち に %~keyframe を付加する ◎ Append k to property keyframes.
- `欠落~keyframe~offsetを算出する$( %~prop用の~keyframeたち ) ◎ Apply the procedure to compute missing keyframe offsets to property keyframes.
- %~prop用の~keyframeたち 内の ~EACH( ~keyframe ) に対し ⇒ %対象~keyframe~list に ~keyframe を追加する ◎ Add keyframes in property keyframes to processed keyframes.
- %対象~keyframe~list を,各`~keyframe$の`算出d~keyframe~offset$による昇順に~sortする ◎ Sort processed keyframes by the computed keyframe offset of each keyframe in increasing order.
- %対象~keyframe~list 内の[ `算出d~keyframe~offset$が互いに等しい`~keyframe$たち ]を,一つに併合する ◎ Merge adjacent keyframes in processed keyframes when they have equal computed keyframe offsets.
- %~offsetたち ~LET [ %~keyframe~map の `offset^m ~member値は 連列~型であるならば それ / ~ELSE_( `double?^c 型) それのみからなる連列 ] ◎ Let offsets be a sequence of nullable double values assigned based on the type of the “offset” member of the property-indexed keyframe as follows: ◎ sequence<double?>, • The value of “offset” as-is. ◎ double?, • A sequence of length one with the value of “offset” as its single item, i.e. « offset »,
- ~EACH( %index ~IN { 0 〜 `min^op( %対象~keyframe~list の~size, %~offsetたち の~size ) ~MINUS 1 } ) に対し ⇒ %対象~keyframe~list[ %index ] の`~keyframe~offset$ ~SET %~offsetたち[ %index ] ◎ Assign each value in offsets to the keyframe offset of the keyframe with corresponding position in processed keyframes until the end of either sequence is reached.
- %~easingたち ~LET [ %~keyframe~map の `easing^m ~member値は 連列~型であるならば それ/ ~ELSE_( `DOMString^c 型) それのみからなる連列 ] ◎ Let easings be a sequence of DOMString values assigned based on the type of the “easing” member of the property-indexed keyframe as follows: ◎ sequence<DOMString>, • The value of “easing” as-is. DOMString, • A sequence of length one with the value of “easing” as its single item, i.e. « easing »,
- ~IF[ %~easingたち は空である ] ⇒ %~easingたち ~SET « `linear^l » ◎ If easings is an empty sequence, let it be a sequence of length one containing the single value “linear”, i.e. « "linear" ».
-
~EACH( %index ~IN { 0 〜 %対象~keyframe~list の~size } ~MINUS 1 ) に対し ⇒ %対象~keyframe~list[ %index ][ `easing^l ] ~SET %~easingたち[ %index `mod^op %~easingたち の~size ]
例えば、 %対象~keyframe~list の~sizeは 5 で %~easingたち は連列 « `ease-in^l, `ease-out^l » であった場合、 %~easingたち は繰返されて,順に[ `ease-in^l, `ease-out^l, `ease-in^l, `ease-out^l, `ease-in^l ]があてがわれる。
◎ If easings has fewer items than processed keyframes, repeat the elements in easings successively starting from the beginning of the list until easings has as many items as processed keyframes. ◎ For example, if processed keyframes has five items, and easings is the sequence « "ease-in", "ease-out" », easings would be repeated to become « "ease-in", "ease-out", "ease-in", "ease-out", "ease-in" ». ◎ If easings has more items than processed keyframes, store the excess items as unused easings. ◎ Assign each value in easings to a property named “easing” on the keyframe with the corresponding position in processed keyframes until the end of processed keyframes is reached. - %組成-~modeたち ~LET [ %~keyframe~map の `composite^m ~member値は 連列~型であるならば それ / ~ELSE_ それ(`組成-演算~型$)のみからなる連列 ] ◎ If the “composite” member of the property-indexed keyframe is not an empty sequence: • Let composite modes be a sequence of nullable composite operations assigned from the “composite” member of property-indexed keyframe. If that member is a single nullable composite operation, let composite modes be a sequence of length one, with the value of the “composite” as its single item.
- ~IF[ %組成-~modeたち は空~連列でない ] ⇒ ~EACH( %index ~IN { 0 〜 %対象~keyframe~list の~size } ~MINUS 1 ) に対し ⇒ %対象~keyframe~list[ %index ] の`~keyframeに特有の組成-演算~型$ ~SET %組成-~modeたち[ %index `mod^op %組成-~modeたち の~size ] ◎ • As with easings, if composite modes has fewer items than processed keyframes, repeat the elements in composite modes successively starting from the beginning of the list until composite modes has as many items as processed keyframes. • Assign each non-null value in composite modes to the keyframe-specific composite operation on the keyframe with the corresponding position in processed keyframes until the end of processed keyframes is reached.
- %前の~offset ~LET 負の無限大 ◎ ↓
-
%対象~keyframe~list 内の ~EACH( %~keyframe ) に対し:
- %~offset ~LET %~keyframe の`~keyframe~offset$
- ~IF[ %~offset ~EQ ~NULL ] ⇒ ~CONTINUE
- ~IF[ %~offset ~LT 0 ]~OR[ %~offset ~GT 1 ] ⇒ ~THROW `TypeError^E
- ~IF[ %~offset ~LT %前の~offset ] ⇒ ~THROW `TypeError^E (`~offsetにより~looseに~sortされ$ていない)
- %前の~offset ~SET %~offset
-
%対象~keyframe~list 内の ~EACH( %~keyframe ) に対し: ◎ For each frame in processed keyframes, perform the following steps:
-
%~keyframe 内の ~EACH( %~prop名 → %~prop値 ) に対し: ◎ For each property-value pair in frame,\
- ~IF[ %~prop名 ~IN { `composite^l, `easing^l, `offset^l } ] ⇒ ~CONTINUE
- %~prop名 用の構文を用いて %~prop値 を構文解析する ◎ parse the property value using the syntax specified for that property.
- ~IF[ %~prop値 は %~prop名 が指示する~propの構文に則って妥当でない ] ⇒ %~keyframe[ %~prop名 ] ~SET ε (この~propは破棄する) — ~UAは、内容~内の~errorを診断するための~supportを供するならば,妥当でない %~prop値 を強調するような適切な警告を生産する~SHOULDである。 ◎ If the property value is invalid according to the syntax for the property, discard the property-value pair. User agents that provide support for diagnosing errors in content SHOULD produce an appropriate warning highlighting the invalid property value.
- %計時~関数 ~LET %~keyframe[ `easing^l ] を[ `EffectTiming$I 辞書の `easing$m1 ~member用に定義された~CSS構文 ]に`則って構文解析-$した結果 ◎ Let the timing function of frame be the result of parsing the “easing” property on frame using the CSS syntax defined for the easing member of the EffectTiming dictionary.
- ~IF[ %計時~関数 ~EQ `失敗^i ] ⇒ ~THROW `TypeError^E ◎ If parsing the “easing” property fails, throw a TypeError and abort this procedure.
- %~keyframe の`計時~関数$ ~SET %計時~関数
注記: この段では~CSS構文解析器を利用するので、入力には ~CSS[ ~comment/~escape法 ] も許容されるが,値が成功裡に構文解析されたとしても それらは維持されない。 ◎ Note: Using the CSS parser in both of the above steps implies that CSS comments and escaping are allowed but are not retained when the value is successfully parsed.
注記: `easing^l ~propを構文解析するのに失敗した事例では、 %~objからすべての~propを読取った後に `TypeError^E を投出することが重要になる — そうするのに失敗することは、観測-可能になり,[ ~WebIDLにて,後で `partially open-ended^en 辞書が~supportされた場合の挙動 ]と合致しなくなるので。 【?】 ◎ Note: In the case where the “easing” property fails to parse, it is important that the TypeError is thrown after all reading the properties from object since failing to do so would be observable and will not match the behavior if partially open-ended dictionaries are later supported in WebIDL.
-
-
~IF[ %~method ~EQ `undefined^jv ] ⇒ %~easingたち から最初の[ %対象~keyframe~list の~size ]個の~itemを除去した結果の~listを成す ~EACH( %~easing ) に対し ⇒ ~IF[ %~easing を[ `EffectTiming$I 辞書の `easing$m1 ~member用に定義された~CSS構文 ]に`則って構文解析-$した結果 ~EQ `失敗^i ] ⇒ ~THROW `TypeError^E ◎ Parse each of the values in unused easings using the CSS syntax defined for easing member of the EffectTiming interface, and if any of the values fail to parse, throw a TypeError and abort this procedure.
注記: この最後の段は、次のどの事例でも一貫して `TypeError^E が投出されるよう挙動を供するために要求される: ◎ This final step is required in order to provide consistent behavior such that a TypeError is thrown in all of the following cases:
%elem.animate({ easing: 'invalid' }); %elem.animate({ easing: ['invalid'] }); %elem.animate([{ easing: 'invalid' }]);
6.6.4. `KeyframeEffectOptions^I 辞書
`KeyframeEffect(target, keyframes, options)$m0 構築子に `KeyframeEffectOptions$I ~objを供して追加の~parameterを渡されて~MAY。 ◎ Additional parameters may be passed to the KeyframeEffect(target, keyframes, options) constructor by providing a KeyframeEffectOptions object.
dictionary `KeyframeEffectOptions@I : `EffectTiming$I { `IterationCompositeOperation$I `iterationComposite$m = "replace"; `CompositeOperation$I `composite$m = "replace"; };
- `iterationComposite@m ◎ iterationComposite, of type IterationCompositeOperation, defaulting to "replace"
- `反復~組成-演算~型$を与える。 それは、~animation値を各~反復ごとに築く仕方を定義するために利用される。 ◎ The iteration composite operation used to define the way animation values build from iteration to iteration.
- `composite@m ◎ composite, of type CompositeOperation, defaulting to "replace"
- `組成-演算~型$を `CompositeOperation$I 列挙~値として与える。 この~animationを`効果~stack$と組成するために利用される。 これは、`~keyframe$のうち[ `~keyframeに特有の組成-演算~型$に ~NULL が指定されたもの ]すべてから利用される。 ◎ The composite operation used to composite this animation with the effect stack, as specified by one of the CompositeOperation enumeration values. This is used for all keyframes that specify a null keyframe-specific composite operation.
6.7. `IterationCompositeOperation^I 列挙
`~animation効果$の`反復~組成-演算~型$にアリな値は `IterationCompositeOperation$I 列挙により表現される。 ◎ The possible values of an animation effect’s iteration composite operation are represented by the IterationCompositeOperation enumeration.
enum `IterationCompositeOperation@I { "`replace@m", "`accumulate@m" };
- `replace^l
- `置換-反復~型$の`反復~組成-演算~型$ 値に対応する — 生産される`効果~値$は、`現-反復$に依存しない。 ◎ Corresponds to the replace iteration composite operation value such that the effect value produced is independent of the current iteration.
- `accumulate^l
- `累積-反復~型$の反復~組成-演算~値に対応する — `~animation効果$の後続の反復は、前回の反復による結果の値~上に築かれる。 ◎ Corresponds to the accumulate iteration composite operation value such that subsequent iterations of an animation effect build on the final value of the previous iteration.
6.8. `CompositeOperation^I 列挙
`~animation効果$の組成の挙動にアリな`組成-演算~型$は、 `CompositeOperation$I 列挙により表現される。 ◎ The possible values of an animation effect’s composition behavior are represented by the CompositeOperation enumeration.
enum `CompositeOperation@I { "`replace@m", "`add@m", "`accumulate@m" };
- `replace^l
- `置換-型$に対応する — `~animation効果$は、その`下層~値$を上書きするように結合される。 ◎ Corresponds to the replace composite operation value such that the animation effect overrides the underlying value it is combined with.
- `add^l
- `加算-型$に対応する — `~animation効果$は、その`下層~値$に`加算-$するように結合される。 ◎ Corresponds to the add composite operation value such that the animation effect is added to the underlying value with which it is combined.
- `accumulate^l ◎ accumulate
- `累積-型$に対応する — `~animation効果$は、その`下層~値$に`累積-$するように結合される。 ◎ Corresponds to the accumulate composite operation value such that the animation effect is accumulated on to the underlying value.
6.9. `Animatable^I ~interface~mixin
`~animation効果$( `KeyframeEffect$I ~obj)の`~target要素$になり得る~objは、 `Animatable$I ~interface~mixinを実装する。 ◎ Objects that may be the target of an KeyframeEffect object implement the Animatable interface mixin.
interface mixin `Animatable@I { `Animation$I `animate$m( `object$? %keyframes, optional (`unrestricted double$ or `KeyframeAnimationOptions$I) %options ); sequence<`Animation$I> `getAnimations$m(); }; dictionary `KeyframeAnimationOptions@I : `KeyframeEffectOptions$I { `DOMString$ `id$m = ""; };
- `animate(keyframes, options)@m ◎ Animation animate(keyframes, options)
-
被呼出時には、次を走らす: ◎ Performs the following steps:
- %~Realm ~LET 此れに`関連する~Realm$ ◎ ↓
- %効果 ~LET %~Realm 内で次を走らせて構築される,新たな `KeyframeEffect$I ~obj(例外が投出され得る) ⇒ `KeyframeEffect()$m0 構築子と同じ手続き( 此れ, %keyframes, %options ) ◎ Let target be the object on which this method was called. ◎ Construct a new KeyframeEffect object, effect, in the relevant Realm of target by using the same procedure as the KeyframeEffect(target, keyframes, options) constructor, passing target as the target argument, and the keyframes and options arguments as supplied. ◎ If the above procedure causes an exception to be thrown, propagate the exception and abort this procedure.
- %~animation ~LET %~Realm 内で次を走らせて構築される,新たな `Animation$I ~obj ⇒ `Animation()$m0 構築子と同じ手続き( %効果, 此れの`~node文書$の`既定の文書~時列線$ ) ◎ Construct a new Animation object, animation, in the relevant Realm of target by using the same procedure as the Animation() constructor, passing effect as the argument of the same name, and the default document timeline of the node document of the element on which this method was called as the timeline argument.
- %~animation の `id$m1 属性 ~SET %options の `id^m ~member値 ◎ Assign the value of the id member of options to animation’s id attribute.
- `~animationを再生する$( %~animation, `自動巻戻しあり^i ) ◎ Run the procedure to play an animation for animation with the auto-rewind flag set to true.
- ~RET %~animation ◎ Return animation.
-
参考: 次の~code片は: ◎ This section is non-normative ◎ The following code fragment:
var %animation = %elem.animate({ opacity: 0 }, 2000);
概ね,次に等価になる: ◎ is roughly equivalent to:
var %effect = new KeyframeEffect(elem, { opacity: 0 }, 2000); var %animation = new Animation(effect, elem.ownerDocument.timeline); animation.play();
- %keyframes 引数は、利用する`~keyframe$を与える。 %options 引数は、作成される `KeyframeEffect$I 用の各種[ 計時/~animation ]~optionを与える。 ◎ keyframes • The keyframes to use. This value is passed to the KeyframeEffect(target, keyframes, options) constructor as the keyframes parameter and has the same interpretation as defined for that constructor. ◎ options • The timing and animation options for the created KeyframeEffect. This value is passed to the KeyframeEffect(target, keyframes, options) constructor as the options parameter and has the same interpretation as defined for that constructor.
- `getAnimations()@m ◎ sequence<Animation> getAnimations()
- 此れを`~target要素$とする `Animation$I ~objのうち,その`~target効果$は[ `事前~相$i/`再生-中$i/`効果~中$i ]にあるものからなる~listを返す。 ◎ Returns the set of Animation objects whose target effect is current or in effect and contains at least one animation effect whose target element is this object.
- 返される~listは、それらの効果が~targetにしている此れ上の各~propの`効果~stack$にて述べた`組成-順序$を利用して~sortされる。 ◎ The returned list is sorted using the composite order described for the associated animations of effects in §5.5.2 The effect stack.
- 返される~listは、まだ処理-待ちにある ~animationに対する変更 — ~animationに関係する~style~prop【各種 `animation-*^p, `transition-*^p など】に対する変更など — があれば,それらを適用した後の状態を反映する。 ◎ The returned list reflects the state after applying any pending changes to animation such as changes to animation-related style properties that have yet to be processed.
`KeyframeAnimationOptions$I 上の `id@m1 ~memberは、生成される `Animation$I の `id$m1 属性にアテがう文字列を与える。 ◎ id, of type DOMString, defaulting to "" • The string to assign to the generated Animation's id attribute.
6.10. `Document^I ~interfaceに対する拡張
`DOM$r に定義される `Document$I には、次の拡張が加えられる。 ◎ The following extensions are made to the Document interface defined in [DOM].
partial interface `Document$I0 { readonly attribute `DocumentTimeline$I `timeline$m; sequence<`Animation$I> `getAnimations$m(); };
- `timeline@m ◎ timeline, of type DocumentTimeline, readonly
- 取得子は、此れの`既定の文書~時列線$を表現している `DocumentTimeline$I ~objを返す。 ◎ The DocumentTimeline object representing the default document timeline.
- `getAnimations()@m ◎ sequence<Animation> getAnimations()
- 被呼出時には、 `Animation$I ~objのうち,その`~target効果$は次を満たすものからなる集合を返す ⇒ [[ `事前~相$i / `再生-中$i / `効果~中$i ]にある ]~AND[ `~target要素$は此れの`子孫$である ] ◎ Returns the set of Animation objects that have an associated target effect which is current or in effect and whose target element is a descendant of the document.
- 返される~listは、それらの効果が~targetにしている要素~上の各~propの`効果~stack$にて述べた`組成-順序$を利用して~sortされる。 ◎ The returned list is sorted using the composite order described for the associated animations of effects in §5.5.2 The effect stack.
- 返される~listは、まだ処理-待ちにある ~animationに対する変更 — ~animationに関係する~style~prop【各種 `animation-*^p, `transition-*^p など】に対する変更など — があれば,それらを適用した後の状態を反映する。 ◎ The returned list reflects the state after applying any pending changes to animation such as changes to animation-related style properties that have yet to be processed.
- [ この~method, `Animatable$I ~interface~mixin上の `getAnimations()$m1 ]の両者とも,前方へ延伸する[ `~animation効果$, それらの`~animation$ ]を維持することを要求するので、前方へ延伸する~animationを何度も生産する文書は,際限なく記憶域を消費することになる。 この定義は、改訂するか(以前までは、これらの~methodは、~animationのうち,`~target効果$が[ `事前~相$iか`再生-中$i ]にあるものしか返さなかった),[ そのような条件の下では、古い~animationを破棄するような,実装~用の抜け道を供する ]必要があろう。 `2054$issue ◎ Both this method and getAnimations() on the Animatable interface mixin require retaining forwards-filling animation effects and their animations such that a document that repeatedly produces forwards-filling animations will consume memory in an unbounded fashion. We may need to revise this definition (previously these methods only returned animations whose target effect was current) or provide a loophole for implementations to discard old animations in such conditions. <https://github.com/w3c/csswg-drafts/issues/2054>
6.11. `Element^I ~interfaceに対する拡張
`Element$I `DOM$r は、~animationの~targetになり得るので、その~interfaceは,次のように拡張される: ◎ Since DOM Elements may be the target of an animation, the Element interface [DOM] is extended as follows:
`Element$I includes `Animatable$I;
これは、次の類の用法を許容する。 ◎ This allows the following kind of usage.
%elem.animate({ color: 'red' }, 2000);
6.12. `CSSPseudoElement^I ~interfaceに対する拡張
疑似要素も`~keyframe効果$の~targetになり得るので、 `CSSPseudoElement$I ~interface `css-pseudo-4$r も~animate可能であるものと定義される: ◎ Since keyframe effects may also target pseudo-elements, the CSSPseudoElement interface [css-pseudo-4] is also defined to be animatable.
`CSSPseudoElement$I includes `Animatable$I;
6.13. `AnimationPlaybackEvent^I ~interface
`~animation再生~event$は、 `AnimationPlaybackEvent$I ~interfaceを利用して表現される。 ◎ Animation playback events are represented using the AnimationPlaybackEvent interface.
[`Exposed$=Window, `AnimationPlaybackEvent$mC(`DOMString$ %type, optional `AnimationPlaybackEventInit$I %eventInitDict)] interface `AnimationPlaybackEvent@I : `Event$I { readonly attribute `double$? `currentTime$m; readonly attribute `double$? `timelineTime$m; }; dictionary `AnimationPlaybackEventInit@I : `EventInit$I { `double$? `currentTime@m = null; `double$? `timelineTime@m = null; };
- `AnimationPlaybackEvent(type, eventInitDict)@m ◎ AnimationPlaybackEvent(type, eventInitDict)
- 被呼出時には、次を走らす: `~eventを構築する$手続きを利用して 新たな `AnimationPlaybackEvent$I ~objを 構築する `DOM$r 。 ◎ Constructs a new AnimationPlaybackEvent object using the procedure defined for constructing events [DOM].
- `currentTime@m ◎ currentTime, of type double, readonly, nullable
- 取得子は、この~eventを生成した`~animation$の[ ~eventが~queueされた~momentにおける,`現-時刻$ ]を返す。 これは、~eventが生成された時点で`~animation$は`遊休中$iであった場合には ~NULL になる。 ◎ The current time of the animation that generated the event at the moment the event as queued. This will be null if the animation was idle at the time the event was generated.
- `timelineTime@m ◎ timelineTime, of type double, readonly, nullable
- 取得子は、この~eventを生成した`~animation$の[ ~eventが~queueされた~momentにおける,`時列線~現-時刻$ ]を返す。 ◎ The time value of the timeline with which the animation that generated the event is associated at the moment the event was queued. This will be null if the animation was not associated with an active timeline at the time the event was queued. ◎
◎ 訳は省略: currentTime, of type double, nullable, defaulting to null • See the description of the currentTime attribute. ◎ timelineTime, of type double, nullable, defaulting to null • See the description of the timelineTime attribute.
6.14. ~modelの~live性
~modelのどこかに加えられた変更は、`計時~model$sec全体, および依存する~styleを更新させる。 ◎ Changes made to any part of the model, cause the entire timing model to be updated and any dependent style.
参考: 上の要件, および この仕様~内の他所にある規範的な要件に基づいて,以下に挙げる不変則を観測できる: ◎ This section is non-normative ◎ Based on the above requirement and normative requirements elsewhere in this specification, the following invariants can be observed:
- ~WAnim~modelに加えられた変更は、即時に効果を及ぼす。 ◎ Changes made to the Web Animations model take effect immediately
- 例えば,ある `Animation$I %~animation に結付けらている `KeyframeEffect$I が,~APIを介して~seekされた場合(`~animationの現-時刻の設定-法$secを見よ)、 %~animation の `startTime$m1 を照会したとき返される値は,~modelにて更新された状態を即時に反映することになる。 ◎ For example, if the KeyframeEffect associated with an Animation is seeked (see §4.4.5 Setting the current time of an animation) via the programming interface, the value returned when querying the animation’s startTime will reflect updated state of the model immediately.
-
/* 初期~時には
%animation.effect.getComputedTiming().localTime
~EQ 3000 とする。 ◎ Initially animation.effect.getComputedTiming().localTime is 3000 */ %animation.currentTime += 2000; alert(%animation.effect.getComputedTiming().localTime); /* 5000 が表示される ◎ Displays ‘5000’ */ - ~animationにより影響される~propの算出d~styleを照会したときは、~animationの最新の状態が返される。 ◎ Querying the computed style of a property affected by animation returns the fully up-to-date state of the animation
- 例えば、ある要素に新たな `Animation$I を適用した直後に,要素の使用~styleを照会した場合、返される値には,新たな~animationの結果が組入れられることになる。 ◎ For example, if the used style of an element is queried immediately after applying a new Animation to that element, the result of the new animation will be incorporated in the value returned.
-
/* 即時に 不透明度を 0 に設定する ◎ Set opacity to 0 immediately */ %elem.animate({ opacity: 0 }, { fill: 'forwards' }); alert(window.getComputedStyle(elem).opacity); /* 0 が表示される ◎ Displays ‘0’ */
- 同じ~taskの中で加えられた各~変更は、それらによる変化が~~同時に具現化されるように同期される。 ◎ Changes made within the same task are synchronized such that the whole set of changes is rendered together
- ~modelに対する変更の結果は、 — ~ESの `run-to-completion^en 意味論と組合されて — 即時に効果を及ぼす。 例えば、指定した~styleに対する変更のみが,~animationを適用することなく具現化される状況は、決して生じるべきでない。 ◎ As a result of changes to the model taking effect immediately combined with ECMAScript’s run-to-completion semantics, there should never be a situation where, for example, only the changes to specified style are rendered without applying animation.
-
`Element.animate^c を~supportしない ~browser用の~fallbackで,不透明度を~fadeする: ◎ // Fade the opacity with fallback for browsers that don’t support Element.animate
%elem.style.opacity = '0'; %elem.animate([ { opacity: 1 }, { opacity: 0 } ], 500);
- 注記: しかしながら,上の例で、~UAは,上の変更のどれも適用されない ~frameを具現化しても~MAY。 これは例えば、別々の~process内で描画が生じていて,それは[ 上の~taskが完了してすぐ後, かつ変更を~processに通信できる前 ]に走るよう~scheduleされている場合に起こるかもしれない。 ◎ Note, however, that in the example above, a user agent may render a frame with none of the above changes applied. This might happen, for example, if rendering occurs in a separate process that is scheduled to run shortly after the above task completes but before the changes can be communicated to the process.
- `文書~時列線$の `currentTime^m 属性が返す値は、~taskの中では変化しない。 ◎ The value returned by the currentTime attribute of a document timeline will not change within a task
- `~animationを更新して~eventを送信する$手続きが走る各~回に,`時列線$の`現-時刻$tLを更新するとする要件に因り、[ 同じ~script~block内で実行される長い~codeが成す~block ]の中で 2 度にわたり `currentTime^m を照会して返される値は同じになる — 次の例に示すように: ◎ Due to the requirement on timelines to update their current time each time the update animations and send events procedure is run, querying the currentTime twice within a long block of code that is executed in the same script block will return the same value as shown in the following example.
-
var %a = document.timeline.currentTime; /* ... 多数の行からなる~code ... ◎ ... many lines of code ... */ var %b = document.timeline.currentTime; alert(%b - %a); /* 0 を表示する ◎ Displays 0 */
`requestAnimationFrame()$m ~callbackに渡される時刻は、 `document.timeline.currentTime^c に等しくなる ◎ The time passed to a requestAnimationFrame callback will be equal to document.timeline.currentTime
- ~HTMLの~event~loop処理~modelは、`~animation~frame~callbackたちを走らす$より先に,`~animationを更新して~eventを送信する$ものと定義されていることに加え、そのような~callbackには,両~手続きに渡される時刻印 %今 と同じ時刻が渡されるので、`既定の文書~時列線$の`現-時刻$tLは, `requestAnimationFrame()$m に渡される時刻に合致するべきである。 ◎ Since HTML’s event loop processing model defines that the procedure to update animations and send events is performed prior to running animation frame callbacks, and since the time passed to such callbacks is the same now timestamp is passed to both procedures, the current time of a the default document timeline should match the time passed to requestAnimationFrame.
-
window.requestAnimationFrame(function(now) { /* 0 を表示する ◎ Displays 0 */ alert(now - document.timeline.currentTime); });