Skip to content

Commit 73a0b54

Browse files
committed
Upfront resolution of animation options
1 parent d1bd994 commit 73a0b54

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/core/core.animations.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {isObject} from '../helpers/helpers.core';
55

66
const numbers = ['x', 'y', 'borderWidth', 'radius', 'tension'];
77
const colors = ['borderColor', 'backgroundColor'];
8+
const animationOptions = ['duration', 'easing', 'from', 'to', 'type', 'easing', 'loop', 'fn'];
89

910
defaults.set('animation', {
1011
// Plain properties can be overridden in each object
@@ -79,9 +80,14 @@ export default class Animations {
7980
if (!isObject(cfg)) {
8081
return;
8182
}
83+
const resolved = {};
84+
for (const option of animationOptions) {
85+
resolved[option] = cfg[option];
86+
}
87+
8288
(cfg.properties || [key]).forEach((prop) => {
8389
if (prop === key || !animatedProps.has(prop)) {
84-
animatedProps.set(prop, cfg);
90+
animatedProps.set(prop, resolved);
8591
}
8692
});
8793
});

src/core/core.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ export default class Config {
219219
* @param {object[]} scopes
220220
* @param {string[]} names
221221
* @param {function|object} context
222+
* @param {string[]} [prefixes]
223+
* @return {object}
222224
*/
223225
resolveNamedOptions(scopes, names, context, prefixes = ['']) {
224226
const result = {};

0 commit comments

Comments
 (0)