KeyframeEffect Class
An animation effect that animates the properties of an element with keyframes (https://drafts.csswg.org/web-animations-1/#keyframe-effects).
public class KeyframeEffect : AnimationEffect- Inheritance
AnimationEffectKeyframeEffect
Constructors
| Name | Description |
|---|---|
| KeyframeEffect(KeyframeEffect) | Creates a copy of a keyframe effect (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-keyframeeffect-source). |
| KeyframeEffect(Element?, IEnumerable<Keyframe>?, KeyframeEffectOptions?) | Creates a keyframe effect (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-keyframeeffect). |
| KeyframeEffect(Element?, IEnumerable<Keyframe>?, double) | Creates a keyframe effect whose duration is duration milliseconds (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-keyframeeffect). |
KeyframeEffect overloads
KeyframeEffect(KeyframeEffect)
KeyframeEffect.csCreates a copy of a keyframe effect (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-keyframeeffect-source).
public KeyframeEffect(KeyframeEffect source)KeyframeEffect(Element?, IEnumerable<Keyframe>?, KeyframeEffectOptions?)
KeyframeEffect.csCreates a keyframe effect (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-keyframeeffect).
public KeyframeEffect(Element? target, IEnumerable<Keyframe>? keyframes, KeyframeEffectOptions? options = null)Parameters
targetElement?keyframesIEnumerable<Keyframe>?optionsKeyframeEffectOptions?
Exceptions
TypeErrorException- The keyframes or the timing properties are invalid.
DomException- The pseudo-element is invalid (SyntaxError).
See also
KeyframeEffect(Element?, IEnumerable<Keyframe>?, double)
KeyframeEffect.csCreates a keyframe effect whose duration is duration milliseconds (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-keyframeeffect).
public KeyframeEffect(Element? target, IEnumerable<Keyframe>? keyframes, double duration)Parameters
targetElement?keyframesIEnumerable<Keyframe>?durationdouble
Exceptions
TypeErrorException- The keyframes or the duration are invalid.
See also
Properties
| Name | Description |
|---|---|
| Composite | Gets or sets the composite operation of the effect (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-composite). |
| IterationComposite | Gets or sets the iteration composite operation of the effect (https://drafts.csswg.org/web-animations-2/#dom-keyframeeffect-iterationcomposite). |
| PseudoElement | Gets or sets the pseudo-element targeted by the effect, or null to target the element (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-pseudoelement). |
| Target | Gets or sets the element targeted by the effect (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-target). |
Composite
KeyframeEffect.csGets or sets the composite operation of the effect (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-composite).
public CompositeOperation Composite { get; set; }IterationComposite
KeyframeEffect.csGets or sets the iteration composite operation of the effect (https://drafts.csswg.org/web-animations-2/#dom-keyframeeffect-iterationcomposite).
public IterationCompositeOperation IterationComposite { get; set; }PseudoElement
KeyframeEffect.csGets or sets the pseudo-element targeted by the effect, or null to target the element (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-pseudoelement).
public string? PseudoElement { get; set; }Target
KeyframeEffect.csGets or sets the element targeted by the effect (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-target).
public Element? Target { get; set; }Methods
| Name | Description |
|---|---|
| GetKeyframes() | Returns the keyframes of the effect (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-getkeyframes). |
| SetKeyframes(IEnumerable<Keyframe>?) | Replaces the keyframes of the effect (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-setkeyframes). |
GetKeyframes()
KeyframeEffect.csReturns the keyframes of the effect (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-getkeyframes).
public IReadOnlyList<ComputedKeyframe> GetKeyframes()SetKeyframes(IEnumerable<Keyframe>?)
KeyframeEffect.csReplaces the keyframes of the effect (https://drafts.csswg.org/web-animations-1/#dom-keyframeeffect-setkeyframes).
public void SetKeyframes(IEnumerable<Keyframe>? keyframes)Parameters
keyframesIEnumerable<Keyframe>?
Exceptions
TypeErrorException- The keyframes are invalid.