package.esm2022.browser.src.dsl.animation.mjs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of animations Show documentation
Show all versions of animations Show documentation
Angular - animations integration with web-animations
import { buildingFailed, validationFailed } from '../error_helpers';
import { ENTER_CLASSNAME, LEAVE_CLASSNAME, normalizeStyles } from '../util';
import { warnValidation } from '../warning_helpers';
import { buildAnimationAst } from './animation_ast_builder';
import { buildAnimationTimelines } from './animation_timeline_builder';
import { ElementInstructionMap } from './element_instruction_map';
export class Animation {
constructor(_driver, input) {
this._driver = _driver;
const errors = [];
const warnings = [];
const ast = buildAnimationAst(_driver, input, errors, warnings);
if (errors.length) {
throw validationFailed(errors);
}
if (warnings.length) {
warnValidation(warnings);
}
this._animationAst = ast;
}
buildTimelines(element, startingStyles, destinationStyles, options, subInstructions) {
const start = Array.isArray(startingStyles)
? normalizeStyles(startingStyles)
: startingStyles;
const dest = Array.isArray(destinationStyles)
? normalizeStyles(destinationStyles)
: destinationStyles;
const errors = [];
subInstructions = subInstructions || new ElementInstructionMap();
const result = buildAnimationTimelines(this._driver, element, this._animationAst, ENTER_CLASSNAME, LEAVE_CLASSNAME, start, dest, options, subInstructions, errors);
if (errors.length) {
throw buildingFailed(errors);
}
return result;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5pbWF0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYW5pbWF0aW9ucy9icm93c2VyL3NyYy9kc2wvYW5pbWF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWNBLE9BQU8sRUFBQyxjQUFjLEVBQUUsZ0JBQWdCLEVBQUMsTUFBTSxrQkFBa0IsQ0FBQztBQUVsRSxPQUFPLEVBQUMsZUFBZSxFQUFFLGVBQWUsRUFBRSxlQUFlLEVBQUMsTUFBTSxTQUFTLENBQUM7Q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