2021-12-08 22:43:31 +01:00
|
|
|
import selector from '../util/selector';
|
|
|
|
import TweenCollection from '../tween/tweenCollection';
|
2021-03-30 11:23:29 +02:00
|
|
|
|
2021-12-08 22:43:31 +01:00
|
|
|
/**
|
|
|
|
* The `KUTE.allFromTo()` static method creates a new Tween object
|
|
|
|
* for multiple `HTMLElement`s, `HTMLCollection` or `NodeListat`
|
|
|
|
* at a given state.
|
|
|
|
*
|
|
|
|
* @param {Element[] | HTMLCollection | NodeList} elements target elements
|
|
|
|
* @param {KUTE.tweenProps} startObject
|
|
|
|
* @param {KUTE.tweenProps} endObject
|
|
|
|
* @param {KUTE.tweenOptions} optionsObj tween options
|
|
|
|
* @returns {TweenCollection} the Tween object collection
|
|
|
|
*/
|
2021-03-30 11:23:29 +02:00
|
|
|
export default function allFromTo(elements, startObject, endObject, optionsObj) {
|
|
|
|
const options = optionsObj || {};
|
|
|
|
return new TweenCollection(selector(elements, true), startObject, endObject, options);
|
|
|
|
}
|