KeyframeKit / convertStyleSheetKeyframes
Function convertStyleSheetKeyframes()
ts
function convertStyleSheetKeyframes(obj: {
in: CSSStyleSheetSource;
of: string;
}): ConvertedKeyframes | undefined;Converts a CSS keyframes rule from a stylesheet (or stylesheet list) into Web Animations API keyframes.
Parameters
obj
in
The stylesheet or stylesheet list where the rule resides.
of
string
The name of the @keyframes rule to get keyframes from.
Returns
ConvertedKeyframes | undefined
Throws
TypeError- Thrown if keyframes rule name is not a string.
TypeError- Thrown if source is not a
CSSStyleSheetor aStyleSheetList.
- Thrown if source is not a
SecurityError- Thrown if source is a
CSSStyleSheetwhose rules can't be read (e.g. a cross-origin stylesheet loaded without CORS).
- Thrown if source is a
Remarks
- If multiple rules have the name, the last one is used, like in CSS.
- When searching a
StyleSheetList, stylesheets whose rules can't be read are skipped. - Only top-level rules are read:
@keyframesrules nested in other rules (e.g.@media,@supportsor@layer) aren't found.