KeyframeKit / KeyframesFactory
Interface: KeyframesFactory
Properties
Error
readonly Error: {
KeyframesRuleNameTypeError: typeof KeyframesRuleNameTypeError;
SourceTypeError: typeof SourceTypeError;
StyleSheetImportError: typeof StyleSheetImportError;
};KeyframesRuleNameTypeError
readonly KeyframesRuleNameTypeError: typeof KeyframesRuleNameTypeError;Thrown if keyframes rule name is not a string.
SourceTypeError
readonly SourceTypeError: typeof SourceTypeError;Thrown if source is not a CSSStyleSheet or a StyleSheetList.
StyleSheetImportError
readonly StyleSheetImportError: typeof StyleSheetImportError;Thrown if the stylesheet could not be imported.
Methods
getAllStyleSheetKeyframesRules()
getAllStyleSheetKeyframesRules(obj: {
in: CSSStyleSheetSource;
}): ParsedKeyframesRules;Gets all the CSS keyframes rules in a stylesheet or stylesheet list, then converts them to Web Animations API keyframes.
Parameters
obj
in
The style sheet or style sheet list to get keyframes from.
Returns
getDocumentStyleSheetsOnLoad()
getDocumentStyleSheetsOnLoad(obj?: {
document?: Document;
}): Promise<StyleSheetList>;Gets a document's stylesheets when it loads, or immediately returns them if it's already loaded.
Parameters
obj?
document?
Document = window.document
The document to get stylesheets from.
Returns
getStyleSheetKeyframes()
getStyleSheetKeyframes(obj: {
in: CSSStyleSheetSource;
of: string;
}): ParsedKeyframes | undefined;Gets a CSS keyframes rule from a stylesheet or stylesheet list, then converts it to 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
ParsedKeyframes | undefined
importStyleSheet()
importStyleSheet(url: string): Promise<CSSStyleSheet>;Imports a stylesheet from a URL.
Parameters
url
string
The URL of the stylesheet to import.
Returns
Remarks
Note: @import rules won't be resolved in imported stylesheets.
See https://github.com/WICG/construct-stylesheets/issues/119#issuecomment-588352418.
parseKeyframesRule()
parseKeyframesRule(obj: {
rule: CSSKeyframesRule;
}): ParsedKeyframes;Converts a CSS keyframes rule to Web Animations API keyframes.
Parameters
obj
rule
The rule to convert.