UNPKG

just-animate

Version:
30 lines (29 loc) 953 B
import { plugins } from '../core/plugins'; import { includes, list } from '../utils/lists'; import { _ } from '../utils/constants'; import { insert } from './insert'; export const set = (model, options, ctx) => { const pluginNames = Object.keys(plugins); const opts2 = list(options).map(opts => { const at = opts.at || model.cursor; const opt2 = {}; for (var name in opts) { if (includes(pluginNames, name)) { const props = opts[name]; const props2 = {}; for (var propName in props) { var value = props[propName]; props2[propName] = [_, value]; } opt2[name] = props2; } else { opt2[name] = opts[name]; } } opt2.from = at - 0.000000001; opt2.to = at; return opt2; }); insert(model, opts2, ctx); };