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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