{"version":3,"file":"scene.min.js","sources":["../src/easing.ts","../src/consts.ts","../src/EventTrigger.ts","../src/PropertyObject.ts","../src/utils/property.ts","../src/utils.ts","../src/Animator.ts","../src/Frame.ts","../src/utils/dot.ts","../src/SceneItem.ts","../src/Scene.ts","../src/presets.ts","../src/index.umd.ts"],"sourcesContent":["import { EasingFunction } from \"./types\";\n\nfunction cubic(y1: number, y2: number, t: number) {\n const t2 = 1 - t;\n\n // Bezier Curve Formula\n return t * t * t + 3 * t * t * t2 * y2 + 3 * t * t2 * t2 * y1;\n}\nfunction solveFromX(x1: number, x2: number, x: number) {\n // x 0 ~ 1\n // t 0 ~ 1\n let t = x;\n let solveX = x;\n let dx = 1;\n\n while (Math.abs(dx) > 1 / 1000) {\n // 예상 t초에 의한 _x값\n solveX = cubic(x1, x2, t);\n dx = solveX - x;\n // 차이가 미세하면 그 값을 t로 지정\n if (Math.abs(dx) < 1 / 1000) {\n return t;\n }\n t -= dx / 2;\n }\n return t;\n}\n/**\n * @namespace easing\n */\n/**\n* Cubic Bezier curve.\n* @memberof easing\n* @func bezier\n* @param {number} [x1] - point1's x\n* @param {number} [y1] - point1's y\n* @param {number} [x2] - point2's x\n* @param {number} [y2] - point2's y\n* @return {function} the curve function\n* @example\nimport {bezier} from \"scenejs\";\nScene.bezier(0, 0, 1, 1) // LINEAR\nScene.bezier(0.25, 0.1, 0.25, 1) // EASE\n*/\nexport function bezier(x1: number, y1: number, x2: number, y2: number) {\n /*\n\t\tx = f(t)\n\t\tcalculate inverse function by x\n\t\tt = f-1(x)\n\t*/\n const func: EasingFunction = (x: number) => {\n const t = solveFromX(x1, x2, Math.max(Math.min(1, x), 0));\n\n return cubic(y1, y2, t);\n };\n\n func.easingName = `cubic-bezier(${x1},${y1},${x2},${y2})`;\n return func;\n}\n/**\n* Specifies a stepping function\n* @see {@link https://www.w3schools.com/cssref/css3_pr_animation-timing-function.asp|CSS3 Timing Function}\n* @memberof easing\n* @func steps\n* @param {number} count - point1's x\n* @param {\"start\" | \"end\"} postion - point1's y\n* @return {function} the curve function\n* @example\nimport {steps} from \"scenejs\";\nScene.steps(1, \"start\") // Scene.STEP_START\nScene.steps(1, \"end\") // Scene.STEP_END\n*/\nexport function steps(count: number, position: \"start\" | \"end\") {\n const func: EasingFunction = (time: number) => {\n const level = 1 / count;\n\n if (time >= 1) {\n return 1;\n }\n return (position === \"start\" ? level : 0) + Math.floor(time / level) * level;\n };\n\n func.easingName = `steps(${count}, ${position})`;\n\n return func;\n}\n\n/**\n* Equivalent to steps(1, start)\n* @memberof easing\n* @name STEP_START\n* @static\n* @type {function}\n* @example\nimport {STEP_START} from \"scenejs\";\nScene.STEP_START // steps(1, start)\n*/\nexport const STEP_START = /*#__PURE__#*/steps(1, \"start\");\n/**\n* Equivalent to steps(1, end)\n* @memberof easing\n* @name STEP_END\n* @static\n* @type {function}\n* @example\nimport {STEP_END} from \"scenejs\";\nScene.STEP_END // steps(1, end)\n*/\nexport const STEP_END = /*#__PURE__#*/steps(1, \"end\");\n/**\n* Linear Speed (0, 0, 1, 1)\n* @memberof easing\n* @name LINEAR\n* @static\n* @type {function}\n* @example\nimport {LINEAR} from \"scenejs\";\nScene.LINEAR\n*/\nexport const LINEAR = /*#__PURE__#*/bezier(0, 0, 1, 1);\n/**\n* Ease Speed (0.25, 0.1, 0.25, 1)\n* @memberof easing\n* @name EASE\n* @static\n* @type {function}\n* @example\nimport {EASE} from \"scenejs\";\nScene.EASE\n*/\nexport const EASE = /*#__PURE__#*/bezier(0.25, 0.1, 0.25, 1);\n/**\n* Ease In Speed (0.42, 0, 1, 1)\n* @memberof easing\n* @name EASE_IN\n* @static\n* @type {function}\n* @example\nimport {EASE_IN} from \"scenejs\";\nScene.EASE_IN\n*/\nexport const EASE_IN = /*#__PURE__#*/bezier(0.42, 0, 1, 1);\n/**\n* Ease Out Speed (0, 0, 0.58, 1)\n* @memberof easing\n* @name EASE_OUT\n* @static\n* @type {function}\n* @example\nimport {EASE_OUT} from \"scenejs\";\nScene.EASE_OUT\n*/\nexport const EASE_OUT = /*#__PURE__#*/bezier(0, 0, 0.58, 1);\n/**\n* Ease In Out Speed (0.42, 0, 0.58, 1)\n* @memberof easing\n* @name EASE_IN_OUT\n* @static\n* @type {function}\n* @example\nimport {EASE_IN_OUT} from \"scenejs\";\nScene.EASE_IN_OUT\n*/\nexport const EASE_IN_OUT = /*#__PURE__#*/bezier(0.42, 0, 0.58, 1);\n","import { IObject } from \"@daybrush/utils\";\nimport { RoleObject, OptionType, EventType, EasingFunction } from \"./types\";\nimport { EASE, EASE_IN, EASE_IN_OUT, LINEAR, EASE_OUT, STEP_START, STEP_END } from \"./easing\";\n\nexport const PREFIX = \"__SCENEJS_\";\nexport const DATA_SCENE_ID = \"data-scene-id\";\nexport const TIMING_FUNCTION = \"animation-timing-function\";\nexport const ROLES: RoleObject = { transform: {}, filter: {}, attribute: {}, html: true };\nexport const ALIAS: IObject = { easing: [TIMING_FUNCTION] };\nexport const FIXED = { [TIMING_FUNCTION]: true, contents: true, html: true };\nexport const MAXIMUM = 1000000;\nexport const THRESHOLD = 0.000001;\n\nexport const DURATION = \"duration\";\nexport const FILL_MODE = \"fillMode\";\nexport const DIRECTION = \"direction\";\nexport const ITERATION_COUNT = \"iterationCount\";\nexport const DELAY = \"delay\";\nexport const EASING = \"easing\";\nexport const PLAY_SPEED = \"playSpeed\";\nexport const EASING_NAME = \"easingName\";\nexport const ITERATION_TIME = \"iterationTime\";\nexport const PAUSED = \"paused\";\nexport const ENDED = \"ended\";\nexport const TIMEUPDATE = \"timeupdate\";\nexport const ANIMATE = \"animate\";\nexport const PLAY = \"play\";\nexport const RUNNING = \"running\";\nexport const ITERATION = \"iteration\";\nexport const START_ANIMATION = \"startAnimation\";\nexport const PAUSE_ANIMATION = \"pauseAnimation\";\nexport const ALTERNATE = \"alternate\";\nexport const REVERSE = \"reverse\";\nexport const ALTERNATE_REVERSE = \"alternate-reverse\";\nexport const NORMAL = \"normal\";\nexport const INFINITE = \"infinite\";\nexport const PLAY_STATE = \"playState\";\nexport const PLAY_CSS = \"playCSS\";\nexport const PREV_TIME = \"prevTime\";\nexport const TICK_TIME = \"tickTime\";\nexport const CURRENT_TIME = \"currentTime\";\nexport const SELECTOR = \"selector\";\nexport const TRANSFORM_NAME = \"transform\";\nexport const EASINGS = {\n \"linear\": LINEAR,\n \"ease\": EASE,\n \"ease-in\": EASE_IN,\n \"ease-out\": EASE_OUT,\n \"ease-in-out\": EASE_IN_OUT,\n \"step-start\": STEP_START,\n \"step-end\": STEP_END,\n};\nexport const NAME_SEPARATOR = \"_///_\";\n/**\n* option name list\n* @name Scene.OPTIONS\n* @memberof Scene\n* @static\n* @type {$ts:OptionType}\n* @example\n* Scene.OPTIONS // [\"duration\", \"fillMode\", \"direction\", \"iterationCount\", \"delay\", \"easing\", \"playSpeed\"]\n*/\nexport const OPTIONS: OptionType = [DURATION, FILL_MODE, DIRECTION, ITERATION_COUNT, DELAY, EASING, PLAY_SPEED];\n\n/**\n* Event name list\n* @name Scene.EVENTS\n* @memberof Scene\n* @static\n* @type {$ts:EventType}\n* @example\n* Scene.EVENTS // [\"paused\", \"ended\", \"timeupdate\", \"animate\", \"play\", \"iteration\"];\n*/\nexport const EVENTS: EventType = [PAUSED, ENDED, TIMEUPDATE, ANIMATE, PLAY, ITERATION];\n","import { isObject, isArray, toArray } from \"@daybrush/utils\";\nimport { CallbackType, EventParameter } from \"./types\";\n\n/**\n* attach and trigger event handlers.\n*/\nclass EventTrigger {\n public events: { [name: string]: CallbackType[] };\n /**\n * @example\n const et = new Scene.EventTrigger();\n const scene = new Scene();\n\n scene.on(\"call\", e => {\n console.log(e.param);\n });\n et.on(\"call\", e => {\n console.log(e.param);\n });\n scene.trigger(\"call\", {param: 1});\n et.trigger(\"call\", {param: 1});\n */\n constructor() {\n this.events = {};\n }\n public _on(name: string | EventParameter, callback?: CallbackType | CallbackType[], once?: boolean) {\n const events = this.events;\n\n if (isObject(name)) {\n for (const n in name) {\n this._on(n, name[n], once);\n }\n return;\n }\n if (!(name in events)) {\n events[name] = [];\n }\n if (!callback) {\n return;\n }\n if (isArray(callback)) {\n callback.forEach(func => this._on(name, func, once));\n return;\n }\n events[name].push(once ? function callback2(...args) {\n callback(...args);\n this.off(name, callback2);\n } : callback);\n }\n /**\n * Attach an event handler function for one or more events to target\n * @param - event's name\n * @param - function to execute when the event is triggered.\n * @return {EventTrigger} An Instance itself.\n * @example\n target.on(\"animate\", function() {\n console.log(\"animate\");\n });\n\n target.trigger(\"animate\");\n\n */\n public on(name: string | EventParameter, callback?: CallbackType | CallbackType[]) {\n this._on(name, callback);\n return this;\n }\n /**\n * Dettach an event handler function for one or more events to target\n * @param - event's name\n * @param - function to execute when the event is triggered.\n * @return {EventTrigger} An Instance itself.\n * @example\n const callback = function() {\n console.log(\"animate\");\n };\n target.on(\"animate\", callback);\n\n target.off(\"animate\", callback);\n target.off(\"animate\");\n\n */\n public off(name?: string, callback?: CallbackType) {\n if (!name) {\n this.events = {};\n } else if (!callback) {\n this.events[name] = [];\n } else {\n const callbacks = this.events[name];\n\n if (!callbacks) {\n return this;\n }\n const index = callbacks.indexOf(callback);\n\n if (index !== -1) {\n callbacks.splice(index, 1);\n }\n }\n return this;\n }\n /**\n * execute event handler\n * @param - event's name\n * @param - event handler's additional parameter\n * @return {EventTrigger} An Instance itself.\n * @example\n target.on(\"animate\", function(a1, a2) {\n console.log(\"animate\", a1, a2);\n });\n\n target.trigger(\"animate\", [1, 2]); // log => \"animate\", 1, 2\n\n */\n public trigger(name: string, ...data: any[]) {\n const events = this.events;\n\n if (!(name in events)) {\n return this;\n }\n\n const args = data || [];\n\n !args[0] && (args[0] = {});\n const event = events[name];\n const target = args[0];\n\n target.type = name;\n target.currentTarget = this;\n !target.target && (target.target = this);\n toArray(events[name]).forEach(callback => {\n callback.apply(this, data);\n });\n\n return this;\n }\n public once(name: string | EventParameter, callback?: CallbackType | CallbackType[]) {\n this._on(name, callback, true);\n return this;\n }\n}\nexport default EventTrigger;\n","import { isString } from \"@daybrush/utils\";\nimport { PropertyObjectState } from \"./types\";\n\n/**\n* Make string, array to PropertyObject for the dot product\n*/\nclass PropertyObject implements PropertyObjectState {\n public value: any[];\n public prefix: string = \"\";\n public suffix: string = \"\";\n public model: string = \"\";\n public type: string = \"\";\n public separator: string = \",\";\n\n /**\n * @param - This value is in the array format.\n * @param - options\n * @example\n var obj = new PropertyObject([100,100,100,0.5], {\n \"separator\" : \",\",\n \"prefix\" : \"rgba(\",\n \"suffix\" : \")\"\n });\n */\n constructor(value: string | any[], options?: Partial) {\n options && this.setOptions(options);\n this.value = isString(value) ? value.split(this.separator) : value;\n }\n public setOptions(newOptions: Partial) {\n for (const name in newOptions) {\n this[name as keyof PropertyObjectState] = newOptions[name as keyof PropertyObjectState];\n }\n return this;\n }\n /**\n * the number of values.\n * @example\n const obj1 = new PropertyObject(\"1,2,3\", \",\");\n\n console.log(obj1.length);\n // 3\n */\n public size() {\n return this.value.length;\n }\n /**\n * retrieve one of values at the index\n * @param {Number} index - index\n * @return {Object} one of values at the index\n * @example\n const obj1 = new PropertyObject(\"1,2,3\", \",\");\n\n console.log(obj1.get(0));\n // 1\n */\n public get(index: number) {\n return this.value[index];\n }\n /**\n * Set the value at that index\n * @param {Number} index - index\n * @param {Object} value - text, a number, object to set\n * @return {PropertyObject} An instance itself\n * @example\n const obj1 = new PropertyObject(\"1,2,3\", \",\");\n obj1.set(0, 2);\n console.log(obj1.toValue());\n // 2,2,3\n */\n public set(index: number, value: any) {\n this.value[index] = value;\n return this;\n }\n /**\n * create a copy of an instance itself.\n * @return {PropertyObject} clone\n * @example\n const obj1 = new PropertyObject(\"1,2,3\", \",\");\n const obj2 = obj1.clone();\n */\n public clone(): PropertyObject {\n const {\n separator,\n prefix,\n suffix,\n model,\n type,\n } = this;\n const arr = this.value.map(v => ((v instanceof PropertyObject) ? v.clone() : v));\n return new PropertyObject(arr, {\n separator,\n prefix,\n suffix,\n model,\n type,\n });\n }\n /**\n * Make Property Object to String\n * @return {String} Make Property Object to String\n * @example\n //rgba(100, 100, 100, 0.5)\n const obj4 = new PropertyObject([100,100,100,0.5], {\n \"separator\" : \",\",\n \"prefix\" : \"rgba(\",\n \"suffix\" : \")\",\n });\n console.log(obj4.toValue());\n // \"rgba(100,100,100,0.5)\"\n */\n public toValue(): string {\n return this.prefix + this.join() + this.suffix;\n }\n /**\n * Make Property Object's array to String\n * @return {String} Join the elements of an array into a string\n * @example\n //rgba(100, 100, 100, 0.5)\n var obj4 = new PropertyObject([100,100,100,0.5], {\n \"separator\" : \",\",\n \"prefix\" : \"rgba(\",\n \"suffix\" : \")\"\n });\n obj4.join(); // => \"100,100,100,0.5\"\n */\n public join() {\n return this.value.map(v => ((v instanceof PropertyObject) ? v.toValue() : v)).join(this.separator);\n }\n /**\n * executes a provided function once per array element.\n * @param {Function} callback - Function to execute for each element, taking three arguments\n * @param {All} [callback.currentValue] The current element being processed in the array.\n * @param {Number} [callback.index] The index of the current element being processed in the array.\n * @param {Array} [callback.array] the array.\n * @return {PropertyObject} An instance itself\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach|MDN Array.forEach()} reference to MDN document.\n * @example\n //rgba(100, 100, 100, 0.5)\n var obj4 = new PropertyObject([100,100,100,0.5], {\n \"separator\" : \",\",\n \"prefix\" : \"rgba(\",\n \"suffix\" : \")\"\n });\n\n obj4.forEach(t => {\n console.log(t);\n }); // => \"100,100,100,0.5\"\n */\n public forEach(func: (value?: any, index?: number, array?: any[]) => void) {\n this.value.forEach(func);\n return this;\n }\n}\nexport default PropertyObject;\n","/**\n* @namespace\n* @name Property\n*/\n\nimport PropertyObject from \"../PropertyObject\";\nimport {\n COLOR_MODELS, isString,\n splitComma, splitSpace, stringToRGBA,\n RGBA, splitBracket, IObject, isArray, splitText\n} from \"@daybrush/utils\";\nimport { NameType } from \"../types\";\n\nexport function splitStyle(str: string) {\n\n const properties = splitText(str, \";\");\n const obj: IObject = {};\n let length = properties.length;\n\n for (let i = 0; i < length; ++i) {\n const matches = splitText(properties[i], \":\");\n\n if (matches.length < 2 || !matches[1]) {\n --length;\n continue;\n }\n obj[matches[0].trim()] = toPropertyObject(matches[1].trim());\n }\n return { styles: obj, length };\n}\n/**\n* convert array to PropertyObject[type=color].\n* default model \"rgba\"\n* @memberof Property\n* @function arrayToColorObject\n* @param {Array|PropertyObject} value ex) [0, 0, 0, 1]\n* @return {PropertyObject} PropertyObject[type=color]\n* @example\narrayToColorObject([0, 0, 0])\n// => PropertyObject(type=\"color\", model=\"rgba\", value=[0, 0, 0, 1], separator=\",\")\n*/\nexport function arrayToColorObject(arr: number[]) {\n const model = RGBA;\n\n if (arr.length === 3) {\n arr[3] = 1;\n }\n return new PropertyObject(arr, {\n model,\n separator: \",\",\n type: \"color\",\n prefix: `${model}(`,\n suffix: \")\",\n });\n}\n/**\n* convert text with parentheses to object.\n* @memberof Property\n* @function stringToBracketObject\n* @param {String} value ex) \"rgba(0,0,0,1)\"\n* @return {PropertyObject} PropertyObject\n* @example\nstringToBracketObject(\"abcde(0, 0, 0,1)\")\n// => PropertyObject(model=\"abcde\", value=[0, 0, 0,1], separator=\",\")\n*/\nexport function stringToBracketObject(text: string) {\n // [prefix, value, other]\n const { prefix: model, value, suffix: afterModel } = splitBracket(text);\n\n if (typeof value === \"undefined\") {\n return text;\n }\n if (COLOR_MODELS.indexOf(model) > -1) {\n return arrayToColorObject(stringToRGBA(text));\n }\n // divide comma(,)\n const obj = toPropertyObject(value, model);\n\n let arr = [value];\n let separator = \",\";\n let prefix = `${model}(`;\n let suffix = `)${afterModel}`;\n\n if (obj instanceof PropertyObject) {\n separator = obj.separator;\n arr = obj.value;\n prefix += obj.prefix;\n suffix = obj.suffix + suffix;\n }\n return new PropertyObject(arr, {\n separator,\n model,\n prefix,\n suffix,\n });\n}\n\nexport function arrayToPropertyObject(arr: any[], separator: string) {\n return new PropertyObject(arr, {\n type: \"array\",\n separator,\n });\n}\n\n/**\n* convert text with parentheses to PropertyObject[type=color].\n* If the values are not RGBA model, change them RGBA mdoel.\n* @memberof Property\n* @function stringToColorObject\n* @param {String|PropertyObject} value ex) \"rgba(0,0,0,1)\"\n* @return {PropertyObject} PropertyObject[type=color]\n* @example\nstringToColorObject(\"rgba(0, 0, 0,1)\")\n// => PropertyObject(type=\"color\", model=\"rgba\", value=[0, 0, 0,1], separator=\",\")\n*/\nexport function stringToColorObject(value: string): string | PropertyObject {\n const result = stringToRGBA(value);\n\n return result ? arrayToColorObject(result) : value;\n}\n/**\n* convert CSS Value to PropertyObject\n* @memberof Property\n* @function toPropertyObject\n* @param {String} value it's text contains the array.\n* @return {String} Not Array, Not Separator, Only Number & Unit\n* @return {PropertyObject} Array with Separator.\n* @see referenced regular expression {@link http://stackoverflow.com/questions/20215440/parse-css-gradient-rule-with-javascript-regex}\n* @example\ntoPropertyObject(\"1px solid #000\");\n// => PropertyObject([\"1px\", \"solid\", rgba(0, 0, 0, 1)])\n*/\nexport function toPropertyObject(value: any[], model?: NameType): PropertyObject;\nexport function toPropertyObject(value: IObject, model?: NameType): IObject;\nexport function toPropertyObject(value: string, model?: NameType): PropertyObject | string;\nexport function toPropertyObject(value: string | IObject | any[], model?: NameType) {\n if (!isString(value)) {\n if (isArray(value)) {\n return arrayToPropertyObject(value, \",\");\n }\n return value;\n }\n let values: any = splitComma(value);\n\n if (values.length > 1) {\n return arrayToPropertyObject(values.map(v => toPropertyObject(v)), \",\");\n }\n values = splitSpace(value);\n\n if (values.length > 1) {\n return arrayToPropertyObject(values.map(v => toPropertyObject(v)), \" \");\n }\n values = /^(['\"])([^'\"]*)(['\"])$/g.exec(value);\n\n if (values && values[1] === values[3]) {\n // Quotes\n return new PropertyObject([toPropertyObject(values[2])], {\n prefix: values[1],\n suffix: values[1],\n });\n } else if (value.indexOf(\"(\") !== -1) {\n // color\n return stringToBracketObject(value);\n } else if (value.charAt(0) === \"#\" && model !== \"url\") {\n return stringToColorObject(value);\n }\n return value;\n}\nexport function toObject(object: PropertyObject, result: IObject = {}) {\n const model = object.model;\n\n if (model) {\n object.setOptions({\n model: \"\",\n suffix: \"\",\n prefix: \"\",\n });\n const value = object.size() > 1 ? object : object.get(0);\n\n result[model] = value;\n } else {\n object.forEach(obj => {\n toObject(obj, result);\n });\n }\n return result;\n}\n","import {\n ROLES, MAXIMUM, FIXED, ALIAS,\n PAUSED, RUNNING, PLAY, ENDED, PREFIX, PLAY_CSS, CURRENT_TIME, START_ANIMATION, EASINGS, NAME_SEPARATOR\n} from \"./consts\";\nimport PropertyObject from \"./PropertyObject\";\nimport Scene from \"./Scene\";\nimport SceneItem from \"./SceneItem\";\nimport {\n isArray, ANIMATION, ARRAY, OBJECT,\n PROPERTY, STRING, NUMBER, IS_WINDOW, IObject, $, document, isObject, addEvent, removeEvent, isString,\n} from \"@daybrush/utils\";\nimport { EasingType, EasingFunction, NameType } from \"./types\";\nimport { toPropertyObject } from \"./utils/property\";\nimport { bezier, steps } from \"./easing\";\n\nexport function isPropertyObject(value: any): value is PropertyObject {\n return value instanceof PropertyObject;\n}\nexport function setAlias(name: string, alias: string[]) {\n ALIAS[name] = alias;\n}\nexport function setRole(names: string[], isProperty?: boolean, isFixedProperty?: boolean) {\n const length = names.length;\n let roles: any = ROLES;\n let fixed: any = FIXED;\n\n for (let i = 0; i < length - 1; ++i) {\n !roles[names[i]] && (roles[names[i]] = {});\n roles = roles[names[i]];\n if (isFixedProperty) {\n !fixed[names[i]] && (fixed[names[i]] = {});\n fixed = fixed[names[i]];\n }\n }\n isFixedProperty && (fixed[names[length - 1]] = true);\n roles[names[length - 1]] = isProperty ? true : {};\n}\nexport function getType(value: any) {\n const type = typeof value;\n\n if (type === OBJECT) {\n if (isArray(value)) {\n return ARRAY;\n } else if (isPropertyObject(value)) {\n return PROPERTY;\n }\n } else if (type === STRING || type === NUMBER) {\n return \"value\";\n }\n return type;\n}\nexport function isPureObject(obj: any): obj is object {\n return isObject(obj) && obj.constructor === Object;\n}\nexport function getNames(names: IObject, stack: string[]) {\n let arr: string[][] = [];\n\n if (isPureObject(names)) {\n for (const name in names) {\n stack.push(name);\n arr = arr.concat(getNames(names[name], stack));\n stack.pop();\n }\n } else {\n arr.push(stack.slice());\n }\n return arr;\n}\nexport function updateFrame(names: IObject, properties: IObject) {\n for (const name in properties) {\n const value = properties[name];\n\n if (!isPureObject(value)) {\n names[name] = true;\n continue;\n }\n if (!isObject(names[name])) {\n names[name] = {};\n }\n updateFrame(names[name], properties[name]);\n }\n return names;\n}\nexport function toFixed(num: number) {\n return Math.round(num * MAXIMUM) / MAXIMUM;\n}\nexport function getValueByNames(\n names: Array,\n properties: IObject, length: number = names.length) {\n let value = properties;\n\n for (let i = 0; i < length; ++i) {\n if (!isObject(value) || value == null) {\n return undefined;\n }\n value = value[names[i]];\n }\n return value;\n}\nexport function isInProperties(roles: IObject, args: NameType[], isCheckTrue?: boolean) {\n const length = args.length;\n let role: any = roles;\n\n if (length === 0) {\n return false;\n }\n for (let i = 0; i < length; ++i) {\n if (role === true) {\n return false;\n }\n role = role[args[i]];\n if (!role || (!isCheckTrue && role === true)) {\n return false;\n }\n }\n return true;\n}\nexport function isRole(args: NameType[], isCheckTrue?: boolean) {\n return isInProperties(ROLES, args, isCheckTrue);\n}\nexport function isFixed(args: NameType[]) {\n return isInProperties(FIXED, args, true);\n}\n\nexport interface IterationInterface {\n currentTime: number;\n iterationCount: number;\n elapsedTime: number;\n}\nexport function setPlayCSS(item: Scene | SceneItem, isActivate: boolean) {\n item.state[PLAY_CSS] = isActivate;\n}\nexport function isPausedCSS(item: Scene | SceneItem) {\n return item.state[PLAY_CSS] && item.isPaused();\n}\nexport function isEndedCSS(item: Scene | SceneItem) {\n return !item.isEnded() && item.state[PLAY_CSS];\n}\n\nexport function makeId(selector?: boolean) {\n for (; ;) {\n const id = `${Math.floor(Math.random() * 10000000)}`;\n\n if (!IS_WINDOW || !selector) {\n return id;\n }\n const checkElement = $(`[data-scene-id=\"${id}\"]`);\n\n if (!checkElement) {\n return id;\n }\n }\n}\nexport function getRealId(item: Scene | SceneItem) {\n return item.getId() || item.setId(makeId(false)).getId();\n}\nexport function toId(text: number | string) {\n return `${text}`.match(/[0-9a-zA-Z]+/g).join(\"\");\n}\nexport function playCSS(\n item: Scene | SceneItem, isExportCSS?: boolean,\n playClassName?: string, properties: object = {}) {\n if (!ANIMATION || item.getPlayState() === RUNNING) {\n return;\n }\n const className = playClassName || START_ANIMATION;\n\n if (isPausedCSS(item)) {\n item.addPlayClass(true, className, properties);\n } else {\n if (item.isEnded()) {\n item.setTime(0);\n }\n isExportCSS && item.exportCSS({ className });\n const el = item.addPlayClass(false, className, properties);\n\n if (!el) {\n return;\n }\n addAnimationEvent(item, el);\n setPlayCSS(item, true);\n }\n item.setPlayState(RUNNING);\n}\n\nexport function addAnimationEvent(item: Scene | SceneItem, el: Element) {\n const state = item.state;\n const duration = item.getDuration();\n const isZeroDuration = !duration || !isFinite(duration);\n const animationend = () => {\n setPlayCSS(item, false);\n item.finish();\n };\n const animationstart = () => {\n item.trigger(PLAY);\n\n addEvent(el, \"animationcancel\", animationend);\n addEvent(el, \"animationend\", animationend);\n addEvent(el, \"animationiteration\", animationiteration);\n };\n item.once(ENDED, () => {\n removeEvent(el, \"animationcancel\", animationend);\n removeEvent(el, \"animationend\", animationend);\n removeEvent(el, \"animationiteration\", animationiteration);\n removeEvent(el, \"animationstart\", animationstart);\n });\n const animationiteration = ({ elapsedTime }: any) => {\n const currentTime = elapsedTime;\n const iterationCount = isZeroDuration ? 0 : (currentTime / duration);\n\n state[CURRENT_TIME] = currentTime;\n item.setIteration(iterationCount);\n };\n addEvent(el, \"animationstart\", animationstart);\n}\n\nexport function getEasing(curveArray: string | number[] | EasingFunction): EasingType {\n let easing: EasingType;\n\n if (isString(curveArray)) {\n if (curveArray in EASINGS) {\n easing = EASINGS[curveArray];\n } else {\n const obj = toPropertyObject(curveArray);\n\n if (isString(obj)) {\n return 0;\n } else {\n if (obj.model === \"cubic-bezier\") {\n curveArray = obj.value.map(v => parseFloat(v));\n easing = bezier(curveArray[0], curveArray[1], curveArray[2], curveArray[3]);\n } else if (obj.model === \"steps\") {\n easing = steps(parseFloat(obj.value[0]), obj.value[1]);\n } else {\n return 0;\n }\n }\n }\n } else if (isArray(curveArray)) {\n easing = bezier(curveArray[0], curveArray[1], curveArray[2], curveArray[3]);\n } else {\n easing = curveArray;\n }\n\n return easing;\n}\n\nexport function getFullName(names: NameType[]) {\n return names.join(NAME_SEPARATOR);\n}\n","import {\n THRESHOLD,\n ALTERNATE, ALTERNATE_REVERSE, REVERSE, INFINITE, NORMAL,\n ITERATION_COUNT, DELAY, FILL_MODE, DIRECTION, PLAY_SPEED,\n DURATION, EASING, ITERATION_TIME, EASING_NAME, PAUSED,\n RUNNING, PLAY, TIMEUPDATE, ENDED, PLAY_STATE, PREV_TIME, TICK_TIME, CURRENT_TIME, ITERATION, OPTIONS, EASINGS\n} from \"./consts\";\nimport EventTrigger from \"./EventTrigger\";\nimport { bezier, steps } from \"./easing\";\nimport { toFixed, getEasing } from \"./utils\";\nimport { splitUnit, isString, camelize, requestAnimationFrame, isArray, cancelAnimationFrame } from \"@daybrush/utils\";\nimport {\n IterationCountType, DirectionType, AnimatorState,\n EasingFunction, FillModeType, PlayStateType, EasingType, AnimatorOptions,\n} from \"./types\";\nimport { toPropertyObject } from \"./utils/property\";\n\nfunction GetterSetter {}>(\n getter: string[], setter: string[], parent: string) {\n return (constructor: T) => {\n const prototype = constructor.prototype;\n\n getter.forEach(name => {\n prototype[camelize(`get ${name}`)] = function() {\n return this[parent][name];\n };\n });\n setter.forEach(name => {\n prototype[camelize(`set ${name}`)] = function(value: any) {\n this[parent][name] = value;\n return this;\n };\n });\n };\n}\nexport function isDirectionReverse(iteration: number, iteraiontCount: IterationCountType, direction: DirectionType) {\n if (direction === REVERSE) {\n return true;\n } else if (iteraiontCount !== INFINITE && iteration === iteraiontCount && iteraiontCount % 1 === 0) {\n return direction === (iteration % 2 >= 1 ? ALTERNATE_REVERSE : ALTERNATE);\n }\n return direction === (iteration % 2 >= 1 ? ALTERNATE : ALTERNATE_REVERSE);\n}\n/**\n* @typedef {Object} AnimatorState The Animator options. Properties used in css animation.\n* @property {number} [duration] The duration property defines how long an animation should take to complete one cycle.\n* @property {\"none\"|\"forwards\"|\"backwards\"|\"both\"} [fillMode] The fillMode property specifies a style for the element when the animation is not playing (before it starts, after it ends, or both).\n* @property {\"infinite\"|number} [iterationCount] The iterationCount property specifies the number of times an animation should be played.\n* @property {array|function} [easing] The easing(timing-function) specifies the speed curve of an animation.\n* @property {number} [delay] The delay property specifies a delay for the start of an animation.\n* @property {\"normal\"|\"reverse\"|\"alternate\"|\"alternate-reverse\"} [direction] The direction property defines whether an animation should be played forwards, backwards or in alternate cycles.\n*/\n\nconst setters = [\"id\", ITERATION_COUNT, DELAY, FILL_MODE,\n DIRECTION, PLAY_SPEED, DURATION, PLAY_SPEED, ITERATION_TIME, PLAY_STATE];\nconst getters = [...setters, EASING, EASING_NAME];\n\n/**\n* play video, animation, the others\n* @extends EventTrigger\n* @see {@link https://www.w3schools.com/css/css3_animations.asp|CSS3 Animation}\n*/\n@GetterSetter(getters, setters, \"state\")\nclass Animator\n extends EventTrigger {\n public state: U;\n private timerId: number = 0;\n\n /**\n * @param - animator's options\n * @example\n const animator = new Animator({\n delay: 2,\n diretion: \"alternate\",\n duration: 2,\n fillMode: \"forwards\",\n iterationCount: 3,\n easing: Scene.easing.EASE,\n });\n */\n constructor(options?: Partial) {\n super();\n this.state = {\n id: \"\",\n easing: 0,\n easingName: \"linear\",\n iterationCount: 1,\n delay: 0,\n fillMode: \"forwards\",\n direction: NORMAL,\n playSpeed: 1,\n currentTime: 0,\n iterationTime: -1,\n iteration: 0,\n tickTime: 0,\n prevTime: 0,\n playState: PAUSED,\n duration: 0,\n } as U;\n this.setOptions(options);\n }\n /**\n * set animator's easing.\n * @param curverArray - The speed curve of an animation.\n * @return {Animator} An instance itself.\n * @example\n animator.({\n delay: 2,\n diretion: \"alternate\",\n duration: 2,\n fillMode: \"forwards\",\n iterationCount: 3,\n easing: Scene.easing.EASE,\n });\n */\n public setEasing(curveArray: string | number[] | EasingFunction): this {\n const easing: EasingType = getEasing(curveArray);\n const easingName = easing && easing[EASING_NAME] || \"linear\";\n const state = this.state;\n\n state[EASING] = easing;\n state[EASING_NAME] = easingName;\n return this;\n }\n /**\n * set animator's options.\n * @see {@link https://www.w3schools.com/css/css3_animations.asp|CSS3 Animation}\n * @param - animator's options\n * @return {Animator} An instance itself.\n * @example\n animator.({\n delay: 2,\n diretion: \"alternate\",\n duration: 2,\n fillMode: \"forwards\",\n iterationCount: 3,\n easing: Scene.eaasing.EASE,\n });\n */\n public setOptions(options: Partial = {}): this {\n for (const name in options) {\n const value = options[name];\n\n if (name === EASING) {\n this.setEasing(value);\n continue;\n } else if (name === DURATION) {\n value && this.setDuration(value);\n continue;\n }\n if (OPTIONS.indexOf(name as any) > -1) {\n this.state[name] = value;\n }\n }\n\n return this;\n }\n /**\n * Get the animator's total duration including delay\n * @return {number} Total duration\n * @example\n animator.getTotalDuration();\n */\n public getTotalDuration(): number {\n return this.getActiveDuration(true);\n }\n /**\n * Get the animator's total duration excluding delay\n * @return {number} Total duration excluding delay\n * @example\n animator.getActiveDuration();\n */\n public getActiveDuration(delay?: boolean): number {\n const state = this.state;\n const count = state[ITERATION_COUNT];\n if (count === INFINITE) {\n return Infinity;\n }\n return (delay ? state[DELAY] : 0) + this.getDuration() * count;\n }\n /**\n * Check if the animator has reached the end.\n * @return {boolean} ended\n * @example\n animator.isEnded(); // true or false\n */\n public isEnded(): boolean {\n if (this.state[TICK_TIME] === 0 && this.state[PLAY_STATE] === PAUSED) {\n return true;\n } else if (this.getTime() < this.getActiveDuration()) {\n return false;\n }\n return true;\n }\n /**\n *Check if the animator is paused:\n * @return {boolean} paused\n * @example\n animator.isPaused(); // true or false\n */\n public isPaused(): boolean {\n return this.state[PLAY_STATE] === PAUSED;\n }\n public start(delay: number = this.state[DELAY]): boolean {\n const state = this.state;\n\n state[PLAY_STATE] = RUNNING;\n if (state[TICK_TIME] >= delay) {\n /**\n * This event is fired when play animator.\n * @event Animator#play\n */\n this.trigger(PLAY);\n return true;\n }\n return false;\n }\n /**\n * play animator\n * @return {Animator} An instance itself.\n */\n public play(toTime?: number) {\n const state = this.state;\n const delay = state[DELAY];\n const currentTime = this.getTime();\n\n state[PLAY_STATE] = RUNNING;\n\n if (this.isEnded() && (currentTime === 0 || currentTime >= this.getActiveDuration())) {\n this.setTime(-delay, true);\n }\n\n this.timerId = requestAnimationFrame((time: number) => {\n state[PREV_TIME] = time;\n this.tick(time, toTime);\n });\n this.start();\n return this;\n }\n /**\n * pause animator\n * @return {Animator} An instance itself.\n */\n public pause(): this {\n const state = this.state;\n\n if (state[PLAY_STATE] !== PAUSED) {\n state[PLAY_STATE] = PAUSED;\n /**\n * This event is fired when animator is paused.\n * @event Animator#paused\n */\n this.trigger(PAUSED);\n }\n cancelAnimationFrame(this.timerId);\n return this;\n }\n /**\n * end animator\n * @return {Animator} An instance itself.\n */\n public finish() {\n this.setTime(0);\n this.state[TICK_TIME] = 0;\n this.end();\n return this;\n }\n /**\n * end animator\n * @return {Animator} An instance itself.\n */\n public end() {\n this.pause();\n /**\n * This event is fired when animator is ended.\n * @event Animator#ended\n */\n this.trigger(ENDED);\n return this;\n }\n /**\n * set currentTime\n * @param {Number|String} time - currentTime\n * @return {Animator} An instance itself.\n * @example\n\n animator.setTime(\"from\"); // 0\n animator.setTime(\"to\"); // 100%\n animator.setTime(\"50%\");\n animator.setTime(10);\n animator.getTime() // 10\n */\n public setTime(time: number | string, isTick?: boolean, isParent?: boolean) {\n const activeDuration = this.getActiveDuration();\n const state = this.state;\n const prevTime = state[TICK_TIME];\n const delay = state[DELAY];\n let currentTime = isTick ? (time as number) : this.getUnitTime(time);\n\n state[TICK_TIME] = delay + currentTime;\n if (currentTime < 0) {\n currentTime = 0;\n } else if (currentTime > activeDuration) {\n currentTime = activeDuration;\n }\n state[CURRENT_TIME] = currentTime;\n this.calculate();\n\n if (isTick && !isParent) {\n const tickTime = state[TICK_TIME];\n\n if (prevTime < delay && time >= 0) {\n this.start(0);\n }\n if (tickTime < prevTime || this.isEnded()) {\n this.end();\n return;\n }\n }\n if (this.isDelay()) {\n return this;\n }\n /**\n * This event is fired when the animator updates the time.\n * @event Animator#timeupdate\n * @param {Object} param The object of data to be sent to an event.\n * @param {Number} param.currentTime The total time that the animator is running.\n * @param {Number} param.time The iteration time during duration that the animator is running.\n * @param {Number} param.iterationCount The iteration count that the animator is running.\n */\n this.trigger(TIMEUPDATE, {\n currentTime,\n time: this.getIterationTime(),\n iterationCount: state[ITERATION],\n });\n\n return this;\n }\n /**\n * Get the animator's current time\n * @return {number} current time\n * @example\n animator.getTime();\n */\n public getTime(): number {\n return this.state[CURRENT_TIME];\n }\n public getUnitTime(time: string | number) {\n if (isString(time)) {\n const duration = this.getDuration() || 100;\n\n if (time === \"from\") {\n return 0;\n } else if (time === \"to\") {\n return duration;\n }\n const { unit, value } = splitUnit(time);\n\n if (unit === \"%\") {\n !this.getDuration() && (this.setDuration(duration));\n return toFixed(parseFloat(time) / 100 * duration);\n } else if (unit === \">\") {\n return value + THRESHOLD;\n } else {\n return value;\n }\n } else {\n return toFixed(time);\n }\n }\n /**\n * Check if the current state of animator is delayed.\n * @return {boolean} check delay state\n */\n public isDelay() {\n const state = this.state;\n const delay = state[DELAY];\n const tickTime = state[TICK_TIME];\n\n return delay > 0 && (tickTime < delay);\n }\n public setIteration(iterationCount: number): this {\n const state = this.state;\n const passIterationCount = Math.floor(iterationCount);\n const maxIterationCount = state[ITERATION_COUNT] === INFINITE ? Infinity : state[ITERATION_COUNT];\n\n if (state[ITERATION] < passIterationCount && passIterationCount < maxIterationCount) {\n /**\n * The event is fired when an iteration of an animation ends.\n * @event Animator#iteration\n * @param {Object} param The object of data to be sent to an event.\n * @param {Number} param.currentTime The total time that the animator is running.\n * @param {Number} param.iterationCount The iteration count that the animator is running.\n */\n this.trigger(\"iteration\", {\n currentTime: state[CURRENT_TIME],\n iterationCount: passIterationCount,\n });\n }\n state[ITERATION] = iterationCount;\n return this;\n }\n protected calculate() {\n const state = this.state;\n const iterationCount = state[ITERATION_COUNT];\n const fillMode = state[FILL_MODE];\n const direction = state[DIRECTION];\n const duration = this.getDuration();\n const time = this.getTime();\n const iteration = duration === 0 ? 0 : time / duration;\n let currentIterationTime = duration ? time % duration : 0;\n\n if (!duration) {\n this.setIterationTime(0);\n return this;\n }\n this.setIteration(iteration);\n\n // direction : normal, reverse, alternate, alternate-reverse\n // fillMode : forwards, backwards, both, none\n const isReverse = isDirectionReverse(iteration, iterationCount, direction);\n\n const isFiniteDuration = isFinite(duration);\n if (isFiniteDuration && isReverse) {\n currentIterationTime = duration - currentIterationTime;\n }\n if (isFiniteDuration && iterationCount !== INFINITE) {\n const isForwards = fillMode === \"both\" || fillMode === \"forwards\";\n\n // fill forwards\n if (iteration >= iterationCount) {\n currentIterationTime = duration * (isForwards ? (iterationCount % 1) || 1 : 0);\n isReverse && (currentIterationTime = duration - currentIterationTime);\n }\n }\n this.setIterationTime(currentIterationTime);\n return this;\n }\n private tick(now: number, to?: number) {\n if (this.isPaused()) {\n return;\n }\n const state = this.state;\n const playSpeed = state[PLAY_SPEED];\n const prevTime = state[PREV_TIME];\n const delay = state[DELAY];\n const tickTime = state[TICK_TIME];\n const currentTime = tickTime + Math.min(1000, now - prevTime) / 1000 * playSpeed;\n\n state[PREV_TIME] = now;\n this.setTime(currentTime - delay, true);\n if (to && to * 1000 < now) {\n this.pause();\n }\n if (state[PLAY_STATE] === PAUSED) {\n return;\n }\n\n this.timerId = requestAnimationFrame((time: number) => {\n this.tick(time, to);\n });\n }\n}\n/**\n * Specifies the unique indicator of the animator\n * @method Animator#setId\n * @param {number | string} - String or number of id to be set in the animator\n * @return {Animator} An instance itself.\n */\n/**\n * Specifies the unique indicator of the animator\n * @method Animator#getId\n * @return {number | string} the indicator of the item.\n */\n/**\n * Get a delay for the start of an animation.\n * @method Animator#getDelay\n * @return {number} delay\n */\n/**\n * Set a delay for the start of an animation.\n * @method Animator#setDelay\n * @param {number} delay - delay\n * @return {Animator} An instance itself.\n */\n/**\n * Get fill mode for the item when the animation is not playing (before it starts, after it ends, or both)\n * @method Animator#getFillMode\n * @return {FillModeType} fillMode\n */\n/**\n * Set fill mode for the item when the animation is not playing (before it starts, after it ends, or both)\n * @method Animator#setFillMode\n * @param {FillModeType} fillMode - fillMode\n * @return {Animator} An instance itself.\n */\n/**\n * Get the number of times an animation should be played.\n * @method Animator#getIterationCount\n * @return {IterationCountType} iterationCount\n */\n/**\n * Set the number of times an animation should be played.\n * @method Animator#setIterationCount\n * @param {IterationCountType} iterationCount - iterationCount\n * @return {Animator} An instance itself.\n */\n/**\n * Get whether an animation should be played forwards, backwards or in alternate cycles.\n * @method Animator#getDirection\n * @return {DirectionType} direction\n */\n/**\n * Set whether an animation should be played forwards, backwards or in alternate cycles.\n * @method Animator#setDirection\n * @param {DirectionType} direction - direction\n * @return {Animator} An instance itself.\n */\n/**\n * Get whether the animation is running or paused.\n * @method Animator#getPlayState\n * @return {PlayStateType} playState\n */\n/**\n * Set whether the animation is running or paused.\n * @method Animator#setPlayState\n * @param {PlayStateType} playState - playState\n * @return {Animator} An instance itself.\n */\n/**\n * Get the animator's play speed\n * @method Animator#getPlaySpeed\n * @return {number} playSpeed\n */\n/**\n * Set the animator's play speed\n * @method Animator#setPlaySpeed\n * @param {number} playSpeed - playSpeed\n * @return {Animator} An instance itself.\n */\n/**\n * Get how long an animation should take to complete one cycle.\n * @method Animator#getDuration\n * @return {number} duration\n */\n/**\n * Set how long an animation should take to complete one cycle.\n * @method Animator#setDuration\n * @param {number} duration - duration\n * @return {Animator} An instance itself.\n */\n/**\n * Get the speed curve of an animation.\n * @method Animator#getEasing\n * @return {EasingType} easing\n */\n/**\n * Get the speed curve's name\n * @method Animator#getEasingName\n * @return {string} the curve's name.\n */\n/**\n\t* Get the animator's current iteration time\n\t* @method Animator#getIterationTime\n\t* @return {number} current iteration time\n\t* @example\nanimator.getIterationTime();\n\t*/\n\n// tslint:disable-next-line:interface-name\ninterface Animator {\n setId(id: number | string): this;\n getId(): number | string;\n getIterationTime(): number;\n setIterationTime(time: number): this;\n setDelay(delay: number): this;\n getDelay(): number;\n setFillMode(fillMode: FillModeType): this;\n getFillMode(): FillModeType;\n setIterationCount(iterationCount: IterationCountType): this;\n getIterationCount(): IterationCountType;\n setDirection(direction: DirectionType): this;\n getDirection(): DirectionType;\n setPlayState(playState: PlayStateType): this;\n getPlayState(): PlayStateType;\n setPlaySpeed(playSpeed: number): this;\n getPlaySpeed(): number;\n setDuration(duration: number): this;\n getDuration(): number;\n getEasing(): EasingType;\n getEasingName(): string;\n}\nexport default Animator;\n","import {\n ALIAS, TIMING_FUNCTION, TRANSFORM_NAME, EASING_NAME, NAME_SEPARATOR\n} from \"./consts\";\nimport { isRole, getType, isPropertyObject, getValueByNames, isFixed, getNames, getEasing, getFullName } from \"./utils\";\nimport { toPropertyObject, splitStyle, toObject } from \"./utils/property\";\nimport {\n isObject, isArray, isString, getKeys,\n ANIMATION, TRANSFORM, FILTER, PROPERTY, FUNCTION, ARRAY, OBJECT, IObject, isUndefined,\n sortOrders,\n} from \"@daybrush/utils\";\nimport { NameType, KeyValueChildren } from \"./types\";\nimport OrderMap from \"order-map\";\n\nfunction toInnerProperties(obj: IObject, orders: NameType[] = []) {\n if (!obj) {\n return \"\";\n }\n const arrObj = [];\n\n const keys = getKeys(obj);\n\n sortOrders(keys, orders);\n\n keys.forEach(name => {\n arrObj.push(`${name.replace(/\\d$/g, \"\")}(${obj[name]})`);\n });\n\n return arrObj.join(\" \");\n}\n\n/* eslint-disable */\nfunction clone(target: IObject, toValue = false) {\n return merge({}, target, toValue);\n}\nfunction merge(to: IObject, from: IObject, toValue = false) {\n for (const name in from) {\n const value = from[name];\n const type = getType(value);\n\n if (type === PROPERTY) {\n to[name] = toValue ? value.toValue() : value.clone();\n } else if (type === FUNCTION) {\n to[name] = toValue ? getValue([name], value) : value;\n } else if (type === ARRAY) {\n to[name] = value.slice();\n } else if (type === OBJECT) {\n if (isObject(to[name]) && !isPropertyObject(to[name])) {\n merge(to[name], value, toValue);\n } else {\n to[name] = clone(value, toValue);\n }\n } else {\n to[name] = from[name];\n }\n }\n return to;\n}\n/* eslint-enable */\n\nfunction getPropertyName(args: NameType[]) {\n return args[0] in ALIAS ? ALIAS[args[0]] : args;\n}\nfunction getValue(names: NameType[], value: any): any {\n const type = getType(value);\n\n if (type === PROPERTY) {\n return value.toValue();\n } else if (type === FUNCTION) {\n if (names[0] !== TIMING_FUNCTION) {\n return getValue(names, value());\n }\n } else if (type === OBJECT) {\n return clone(value, true);\n }\n return value;\n}\n/**\n* Animation's Frame\n*/\nclass Frame {\n public properties: IObject = {};\n public orderMap: OrderMap = new OrderMap(NAME_SEPARATOR);\n /**\n * @param - properties\n * @example\n const frame = new Scene.Frame({\n display: \"none\"\n transform: {\n translate: \"50px\",\n scale: \"5, 5\",\n }\n });\n */\n constructor(properties: any = {}) {\n this.properties = {};\n // this.orders = [];\n this.set(properties);\n }\n /**\n * get property value\n * @param {...Number|String|PropertyObject} args - property name or value\n * @example\n frame.get(\"display\") // => \"none\", \"block\", ....\n frame.get(\"transform\", \"translate\") // => \"10px,10px\"\n */\n public get(...args: NameType[]) {\n const value = this.raw(...args);\n\n return getValue(getPropertyName(args), value);\n }\n /**\n * get properties orders\n * @param - property names\n * @example\n frame.getOrders([\"display\"]) // => []\n frame.getOrders([\"transform\"]) // => [\"translate\", \"scale\"]\n */\n public getOrders(names: NameType[]): NameType[] | undefined {\n return this.orderMap.get(names);\n }\n /**\n * set properties orders\n * @param - property names\n * @param - orders\n * @example\n frame.getOrders([\"transform\"]) // => [\"translate\", \"scale\"]\n frame.setOrders([\"transform\"], [\"scale\", \"tralsate\"])\n */\n public setOrders(names: NameType[], orders: NameType[]): NameType[] {\n return this.orderMap.set(names, orders);\n }\n public setOrderObject(obj: IObject) {\n this.orderMap.setObject(obj);\n }\n\n /**\n * get property keys\n * @param - property names\n * @example\n frame.gets(\"display\") // => []\n frame.gets(\"transform\") // => [\"translate\"]\n */\n public getKeys(...args: NameType[]): string[] {\n const value = this.raw(...args);\n const keys = getType(value) === OBJECT ? getKeys(value) : [];\n\n sortOrders(keys, this.orderMap.get(args));\n return keys;\n }\n /**\n * get properties array\n * @param - property names\n * @example\n frame.gets(\"display\") // => []\n frame.gets(\"transform\") // => [{ key: \"translate\", value: \"10px, 10px\", children: [] }]\n */\n public gets(...args: NameType[]): KeyValueChildren[] {\n const values = this.get(...args);\n const keys = this.getKeys(...args);\n\n return keys.map(key => {\n const nextValue = values[key];\n return { key, value: nextValue, children: this.gets(...args, key) };\n });\n }\n\n public raw(...args: NameType[]) {\n return getValueByNames(getPropertyName(args), this.properties);\n }\n /**\n * remove property value\n * @param {...String} args - property name\n * @return {Frame} An instance itself\n * @example\n frame.remove(\"display\")\n */\n public remove(...args: NameType[]) {\n const params = getPropertyName(args);\n const length = params.length;\n\n if (!length) {\n return this;\n }\n this.orderMap.remove(params);\n const value = getValueByNames(params, this.properties, length - 1);\n\n if (isObject(value)) {\n delete value[params[length - 1]];\n }\n return this;\n }\n /**\n * set property\n * @param {...Number|String|PropertyObject} args - property names or values\n * @return {Frame} An instance itself\n * @example\n // one parameter\n frame.set({\n display: \"none\",\n transform: {\n translate: \"10px, 10px\",\n scale: \"1\",\n },\n filter: {\n brightness: \"50%\",\n grayscale: \"100%\"\n }\n });\n\n // two parameters\n frame.set(\"transform\", {\n translate: \"10px, 10px\",\n scale: \"1\",\n });\n\n // three parameters\n frame.set(\"transform\", \"translate\", \"50px\");\n */\n public set(...args: any[]) {\n const self = this;\n const length = args.length;\n const params = args.slice(0, -1);\n const value = args[length - 1];\n const firstParam = params[0];\n\n if (length === 1 && value instanceof Frame) {\n self.merge(value);\n } else if (firstParam in ALIAS) {\n self._set(ALIAS[firstParam], value);\n } else if (length === 2 && isArray(firstParam)) {\n self._set(firstParam, value);\n } else if (isPropertyObject(value)) {\n if (isRole(params)) {\n self.set(...params, toObject(value));\n } else {\n self._set(params, value);\n }\n } else if (isArray(value)) {\n self._set(params, value);\n } else if (isObject(value)) {\n if (!self.has(...params) && isRole(params)) {\n self._set(params, {});\n }\n for (const name in value) {\n self.set(...params, name, value[name]);\n }\n } else if (isString(value)) {\n if (isRole(params, true)) {\n if (isFixed(params) || !isRole(params)) {\n this._set(params, value);\n } else {\n const obj = toPropertyObject(value);\n\n if (isObject(obj)) {\n self.set(...params, obj);\n }\n }\n return this;\n } else {\n const { styles, length: stylesLength } = splitStyle(value);\n\n for (const name in styles) {\n self.set(...params, name, styles[name]);\n }\n if (stylesLength) {\n return this;\n }\n }\n self._set(params, value);\n } else {\n self._set(params, value);\n }\n return self;\n }\n /**\n * Gets the names of properties.\n * @return the names of properties.\n * @example\n // one parameter\n frame.set({\n display: \"none\",\n transform: {\n translate: \"10px, 10px\",\n scale: \"1\",\n },\n });\n\n // [[\"display\"], [\"transform\", \"translate\"], [\"transform\", \"scale\"]]\n console.log(frame.getNames());\n */\n public getNames(): string[][] {\n return getNames(this.properties, []);\n }\n /**\n * check that has property.\n * @param {...String} args - property name\n * @example\n frame.has(\"property\", \"display\") // => true or false\n */\n public has(...args: NameType[]) {\n const params = getPropertyName(args);\n const length = params.length;\n\n if (!length) {\n return false;\n }\n return !isUndefined(getValueByNames(params, this.properties, length));\n }\n /**\n * clone frame.\n * @return {Frame} An instance of clone\n * @example\n frame.clone();\n */\n public clone() {\n const frame = new Frame();\n\n frame.setOrderObject(this.orderMap.orderMap);\n return frame.merge(this);\n }\n /**\n * merge one frame to other frame.\n * @param - target frame.\n * @return {Frame} An instance itself\n * @example\n frame.merge(frame2);\n */\n public merge(frame: Frame) {\n const properties = this.properties;\n const frameProperties = frame.properties;\n\n if (frameProperties) {\n merge(properties, frameProperties);\n }\n return this;\n }\n /**\n * Specifies an css object that coverted the frame.\n * @return {object} cssObject\n */\n public toCSSObject() {\n const properties = this.get();\n const cssObject: IObject = {};\n\n for (const name in properties) {\n if (isRole([name], true)) {\n continue;\n }\n const value = properties[name];\n\n if (name === TIMING_FUNCTION) {\n cssObject[TIMING_FUNCTION.replace(\"animation\", ANIMATION)] =\n (isString(value) ? value : value[EASING_NAME]) || \"initial\";\n } else {\n cssObject[name] = value;\n }\n }\n const transform = toInnerProperties(properties[TRANSFORM_NAME], this.orderMap.get([TRANSFORM_NAME]));\n const filter = toInnerProperties(properties.filter, this.orderMap.get([FILTER]));\n\n TRANSFORM && transform && (cssObject[TRANSFORM] = transform);\n FILTER && filter && (cssObject[FILTER] = filter);\n return cssObject;\n }\n /**\n * Specifies an css text that coverted the frame.\n * @return {string} cssText\n */\n public toCSS() {\n const cssObject = this.toCSSObject();\n const cssArray = [];\n const keys = getKeys(cssObject);\n\n sortOrders(keys, this.orderMap.get([]));\n keys.forEach(name => {\n cssArray.push(`${name}:${cssObject[name]};`);\n });\n return cssArray.join(\"\");\n }\n /**\n * Remove All Properties\n * @return {Frame} An instance itself\n */\n public clear() {\n this.properties = {};\n this.orderMap.clear();\n return this;\n }\n private _set(args: NameType[], value: any) {\n let properties = this.properties;\n const length = args.length;\n\n for (let i = 0; i < length - 1; ++i) {\n const name = args[i];\n\n !(name in properties) && (properties[name] = {});\n properties = properties[name];\n }\n if (!length) {\n return;\n }\n const lastParam = args[length - 1];\n\n this.orderMap.add(args);\n if (length === 1 && lastParam === TIMING_FUNCTION) {\n properties[lastParam] = getEasing(value);\n } else {\n properties[lastParam] = isString(value) && !isFixed(args)\n ? toPropertyObject(value, lastParam)\n : value;\n }\n }\n}\nexport default Frame;\n","\nimport PropertyObject from \"../PropertyObject\";\nimport { getType } from \"../utils\";\nimport { toPropertyObject } from \"./property\";\nimport { splitUnit, PROPERTY, FUNCTION, ARRAY, dot as dotNumber } from \"@daybrush/utils\";\nimport { EasingType } from \"../types\";\n\nfunction dotArray(a1: any[], a2: any, b1: number, b2: number): any {\n const length = a2.length;\n\n return a1.map((v1, i) => {\n if (i >= length) {\n return v1;\n } else {\n return dot(v1, a2[i], b1, b2);\n }\n });\n}\n\nfunction dotColor(color1: PropertyObject, color2: PropertyObject, b1: number, b2: number) {\n // convert array to PropertyObject(type=color)\n const value1 = color1.value;\n const value2 = color2.value;\n // If the model name is not same, the inner product is impossible.\n const model1 = color1.model;\n const model2 = color2.model;\n\n if (model1 !== model2) {\n // It is recognized as a string.\n return dot(color1.toValue(), color2.toValue(), b1, b2);\n }\n if (value1.length === 3) {\n value1[3] = 1;\n }\n if (value2.length === 3) {\n value2[3] = 1;\n }\n const v = dotArray(value1, value2, b1, b2);\n const colorModel = model1;\n\n for (let i = 0; i < 3; ++i) {\n v[i] = parseInt(v[i], 10);\n }\n const object = new PropertyObject(v, {\n type: \"color\",\n model: colorModel,\n prefix: `${colorModel}(`,\n suffix: \")\",\n });\n\n return object;\n}\n\nfunction dotObject(a1: PropertyObject, a2: PropertyObject, b1: number, b2: number) {\n const a1Type = a1.type;\n\n if (a1Type === \"color\") {\n return dotColor(a1, a2, b1, b2);\n }\n const value1 = a1.value;\n const value2 = a2.value;\n const arr = dotArray(value1, value2, b1, b2);\n\n return new PropertyObject(arr, {\n type: a1Type,\n separator: a1.separator || a2.separator,\n prefix: a1.prefix || a2.prefix,\n suffix: a1.suffix || a2.suffix,\n model: a1.model || a2.model,\n });\n}\n/**\n* The dot product of a1 and a2 for the b1 and b2.\n* @memberof Dot\n* @function dot\n* @param {String|Number|PropertyObject} a1 value1\n* @param {String|Number|PropertyObject} a2 value2\n* @param {Number} b1 b1 ratio\n* @param {Number} b2 b2 ratio\n* @return {String} Not Array, Not Separator, Only Number & Unit\n* @return {PropertyObject} Array with Separator.\n* @example\ndot(1, 3, 0.3, 0.7);\n// => 1.6\n*/\nexport function dot(a1: any, a2: any, b1: number, b2: number): any {\n if (b2 === 0) {\n return a2;\n } else if (b1 === 0 || b1 + b2 === 0) {\n // prevent division by zero.\n return a1;\n }\n // dot Object\n\n const type1 = getType(a1);\n const type2 = getType(a2);\n const isFunction1 = type1 === FUNCTION;\n const isFunction2 = type2 === FUNCTION;\n\n if (isFunction1 || isFunction2) {\n return () => {\n return dot(isFunction1 ? toPropertyObject(a1()) : a1, isFunction2 ? toPropertyObject(a2()) : a2, b1, b2);\n };\n } else if (type1 === type2) {\n if (type1 === PROPERTY) {\n return dotObject(a1, a2, b1, b2);\n } else if (type1 === ARRAY) {\n return dotArray(a1, a2, b1, b2);\n } else if (type1 !== \"value\") {\n return a1;\n }\n } else {\n return a1;\n }\n const v1 = splitUnit(`${a1}`);\n const v2 = splitUnit(`${a2}`);\n let v;\n\n // 숫자가 아닐경우 첫번째 값을 반환 b2가 0일경우 두번째 값을 반환\n if (isNaN(v1.value) || isNaN(v2.value)) {\n return a1;\n } else {\n v = dotNumber(v1.value, v2.value, b1, b2);\n }\n const prefix = v1.prefix || v2.prefix;\n const unit = v1.unit || v2.unit;\n\n if (!prefix && !unit) {\n return v;\n }\n return prefix + v + unit;\n}\n\nexport function dotValue(\n time: number,\n prevTime: number,\n nextTime: number,\n prevValue: any,\n nextValue: any,\n easing?: EasingType) {\n if (time === prevTime) {\n return prevValue;\n } else if (time === nextTime) {\n return nextValue;\n } else if (!easing) {\n return dot(prevValue, nextValue, time - prevTime, nextTime - time);\n }\n const ratio = easing((time - prevTime) / (nextTime - prevTime));\n const value = dot(prevValue, nextValue, ratio, 1 - ratio);\n\n return value;\n}\n","import Animator, { isDirectionReverse } from \"./Animator\";\nimport Frame from \"./Frame\";\nimport {\n toFixed,\n isFixed,\n playCSS,\n toId,\n getRealId,\n makeId,\n isPausedCSS,\n isRole,\n getValueByNames,\n isEndedCSS,\n setPlayCSS,\n getNames,\n updateFrame,\n} from \"./utils\";\nimport { dotValue } from \"./utils/dot\";\nimport {\n START_ANIMATION,\n PREFIX, THRESHOLD,\n TIMING_FUNCTION, ALTERNATE, ALTERNATE_REVERSE, INFINITE,\n REVERSE, EASING, FILL_MODE, DIRECTION, ITERATION_COUNT,\n EASING_NAME, DELAY, PLAY_SPEED, DURATION, PAUSE_ANIMATION,\n DATA_SCENE_ID, SELECTOR, ROLES, NAME_SEPARATOR\n} from \"./consts\";\nimport {\n isObject, isArray, isUndefined, decamelize,\n ANIMATION, fromCSS, addClass, removeClass, hasClass,\n KEYFRAMES, isFunction,\n IObject, $, splitComma, toArray, isString, IArrayFormat,\n dot as dotNumber,\n find,\n findIndex,\n getKeys,\n sortOrders,\n} from \"@daybrush/utils\";\nimport {\n NameType, AnimateElement, AnimatorState,\n SceneItemState, SceneItemOptions, EasingType, PlayCondition, DirectionType\n} from \"./types\";\nimport OrderMap from \"order-map\";\nimport styled, { InjectResult, StyledInjector } from \"css-styled\";\n\nfunction getNearTimeIndex(times: number[], time: number) {\n const length = times.length;\n\n for (let i = 0; i < length; ++i) {\n if (times[i] === time) {\n return [i, i];\n } else if (times[i] > time) {\n return [i > 0 ? i - 1 : 0, i];\n }\n }\n return [length - 1, length - 1];\n}\nfunction makeAnimationProperties(properties: object) {\n const cssArray = [];\n\n for (const name in properties) {\n cssArray.push(`${ANIMATION}-${decamelize(name)}:${properties[name]};`);\n }\n return cssArray.join(\"\");\n}\nfunction addTime(times: number[], time: number) {\n const length = times.length;\n for (let i = 0; i < length; ++i) {\n if (time < times[i]) {\n times.splice(i, 0, time);\n return;\n }\n }\n times[length] = time;\n}\nfunction addEntry(entries: number[][], time: number, keytime: number) {\n const prevEntry = entries[entries.length - 1];\n\n (!prevEntry || prevEntry[0] !== time || prevEntry[1] !== keytime) &&\n entries.push([toFixed(time), toFixed(keytime)]);\n}\nexport function getEntries(times: number[], states: AnimatorState[]) {\n let entries = times.map(time => ([time, time]));\n let nextEntries = [];\n\n states.forEach(state => {\n const iterationCount = state[ITERATION_COUNT] as number;\n const delay = state[DELAY];\n const playSpeed = state[PLAY_SPEED];\n const direction = state[DIRECTION];\n const intCount = Math.ceil(iterationCount);\n const currentDuration = entries[entries.length - 1][0];\n const length = entries.length;\n const lastTime = currentDuration * iterationCount;\n\n for (let i = 0; i < intCount; ++i) {\n const isReverse =\n direction === REVERSE ||\n direction === ALTERNATE && i % 2 ||\n direction === ALTERNATE_REVERSE && !(i % 2);\n\n for (let j = 0; j < length; ++j) {\n const entry = entries[isReverse ? length - j - 1 : j];\n const time = entry[1];\n const currentTime = currentDuration * i + (isReverse ? currentDuration - entry[0] : entry[0]);\n const prevEntry = entries[isReverse ? length - j : j - 1];\n\n if (currentTime > lastTime) {\n if (j !== 0) {\n const prevTime = currentDuration * i +\n (isReverse ? currentDuration - prevEntry[0] : prevEntry[0]);\n const divideTime = dotNumber(prevEntry[1], time, lastTime - prevTime, currentTime - lastTime);\n\n addEntry(nextEntries, (delay + currentDuration * iterationCount) / playSpeed, divideTime);\n }\n break;\n } else if (\n currentTime === lastTime\n && nextEntries.length\n && nextEntries[nextEntries.length - 1][0] === lastTime + delay\n ) {\n break;\n }\n addEntry(nextEntries, (delay + currentTime) / playSpeed, time);\n }\n }\n // delay time\n delay && nextEntries.unshift([0, nextEntries[0][1]]);\n\n entries = nextEntries;\n nextEntries = [];\n });\n\n return entries;\n}\n/**\n* manage Frame Keyframes and play keyframes.\n* @extends Animator\n* @example\nconst item = new SceneItem({\n\t0: {\n\t\tdisplay: \"none\",\n\t},\n\t1: {\n\t\tdisplay: \"block\",\n\t\topacity: 0,\n\t},\n\t2: {\n\t\topacity: 1,\n\t}\n});\n*/\nclass SceneItem extends Animator {\n public times: number[] = [];\n public items: IObject = {};\n public nameMap = new OrderMap(NAME_SEPARATOR);\n public elements: AnimateElement[] = [];\n public styled: StyledInjector;\n public styledInjector: InjectResult;\n public temp: Frame;\n private needUpdate: boolean = true;\n private target: any;\n private targetFunc: (frame: Frame) => void;\n\n /**\n * @param - properties\n * @param - options\n * @example\n const item = new SceneItem({\n 0: {\n display: \"none\",\n },\n 1: {\n display: \"block\",\n opacity: 0,\n },\n 2: {\n opacity: 1,\n }\n });\n */\n constructor(properties?: any, options?: Partial) {\n super();\n this.load(properties, options);\n }\n public getDuration() {\n const times = this.times;\n const length = times.length;\n\n return (length === 0 ? 0 : times[length - 1]) || this.state[DURATION];\n }\n /**\n * get size of list\n * @return {Number} length of list\n */\n public size() {\n return this.times.length;\n }\n public setDuration(duration: number) {\n if (!duration) {\n return this;\n }\n const originalDuration = this.getDuration();\n\n if (originalDuration > 0) {\n const ratio = duration / originalDuration;\n const { times, items } = this;\n const obj: IObject = {};\n\n this.times = times.map(time => {\n const time2 = toFixed(time * ratio);\n\n obj[time2] = items[time];\n\n return time2;\n });\n this.items = obj;\n } else {\n this.newFrame(duration);\n }\n return this;\n }\n public setId(id?: number | string) {\n const state = this.state;\n const elements = this.elements;\n const length = elements.length;\n\n state.id = id || makeId(!!length);\n\n if (length && !state[SELECTOR]) {\n const sceneId = toId(this.getId());\n\n state[SELECTOR] = `[${DATA_SCENE_ID}=\"${sceneId}\"]`;\n elements.forEach(element => {\n element.setAttribute(DATA_SCENE_ID, sceneId);\n });\n }\n return this;\n }\n\n /**\n * Set properties to the sceneItem at that time\n * @param {Number} time - time\n * @param {...String|Object} [properties] - property names or values\n * @return {SceneItem} An instance itself\n * @example\n item.set(0, \"a\", \"b\") // item.getFrame(0).set(\"a\", \"b\")\n console.log(item.get(0, \"a\")); // \"b\"\n */\n public set(time: any, ...args: any[]) {\n if (time instanceof SceneItem) {\n return this.set(0, time);\n } else if (isArray(time)) {\n const length = time.length;\n\n for (let i = 0; i < length; ++i) {\n const t = length === 1 ? 0 : this.getUnitTime(`${i / (length - 1) * 100}%`);\n\n this.set(t, time[i]);\n }\n } else if (isObject(time)) {\n for (const t in time) {\n const value = time[t];\n\n splitComma(t).forEach(eachTime => {\n const realTime = this.getUnitTime(eachTime);\n\n if (isNaN(realTime)) {\n getNames(value, [eachTime]).forEach(names => {\n const innerValue = getValueByNames(names.slice(1), value);\n const arr = isArray(innerValue) ?\n innerValue : [getValueByNames(names, this.target), innerValue];\n const length = arr.length;\n\n for (let i = 0; i < length; ++i) {\n this.newFrame(`${i / (length - 1) * 100}%`).set(...names, arr[i]);\n }\n });\n } else {\n this.set(realTime, value);\n }\n });\n }\n } else if (!isUndefined(time)) {\n const value = args[0];\n\n splitComma(time + \"\").forEach(eachTime => {\n const realTime = this.getUnitTime(eachTime);\n\n if (value instanceof SceneItem) {\n const delay = value.getDelay();\n const frames = value.toObject(!this.hasFrame(realTime + delay));\n const duration = value.getDuration();\n const direction = value.getDirection();\n const isReverse = direction.indexOf(\"reverse\") > -1;\n\n for (const frameTime in frames) {\n const nextTime = isReverse ? duration - parseFloat(frameTime) : parseFloat(frameTime);\n this.set(realTime + nextTime, frames[frameTime]);\n }\n } else if (args.length === 1 && isArray(value)) {\n value.forEach((item: any) => {\n this.set(realTime, item);\n });\n } else {\n const frame = this.newFrame(realTime);\n\n frame.set(...args);\n }\n });\n }\n this.needUpdate = true;\n return this;\n }\n /**\n * Get properties of the sceneItem at that time\n * @param {Number} time - time\n * @param {...String|Object} args property's name or properties\n * @return {Number|String|PropertyObejct} property value\n * @example\n item.get(0, \"a\"); // item.getFrame(0).get(\"a\");\n item.get(0, \"transform\", \"translate\"); // item.getFrame(0).get(\"transform\", \"translate\");\n */\n public get(time: string | number, ...args: NameType[]) {\n const frame = this.getFrame(time);\n\n return frame && frame.get(...args);\n }\n /**\n * get properties orders\n * @param - property names\n * @example\n item.getOrders([\"display\"]) // => []\n item.getOrders([\"transform\"]) // => [\"translate\", \"scale\"]\n */\n public getOrders(names: NameType[]): NameType[] | undefined {\n this.needUpdate && this.update();\n\n return this.nameMap.get(names);\n }\n /**\n * set properties orders\n * @param - property names\n * @param - orders\n * @example\n item.getOrders([\"transform\"]) // => [\"translate\", \"scale\"]\n item.setOrders([\"transform\"], [\"scale\", \"tralsate\"])\n */\n public setOrders(names: NameType[], orders: NameType[]): NameType[] {\n this.needUpdate && this.update();\n\n const result = this.nameMap.set(names, orders);\n\n this.updateFrameOrders();\n\n return result;\n }\n public setOrderObject(obj: IObject) {\n this.nameMap.setObject(obj);\n\n this.updateFrameOrders();\n }\n public remove(time: string | number, ...args: any[]): this;\n /**\n * remove properties to the sceneItem at that time\n * @param {Number} time - time\n * @param {...String|Object} [properties] - property names or values\n * @return {SceneItem} An instance itself\n * @example\n item.remove(0, \"a\");\n */\n public remove(time: string | number, ...args: NameType[]) {\n if (args.length) {\n const frame = this.getFrame(time);\n\n frame && frame.remove(...args);\n } else {\n this.removeFrame(time);\n }\n this.needUpdate = true;\n return this;\n }\n /**\n * Append the item or object at the last time.\n * @param - the scene item or item object\n * @return An instance itself\n * @example\n item.append(new SceneItem({\n 0: {\n opacity: 0,\n },\n 1: {\n opacity: 1,\n }\n }));\n item.append({\n 0: {\n opacity: 0,\n },\n 1: {\n opacity: 1,\n }\n });\n item.set(item.getDuration(), {\n 0: {\n opacity: 0,\n },\n 1: {\n opacity: 1,\n }\n });\n */\n public append(item: SceneItem | IObject) {\n if (item instanceof SceneItem) {\n this.set(this.getDuration(), item);\n } else {\n this.append(new SceneItem(item));\n }\n return this;\n }\n /**\n * Push the front frames for the time and prepend the scene item or item object.\n * @param - the scene item or item object\n * @return An instance itself\n */\n public prepend(item: SceneItem | IObject) {\n if (item instanceof SceneItem) {\n const unshiftTime = item.getDuration() + item.getDelay();\n const firstFrame = this.getFrame(0);\n // remove first frame\n this.removeFrame(0);\n this.unshift(unshiftTime);\n this.set(0, item);\n this.set(unshiftTime + THRESHOLD, firstFrame);\n } else {\n this.prepend(new SceneItem(item));\n }\n return this;\n }\n /**\n * Push out the amount of time.\n * @param - time to push\n * @example\n item.get(0); // frame 0\n item.unshift(3);\n item.get(3) // frame 0\n */\n public unshift(time: number) {\n const { times, items } = this;\n const obj: IObject = {};\n\n this.times = times.map(t => {\n const time2 = toFixed(time + t);\n\n obj[time2] = items[t];\n return time2;\n });\n this.items = obj;\n return this;\n }\n /**\n * Get the frames in the item in object form.\n * @return {}\n * @example\n item.toObject();\n // {0: {display: \"none\"}, 1: {display: \"block\"}}\n */\n public toObject(isStartZero = true): IObject {\n const obj: IObject = {};\n const delay = this.getDelay();\n\n this.forEach((frame: Frame, time: number) => {\n obj[(!time && !isStartZero ? THRESHOLD : 0) + delay + time] = frame.clone();\n });\n return obj;\n }\n /**\n * Specifies an element to synchronize items' keyframes.\n * @param {string} selectors - Selectors to find elements in items.\n * @return {SceneItem} An instance itself\n * @example\nitem.setSelector(\"#id.class\");\n */\n public setSelector(target: string | boolean | ((id: number | string) => string)) {\n if (isFunction(target)) {\n this.setElement(target(this.getId()));\n } else {\n this.setElement(target);\n }\n return this;\n }\n /**\n * Get the elements connected to SceneItem.\n */\n public getElements(): AnimateElement[] {\n return this.elements;\n }\n /**\n * Specifies an element to synchronize item's keyframes.\n * @param - elements to synchronize item's keyframes.\n * @param - Make sure that you have peusdo.\n * @return {SceneItem} An instance itself\n * @example\nitem.setElement(document.querySelector(\"#id.class\"));\nitem.setElement(document.querySelectorAll(\".class\"));\n */\n public setElements(target: boolean | string | AnimateElement | IArrayFormat): this {\n return this.setElement(target);\n }\n /**\n * Specifies an element to synchronize item's keyframes.\n * @param - elements to synchronize item's keyframes.\n * @param - Make sure that you have peusdo.\n * @return {SceneItem} An instance itself\n * @example\nitem.setElement(document.querySelector(\"#id.class\"));\nitem.setElement(document.querySelectorAll(\".class\"));\n */\n public setElement(target: boolean | string | AnimateElement | IArrayFormat) {\n const state = this.state;\n let elements: AnimateElement[] = [];\n\n if (!target) {\n return this;\n } else if (target === true || isString(target)) {\n const selector = target === true ? `${state.id}` : target;\n const matches = /([\\s\\S]+)(:+[a-zA-Z]+)$/g.exec(selector);\n\n elements = toArray($(matches ? matches[1] : selector, true));\n state[SELECTOR] = selector;\n } else {\n elements = (target instanceof Element) ? [target] : toArray(target);\n }\n if (!elements.length) {\n return this;\n }\n this.elements = elements;\n this.setId(this.getId());\n this.target = elements[0].style;\n this.targetFunc = (frame: Frame) => {\n const attributes = frame.get(\"attribute\");\n\n if (attributes) {\n for (const name in attributes) {\n elements.forEach(el => {\n el.setAttribute(name, attributes[name]);\n });\n }\n }\n if (frame.has(\"html\")) {\n const html = frame.get(\"html\");\n\n elements.forEach(el => {\n el.innerHTML = html;\n });\n }\n const cssText = frame.toCSS();\n\n if (state.cssText !== cssText) {\n state.cssText = cssText;\n\n elements.forEach(el => {\n el.style.cssText += cssText;\n });\n return frame;\n }\n };\n return this;\n }\n public setTarget(target: any): this {\n this.target = target;\n this.targetFunc = (frame: Frame) => {\n const obj = frame.get();\n\n for (const name in obj) {\n target[name] = obj[name];\n }\n };\n return this;\n }\n /**\n * add css styles of items's element to the frame at that time.\n * @param {Array} properties - elements to synchronize item's keyframes.\n * @return {SceneItem} An instance itself\n * @example\n item.setElement(document.querySelector(\"#id.class\"));\n item.setCSS(0, [\"opacity\"]);\n item.setCSS(0, [\"opacity\", \"width\", \"height\"]);\n */\n public setCSS(time: number, properties: string[]) {\n this.set(time, fromCSS(this.elements, properties));\n return this;\n }\n public setTime(time: number | string, isTick?: boolean, isParent?: boolean, parentEasing?: EasingType) {\n super.setTime(time, isTick, isParent);\n\n const iterationTime = this.getIterationTime();\n const easing = this.getEasing() || parentEasing;\n const frame = this.getNowFrame(iterationTime, easing);\n const currentTime = this.getTime();\n\n this.temp = frame;\n /**\n * This event is fired when timeupdate and animate.\n * @event SceneItem#animate\n * @param {Number} param.currentTime The total time that the animator is running.\n * @param {Number} param.time The iteration time during duration that the animator is running.\n * @param {Frame} param.frame frame of that time.\n */\n this.trigger(\"animate\", {\n frame,\n currentTime,\n time: iterationTime,\n });\n this.targetFunc && this.targetFunc(frame);\n return this;\n }\n /**\n * update property names used in frames.\n * @return {SceneItem} An instance itself\n * @example\n item.update();\n */\n public update() {\n const prevNameMap = this.nameMap;\n const names = {};\n this.forEach(frame => {\n updateFrame(names, frame.properties);\n });\n\n const nameMap = new OrderMap(NAME_SEPARATOR);\n\n function pushKeys(map: IObject, stack: NameType[]) {\n const keys = getKeys(map);\n\n sortOrders(keys, prevNameMap.get(stack));\n\n nameMap.set(stack, keys);\n keys.forEach(key => {\n const nextMap = map[key];\n if (isObject(nextMap)) {\n pushKeys(nextMap, [...stack, key]);\n }\n });\n }\n pushKeys(names, []);\n\n this.nameMap = nameMap;\n\n this.forEach(frame => {\n frame.setOrderObject(nameMap.orderMap);\n });\n this.needUpdate = false;\n return this;\n }\n /**\n * Create and add a frame to the sceneItem at that time\n * @param {Number} time - frame's time\n * @return {Frame} Created frame.\n * @example\n item.newFrame(time);\n */\n public newFrame(time: string | number) {\n let frame = this.getFrame(time);\n\n if (frame) {\n return frame;\n }\n frame = new Frame();\n\n this.setFrame(time, frame);\n return frame;\n }\n /**\n * Add a frame to the sceneItem at that time\n * @param {Number} time - frame's time\n * @return {SceneItem} An instance itself\n * @example\n item.setFrame(time, frame);\n */\n public setFrame(time: string | number, frame: Frame) {\n const realTime = this.getUnitTime(time);\n\n this.items[realTime] = frame;\n addTime(this.times, realTime);\n this.needUpdate = true;\n return this;\n }\n public getFrame(time: number | string, ...names: any[]): Frame;\n /**\n * get sceneItem's frame at that time\n * @param {Number} time - frame's time\n * @return {Frame} sceneItem's frame at that time\n * @example\n const frame = item.getFrame(time);\n */\n public getFrame(time: number | string) {\n return this.items[this.getUnitTime(time)];\n }\n public removeFrame(time: number | string, ...names: any[]): this;\n /**\n * remove sceneItem's frame at that time\n * @param - frame's time\n * @return {SceneItem} An instance itself\n * @example\n item.removeFrame(time);\n */\n public removeFrame(time: number | string) {\n const realTime = this.getUnitTime(time);\n const items = this.items;\n const index = this.times.indexOf(realTime);\n\n delete items[realTime];\n\n // remove time\n if (index > -1) {\n this.times.splice(index, 1);\n }\n this.needUpdate = true;\n return this;\n }\n /**\n * check if the item has a frame at that time\n * @param {Number} time - frame's time\n * @return {Boolean} true: the item has a frame // false: not\n * @example\n if (item.hasFrame(10)) {\n // has\n } else {\n // not\n }\n */\n public hasFrame(time: number | string) {\n return this.getUnitTime(time) in this.items;\n }\n /**\n * Check if keyframes has propery's name\n * @param - property's time\n * @return {boolean} true: if has property, false: not\n * @example\n item.hasName([\"transform\", \"translate\"]); // true or not\n */\n public hasName(args: string[]) {\n this.needUpdate && this.update();\n return !!this.nameMap.get(args);\n }\n /**\n * merge frame of the previous time at the next time.\n * @param - The time of the frame to merge\n * @param - The target frame\n * @return {SceneItem} An instance itself\n * @example\n // getFrame(1) contains getFrame(0)\n item.merge(0, 1);\n */\n public mergeFrame(time: number | string, frame: Frame) {\n if (frame) {\n const toFrame = this.newFrame(time);\n\n toFrame.merge(frame);\n }\n return this;\n }\n /**\n * Get frame of the current time\n * @param {Number} time - the current time\n * @param {function} easing - the speed curve of an animation\n * @return {Frame} frame of the current time\n * @example\n let item = new SceneItem({\n 0: {\n display: \"none\",\n },\n 1: {\n display: \"block\",\n opacity: 0,\n },\n 2: {\n opacity: 1,\n }\n });\n // opacity: 0.7; display:\"block\";\n const frame = item.getNowFrame(1.7);\n */\n public getNowFrame(time: number, easing?: EasingType, isAccurate?: boolean) {\n this.needUpdate && this.update();\n const frame = new Frame();\n const [left, right] = getNearTimeIndex(this.times, time);\n let realEasing = this.getEasing() || easing;\n let nameMap = this.nameMap;\n\n if (this.hasName([TIMING_FUNCTION])) {\n const nowEasing = this.getNowValue(time, [TIMING_FUNCTION], left, right, false, 0, true);\n\n isFunction(nowEasing) && (realEasing = nowEasing);\n }\n if (isAccurate) {\n const prevFrame = this.getFrame(time);\n const prevOrderMap = prevFrame.orderMap.filter([], orders => {\n return prevFrame.has(...orders);\n });\n\n for (const name in ROLES) {\n const orders = nameMap.get([name]);\n if (prevOrderMap.get([name]) && orders) {\n prevOrderMap.set([name], orders);\n }\n }\n nameMap = prevOrderMap;\n }\n const names = nameMap.gets([]);\n\n frame.setOrderObject(nameMap.orderMap);\n names.forEach(properties => {\n const value = this.getNowValue(time, properties, left, right, isAccurate, realEasing, isFixed(properties));\n\n if (isUndefined(value)) {\n return;\n }\n frame.set(properties, value);\n });\n return frame;\n }\n public load(properties: any = {}, options = properties.options) {\n options && this.setOptions(options);\n\n if (isArray(properties)) {\n this.set(properties);\n } else if (properties.keyframes) {\n this.set(properties.keyframes);\n } else {\n for (const time in properties) {\n if (time !== \"options\") {\n this.set({\n [time]: properties[time],\n });\n }\n }\n }\n if (options && options[DURATION]) {\n this.setDuration(options[DURATION]);\n }\n return this;\n }\n /**\n * clone SceneItem.\n * @return {SceneItem} An instance of clone\n * @example\n * item.clone();\n */\n public clone() {\n const item = new SceneItem();\n\n item.setOptions(this.state);\n item.setOrderObject(this.nameMap.orderMap);\n\n this.forEach((frame: Frame, time: number) => {\n item.setFrame(time, frame.clone());\n });\n return item;\n }\n /**\n * executes a provided function once for each scene item.\n * @param - Function to execute for each element, taking three arguments\n * @return {Keyframes} An instance itself\n */\n public forEach(callback: (item: Frame, time: number, items: IObject) => void) {\n const times = this.times;\n const items = this.items;\n\n times.forEach(time => {\n callback(items[time], time, items);\n });\n return this;\n }\n public setOptions(options: Partial = {}) {\n super.setOptions(options);\n const { id, selector, elements, element, target } = options;\n\n id && this.setId(id);\n if (target) {\n this.setTarget(target);\n } else if (selector) {\n this.setSelector(selector);\n } else if (elements || element) {\n this.setElement(elements || element);\n }\n return this;\n }\n public toCSS(\n playCondition: PlayCondition = { className: START_ANIMATION },\n parentDuration = this.getDuration(), states: AnimatorState[] = []) {\n const itemState = this.state;\n const selector = itemState[SELECTOR];\n\n if (!selector) {\n return \"\";\n }\n const originalDuration = this.getDuration();\n itemState[DURATION] = originalDuration;\n states.push(itemState);\n\n const reversedStates = toArray(states).reverse();\n const id = toId(getRealId(this));\n const superParent = states[0];\n const infiniteIndex = findIndex(reversedStates, state => {\n return state[ITERATION_COUNT] === INFINITE || !isFinite(state[DURATION]);\n }, states.length - 1);\n const finiteStates = reversedStates.slice(0, infiniteIndex);\n const duration = parentDuration || finiteStates.reduce((prev, cur) => {\n return (cur[DELAY] + prev * (cur[ITERATION_COUNT] as number)) / cur[PLAY_SPEED];\n }, originalDuration);\n const delay = reversedStates.slice(infiniteIndex).reduce((prev, cur) => {\n return (prev + cur[DELAY]) / cur[PLAY_SPEED];\n }, 0);\n const easingName = find(reversedStates, state => (state[EASING] && state[EASING_NAME]), itemState)[EASING_NAME];\n const iterationCount = reversedStates[infiniteIndex][ITERATION_COUNT];\n const fillMode = superParent[FILL_MODE];\n const direction = reversedStates[infiniteIndex][DIRECTION];\n const cssText = makeAnimationProperties({\n fillMode,\n direction,\n iterationCount,\n delay: `${delay}s`,\n name: `${PREFIX}KEYFRAMES_${id}`,\n duration: `${duration / superParent[PLAY_SPEED]}s`,\n timingFunction: easingName,\n });\n const selectors = splitComma(selector).map(sel => {\n const matches = /([\\s\\S]+)(:+[a-zA-Z]+)$/g.exec(sel);\n\n if (matches) {\n return [matches[1], matches[2]];\n } else {\n return [sel, \"\"];\n }\n });\n const className = playCondition.className;\n const selectorCallback = playCondition.selector;\n const preselector = isFunction(selectorCallback) ? selectorCallback(this, selector) : selectorCallback;\n\n return `\n ${preselector || selectors.map(([sel, peusdo]) => `${sel}.${className}${peusdo}`)} {${cssText}}\n ${selectors.map(([sel, peusdo]) => `${sel}.${PAUSE_ANIMATION}${peusdo}`)} {${ANIMATION}-play-state: paused;}\n @${KEYFRAMES} ${PREFIX}KEYFRAMES_${id}{${this._toKeyframes(duration, finiteStates, direction)}}`;\n }\n /**\n * Export the CSS of the items to the style.\n * @param - Add a selector or className to play.\n * @return {SceneItem} An instance itself\n */\n public exportCSS(\n playCondition?: PlayCondition,\n duration?: number, options?: AnimatorState[]) {\n if (!this.elements.length) {\n return \"\";\n }\n const css = this.toCSS(playCondition, duration, options);\n const isParent = options && !isUndefined(options[ITERATION_COUNT]);\n\n if (!isParent) {\n if (this.styledInjector) {\n this.styledInjector.destroy();\n this.styledInjector = null;\n }\n this.styled = styled(css);\n this.styledInjector = this.styled.inject(this.getAnimationElement(), { original: true });\n }\n return this;\n }\n public pause() {\n super.pause();\n isPausedCSS(this) && this.pauseCSS();\n return this;\n }\n public pauseCSS() {\n this.elements.forEach(element => {\n addClass(element, PAUSE_ANIMATION);\n });\n return this;\n }\n public endCSS() {\n this.elements.forEach(element => {\n removeClass(element, PAUSE_ANIMATION);\n removeClass(element, START_ANIMATION);\n });\n setPlayCSS(this, false);\n return this;\n }\n public end() {\n isEndedCSS(this) && this.endCSS();\n super.end();\n return this;\n }\n /**\n * Play using the css animation and keyframes.\n * @param - Check if you want to export css.\n * @param [playClassName=\"startAnimation\"] - Add a class name to play.\n * @param - The shorthand properties for six of the animation properties.\n * @see {@link https://www.w3schools.com/cssref/css3_pr_animation.asp}\n * @example\n item.playCSS();\n item.playCSS(false, \"startAnimation\", {\n direction: \"reverse\",\n fillMode: \"forwards\",\n });\n */\n public playCSS(isExportCSS = true, playClassName?: string, properties: object = {}) {\n playCSS(this, isExportCSS, playClassName, properties);\n return this;\n }\n public getAnimationElement(): AnimateElement {\n return this.elements[0];\n }\n public addPlayClass(isPaused: boolean, playClassName?: string, properties: object = {}) {\n const elements = this.elements;\n const length = elements.length;\n const cssText = makeAnimationProperties(properties);\n\n if (!length) {\n return;\n }\n if (isPaused) {\n elements.forEach(element => {\n removeClass(element, PAUSE_ANIMATION);\n });\n } else {\n elements.forEach(element => {\n element.style.cssText += cssText;\n\n if (hasClass(element, START_ANIMATION)) {\n removeClass(element, START_ANIMATION);\n }\n });\n elements.forEach(element => {\n element.clientWidth;\n });\n elements.forEach(element => {\n addClass(element, START_ANIMATION);\n });\n }\n return elements[0];\n }\n /**\n * Clear All Frames\n * @return {SceneItem} An instance itself\n */\n public clear() {\n this.times = [];\n this.items = {};\n this.nameMap = new OrderMap(NAME_SEPARATOR);\n\n if (this.styledInjector) {\n this.styledInjector.destroy();\n }\n this.styled = null;\n this.styledInjector = null;\n this.temp = null;\n this.needUpdate = true;\n return this;\n }\n public getNowValue(\n time: number,\n properties: NameType[],\n left?: number,\n right?: number,\n isAccurate?: boolean,\n easing?: EasingType,\n usePrevValue?: boolean,\n ) {\n const times = this.times;\n const length = times.length;\n\n let prevTime: number;\n let nextTime: number;\n let prevFrame: Frame;\n let nextFrame: Frame;\n const isUndefinedLeft = isUndefined(left);\n const isUndefinedRight = isUndefined(right);\n if (isUndefinedLeft || isUndefinedRight) {\n const indicies = getNearTimeIndex(times, time);\n isUndefinedLeft && (left = indicies[0]);\n isUndefinedRight && (right = indicies[1]);\n }\n\n for (let i = left; i >= 0; --i) {\n const frame = this.getFrame(times[i]);\n\n if (frame.has(...properties)) {\n prevTime = times[i];\n prevFrame = frame;\n break;\n }\n }\n const prevValue = prevFrame && prevFrame.raw(...properties);\n\n if (isAccurate && !isRole([properties[0]])) {\n return prevTime === time ? prevValue : undefined;\n }\n if (usePrevValue) {\n return prevValue;\n }\n for (let i = right; i < length; ++i) {\n const frame = this.getFrame(times[i]);\n\n if (frame.has(...properties)) {\n nextTime = times[i];\n nextFrame = frame;\n break;\n }\n }\n const nextValue = nextFrame && nextFrame.raw(...properties);\n\n if (!prevFrame || isUndefined(prevValue)) {\n return nextValue;\n }\n if (!nextFrame || isUndefined(nextValue) || prevValue === nextValue) {\n return prevValue;\n }\n return dotValue(time, Math.max(prevTime, 0), nextTime, prevValue, nextValue, easing);\n }\n private _toKeyframes(duration: number, states: AnimatorState[], direction: DirectionType) {\n const frames: IObject = {};\n const times = this.times.slice();\n\n if (!times.length) {\n return \"\";\n }\n const originalDuration = this.getDuration();\n (!this.getFrame(0)) && times.unshift(0);\n (!this.getFrame(originalDuration)) && times.push(originalDuration);\n const entries = getEntries(times, states);\n const lastEntry = entries[entries.length - 1];\n\n // end delay time\n lastEntry[0] < duration && addEntry(entries, duration, lastEntry[1]);\n let prevTime = -1;\n\n return entries.map(([time, keytime]) => {\n if (!frames[keytime]) {\n frames[keytime] =\n (!this.hasFrame(keytime) || keytime === 0 || keytime === originalDuration ?\n this.getNowFrame(keytime) : this.getNowFrame(keytime, 0, true)).toCSS();\n }\n\n let frameTime = time / duration * 100;\n\n if (frameTime - prevTime < THRESHOLD) {\n frameTime += THRESHOLD;\n }\n prevTime = frameTime;\n return `${Math.min(frameTime, 100)}%{\n ${time === 0 && !isDirectionReverse(0, 1, direction) ? \"\" : frames[keytime]}\n }`;\n }).join(\"\");\n }\n private updateFrameOrders() {\n const nameMap = this.nameMap.orderMap;\n\n this.forEach(frame => {\n frame.setOrderObject(nameMap);\n });\n }\n}\n\nexport default SceneItem;\n","import Animator from \"./Animator\";\nimport SceneItem from \"./SceneItem\";\nimport { SELECTOR, DURATION, DELAY, RUNNING, NAME_SEPARATOR } from \"./consts\";\nimport { playCSS, getRealId, isPausedCSS, isEndedCSS, setPlayCSS } from \"./utils\";\nimport { isFunction, IS_WINDOW, IObject, $, IArrayFormat } from \"@daybrush/utils\";\nimport {\n AnimateElement, SceneState, SceneOptions, EasingType,\n AnimatorState, SceneItemOptions, PlayCondition, NameType\n} from \"./types\";\nimport Frame from \"./Frame\";\nimport OrderMap from \"order-map\";\nimport styled, { InjectResult, StyledInjector } from \"css-styled\";\n/**\n * manage sceneItems and play Scene.\n * @sort 1\n */\nclass Scene extends Animator {\n /**\n * version info\n * @type {string}\n * @example\n * Scene.VERSION // #__VERSION__#\n */\n public static VERSION: string = \"#__VERSION__#\";\n public items: IObject = {};\n public orderMap = new OrderMap(NAME_SEPARATOR);\n public styled: StyledInjector;\n public styledInjector: InjectResult;\n public temp: IObject;\n /**\n * @param - properties\n * @param - options\n * @example\n const scene = new Scene({\n item1: {\n 0: {\n display: \"none\",\n },\n 1: {\n display: \"block\",\n opacity: 0,\n },\n 2: {\n opacity: 1,\n },\n },\n item2: {\n 2: {\n opacity: 1,\n },\n }\n });\n */\n constructor(properties?: { options?: Partial } & IObject, options?: Partial) {\n super();\n this.load(properties, options);\n }\n public getDuration() {\n let time = 0;\n\n this.forEach(item => {\n time = Math.max(time, item.getTotalDuration() / item.getPlaySpeed());\n });\n return time || this.state[DURATION];\n }\n public setDuration(duration: number) {\n const items = this.items;\n const sceneDuration = this.getDuration();\n\n if (duration === 0 || !isFinite(sceneDuration)) {\n return this;\n }\n if (sceneDuration === 0) {\n this.forEach(item => {\n item.setDuration(duration);\n });\n } else {\n const ratio = duration / sceneDuration;\n\n this.forEach(item => {\n item.setDelay(item.getDelay() * ratio);\n item.setDuration(item.getDuration() * ratio);\n });\n }\n super.setDuration(duration);\n return this;\n }\n public getItem(name: number | string): T;\n /**\n * get item in scene by name\n * @param - The item's name\n * @return {Scene | SceneItem} item\n * @example\n const item = scene.getItem(\"item1\")\n */\n public getItem(name: number | string) {\n return this.items[name];\n }\n /**\n * create item in scene\n * @param {} name - name of item to create\n * @param {} options - The option object of SceneItem\n * @return {} Newly created item\n * @example\n const item = scene.newItem(\"item1\")\n */\n public newItem(name: number | string, options: Partial = {}): Scene | SceneItem {\n if (this.items[name]) {\n return this.items[name];\n }\n const item = new SceneItem();\n\n this.setItem(name, item);\n item.setOptions(options);\n\n return item;\n }\n /**\n * remove item in scene\n * @param - name of item to remove\n * @return An instance itself\n * @example\n const item = scene.newItem(\"item1\")\n\n scene.removeItem(\"item1\");\n */\n public removeItem(name: number | string): this {\n delete this.items[name];\n\n this.orderMap.remove([name]);\n return this;\n }\n /**\n * add a sceneItem to the scene\n * @param - name of item to create\n * @param - sceneItem\n * @example\n const item = scene.newItem(\"item1\")\n */\n public setItem(name: number | string, item: Scene | SceneItem) {\n item.setId(name);\n this.items[name] = item;\n\n this.orderMap.add([name]);\n return this;\n }\n public setTime(time: number | string, isTick?: boolean, isParent?: boolean, parentEasing?: EasingType) {\n super.setTime(time, isTick, isParent);\n\n const iterationTime = this.getIterationTime();\n const easing = this.getEasing() || parentEasing;\n const frames: IObject = {};\n\n this.forEach(item => {\n item.setTime(iterationTime * item.getPlaySpeed() - item.getDelay(), isTick, true, easing);\n\n frames[item.getId()] = item.temp;\n });\n this.temp = frames;\n\n /**\n * This event is fired when timeupdate and animate.\n * @event Scene#animate\n * @param {object} param The object of data to be sent to an event.\n * @param {number} param.currentTime The total time that the animator is running.\n * @param {number} param.time The iteration time during duration that the animator is running.\n * @param {object} param.frames frames of that time.\n * @example\nconst scene = new Scene({\n a: {\n 0: {\n opacity: 0,\n },\n 1: {\n opacity: 1,\n }\n },\n b: {\n 0: {\n opacity: 0,\n },\n 1: {\n opacity: 1,\n }\n }\n}).on(\"animate\", e => {\n console.log(e.frames);\n // {a: Frame, b: Frame}\n console.log(e.frames.a.get(\"opacity\"));\n});\n */\n this.trigger(\"animate\", {\n frames,\n currentTime: this.getTime(),\n time: iterationTime,\n });\n\n return this;\n }\n /**\n * executes a provided function once for each scene item.\n * @param - Function to execute for each element, taking three arguments\n * @return {Scene} An instance itself\n */\n public forEach(\n func: (\n item: Scene | SceneItem,\n id: string | number,\n index: number,\n items: IObject,\n ) => void,\n ) {\n const items = this.items;\n this.orderMap.get([]).forEach((id, index) => {\n func(items[id], id, index, items);\n });\n return this;\n }\n public toCSS(\n playCondition?: PlayCondition,\n duration: number = this.getDuration(), parentStates: AnimatorState[] = []) {\n const totalDuration = !duration || !isFinite(duration) ? 0 : duration;\n const styles: string[] = [];\n const state = this.state;\n\n state[DURATION] = this.getDuration();\n\n this.forEach(item => {\n styles.push(item.toCSS(playCondition, totalDuration, parentStates.concat(state)));\n });\n return styles.join(\"\");\n }\n /**\n * Export the CSS of the items to the style.\n * @param - Add a selector or className to play.\n * @return {Scene} An instance itself\n */\n public exportCSS(\n playCondition?: PlayCondition, duration?: number, parentStates?: AnimatorState[]) {\n const css = this.toCSS(playCondition, duration, parentStates);\n\n if (!parentStates || !parentStates.length) {\n if (this.styledInjector) {\n this.styledInjector.destroy();\n this.styledInjector = null;\n }\n this.styled = styled(css);\n this.styledInjector = this.styled.inject(this.getAnimationElement(), { original: true });\n // && exportCSS(getRealId(this), css);\n }\n return this;\n }\n public append(item: SceneItem | Scene) {\n item.setDelay(item.getDelay() + this.getDuration());\n this.setItem(getRealId(item), item);\n }\n public pauseCSS() {\n return this.forEach(item => {\n item.pauseCSS();\n });\n }\n public pause() {\n super.pause();\n\n isPausedCSS(this) && this.pauseCSS();\n this.forEach(item => {\n item.pause();\n });\n return this;\n }\n public endCSS() {\n this.forEach(item => {\n item.endCSS();\n });\n setPlayCSS(this, false);\n }\n public end() {\n isEndedCSS(this) && this.endCSS();\n super.end();\n return this;\n }\n /**\n * get item orders\n * @example\n scene.getOrders() // => [\"item1\", \"item2\"]\n */\n public getOrders(): NameType[] {\n return this.orderMap.get([]);\n }\n /**\n * set item orders\n * @param - orders\n * @example\n frame.setOrders([\"item2\", \"item1\"]) // => [\"item2\", \"item1\"]\n */\n public setOrders(orders: NameType[]): NameType[] {\n return this.orderMap.set([], orders);\n }\n public getAnimationElement() {\n let animtionElement: AnimateElement;\n\n this.forEach(item => {\n const el = item.getAnimationElement();\n\n !animtionElement && (animtionElement = el);\n });\n return animtionElement;\n }\n public addPlayClass(isPaused: boolean, playClassName?: string, properties: object = {}) {\n let animtionElement: AnimateElement;\n\n this.forEach(item => {\n const el = item.addPlayClass(isPaused, playClassName, properties);\n\n !animtionElement && (animtionElement = el);\n });\n return animtionElement;\n }\n /**\n * Play using the css animation and keyframes.\n * @param - Check if you want to export css.\n * @param [playClassName=\"startAnimation\"] - Add a class name to play.\n * @param - The shorthand properties for six of the animation properties.\n * @return {Scene} An instance itself\n * @see {@link https://www.w3schools.com/cssref/css3_pr_animation.asp}\n * @example\n scene.playCSS();\n scene.playCSS(false, {\n direction: \"reverse\",\n fillMode: \"forwards\",\n });\n */\n public playCSS(isExportCSS = true, playClassName?: string, properties: Partial = {}) {\n playCSS(this, isExportCSS, playClassName, properties);\n return this;\n }\n public set(properties: any, ...args: any[]): this;\n /**\n * Set properties to the Scene.\n * @param - properties\n * @return An instance itself\n * @example\nscene.set({\n \".a\": {\n 0: {\n opacity: 0,\n },\n 1: {\n opacity: 1,\n },\n },\n});\n// 0\nconsole.log(scene.getItem(\".a\").get(0, \"opacity\"));\n// 1\nconsole.log(scene.getItem(\".a\").get(1, \"opacity\"));\n */\n public set(properties: any) {\n this.load(properties);\n return this;\n }\n /**\n * Clear All Items\n * @return {Scene} An instance itself\n */\n public clear() {\n this.finish();\n this.items = {};\n this.orderMap = new OrderMap(NAME_SEPARATOR);\n\n if (this.styledInjector) {\n this.styledInjector.destroy();\n }\n this.styled = null;\n this.styledInjector = null;\n }\n public load(properties: any = {}, options = properties.options) {\n if (!properties) {\n return this;\n }\n const selector = options && options[SELECTOR] || this.state[SELECTOR];\n for (const name in properties) {\n if (name === \"options\") {\n continue;\n }\n const object = properties[name];\n let item;\n\n if (object instanceof Scene || object instanceof SceneItem) {\n this.setItem(name, object);\n item = object;\n } else if (isFunction(object) && selector) {\n const elements =\n IS_WINDOW\n ? $(`${isFunction(selector) ? selector(name) : name}`, true) as IArrayFormat\n : ([] as AnimateElement[]);\n const length = elements.length;\n const scene = new Scene();\n\n for (let i = 0; i < length; ++i) {\n (scene.newItem(i) as SceneItem).setId().setElement(elements[i]).load(object(i, elements[i]));\n }\n this.setItem(name, scene);\n continue;\n } else {\n item = this.newItem(name);\n item.load(object);\n }\n selector && item.setSelector(selector);\n }\n this.setOptions(options);\n }\n public setOptions(options: Partial = {}): this {\n super.setOptions(options);\n\n const selector = options.selector;\n\n if (selector) {\n this.state[SELECTOR] = selector;\n }\n return this;\n }\n public setSelector(target?: string | boolean | ((id: number | string) => string)) {\n const state = this.state;\n const selector = target || state[SELECTOR];\n\n state[SELECTOR] = selector;\n const isItFunction = isFunction(target);\n if (selector) {\n this.forEach((item, name) => {\n item.setSelector(isItFunction ? (target as (id: number | string) => string)(name) : selector);\n });\n }\n return this;\n }\n public start(delay: number = this.state[DELAY]): boolean {\n const result = super.start(delay);\n\n if (result) {\n this.forEach(item => {\n item.start(0);\n });\n } else {\n this.forEach(item => {\n item.setPlayState(RUNNING);\n });\n }\n return result;\n }\n}\n\nexport default Scene;\n","import { IObject } from \"@daybrush/utils\";\nimport Scene from \"./Scene\";\nimport SceneItem from \"./SceneItem\";\nimport { SceneOptions, SceneItemOptions } from \"./types\";\n\nexport function animate(properties?: IObject, options?: Partial) {\n return new Scene(properties, options).play();\n}\nexport function animateItem(properties?: IObject, options?: Partial) {\n return new SceneItem(properties, options).play();\n}\n","import Scene, * as others from \"./index\";\n\nfor (const name in others) {\n (Scene as any)[name] = (others as any)[name];\n}\n\nexport default Scene;\n"],"names":["cubic","y1","y2","t","t2","bezier","x1","x2","func","x","dx","Math","abs","solveFromX","max","min","easingName","steps","count","position","time","level","floor","STEP_START","STEP_END","LINEAR","EASE","EASE_IN","EASE_OUT","EASE_IN_OUT","PREFIX","DATA_SCENE_ID","TIMING_FUNCTION","ROLES","transform","filter","attribute","html","ALIAS","easing","FIXED","_a","MAXIMUM","THRESHOLD","DURATION","FILL_MODE","DIRECTION","ITERATION_COUNT","DELAY","EASING","PLAY_SPEED","EASING_NAME","PAUSED","ENDED","TIMEUPDATE","PLAY","RUNNING","ITERATION","START_ANIMATION","PAUSE_ANIMATION","ALTERNATE","REVERSE","ALTERNATE_REVERSE","INFINITE","PLAY_STATE","PLAY_CSS","PREV_TIME","TICK_TIME","CURRENT_TIME","SELECTOR","TRANSFORM_NAME","EASINGS","NAME_SEPARATOR","OPTIONS","EVENTS","events","name","callback","once","this","isObject","n","_on","isArray","forEach","_this","push","callback2","_i","args","off","callbacks","index","indexOf","splice","data","target","type","currentTarget","toArray","apply","value","options","setOptions","isString","split","separator","newOptions","length","prefix","suffix","model","PropertyObject","map","v","clone","join","toValue","arrayToColorObject","arr","RGBA","arrayToPropertyObject","toPropertyObject","values","splitComma","splitSpace","exec","text","splitBracket","afterModel","COLOR_MODELS","stringToRGBA","obj","stringToBracketObject","charAt","result","stringToColorObject","isPropertyObject","getType","OBJECT","ARRAY","PROPERTY","STRING","NUMBER","isPureObject","constructor","Object","getNames","names","stack","concat","pop","slice","toFixed","num","round","getValueByNames","properties","i","isInProperties","roles","isCheckTrue","role","isRole","isFixed","setPlayCSS","item","isActivate","state","isPausedCSS","isPaused","isEndedCSS","isEnded","makeId","selector","id","random","IS_WINDOW","$","getRealId","getId","setId","toId","match","playCSS","isExportCSS","playClassName","ANIMATION","getPlayState","className","addPlayClass","setTime","exportCSS","el","animationend","finish","animationstart","trigger","addEvent","animationiteration","duration","getDuration","isZeroDuration","isFinite","removeEvent","currentTime","iterationCount","setIteration","addAnimationEvent","setPlayState","getEasing","curveArray","parseFloat","isDirectionReverse","iteration","iteraiontCount","direction","setters","getters","_super","delay","fillMode","playSpeed","iterationTime","tickTime","prevTime","playState","__extends","setDuration","setEasing","getActiveDuration","Infinity","getTime","toTime","timerId","requestAnimationFrame","tick","start","cancelAnimationFrame","end","pause","isTick","isParent","activeDuration","getUnitTime","calculate","isDelay","getIterationTime","splitUnit","unit","passIterationCount","maxIterationCount","currentIterationTime","setIterationTime","isReverse","isFiniteDuration","now","to","Animator","getter","setter","parent","prototype","camelize","GetterSetter","EventTrigger","toInnerProperties","orders","arrObj","keys","getKeys","sortOrders","replace","merge","from","FUNCTION","getValue","getPropertyName","OrderMap","set","raw","orderMap","get","setObject","key","children","gets","params","remove","self","firstParam","Frame","_set","toObject","object","size","has","str","splitText","matches","trim","styles","splitStyle","stylesLength","isUndefined","frame","setOrderObject","frameProperties","cssObject","FILTER","TRANSFORM","toCSSObject","cssArray","clear","lastParam","add","dotArray","a1","a2","b1","b2","v1","dot","dotObject","a1Type","color1","color2","value1","value2","model1","colorModel","parseInt","dotColor","type1","type2","isFunction1","isFunction2","v2","isNaN","dotNumber","getNearTimeIndex","times","makeAnimationProperties","decamelize","addEntry","entries","keytime","prevEntry","load","originalDuration","ratio_1","items_1","obj_1","time2","items","newFrame","elements","sceneId_1","element","setAttribute","SceneItem","eachTime","realTime","innerValue","value_1","getDelay","frames","hasFrame","getDirection","frameTime","nextTime","needUpdate","getFrame","update","nameMap","updateFrameOrders","removeFrame","append","unshiftTime","firstFrame","unshift","prepend","isStartZero","isFunction","setElement","Element","style","targetFunc","attributes","html_1","innerHTML","cssText","toCSS","fromCSS","parentEasing","getNowFrame","temp","prevNameMap","updateFrame","pushKeys","nextMap","setFrame","addTime","isAccurate","left","right","realEasing","hasName","nowEasing","getNowValue","prevFrame_1","prevOrderMap","keyframes","setTarget","setSelector","playCondition","parentDuration","states","itemState","reversedStates","reverse","superParent","infiniteIndex","findIndex","finiteStates","reduce","prev","cur","find","timingFunction","selectors","sel","selectorCallback","peusdo","KEYFRAMES","_toKeyframes","css","styledInjector","destroy","styled","inject","getAnimationElement","original","pauseCSS","addClass","removeClass","endCSS","hasClass","clientWidth","usePrevValue","prevFrame","nextFrame","isUndefinedLeft","isUndefinedRight","indicies","prevValue","undefined","nextValue","ratio","dotValue","nextEntries","intCount","ceil","currentDuration","lastTime","j","entry","divideTime","getEntries","lastEntry","getTotalDuration","getPlaySpeed","sceneDuration","setDelay","setItem","parentStates","totalDuration","animtionElement","Scene","scene","newItem","isItFunction","isProperty","isFixedProperty","fixed","alias","play","others"],"mappings":";;;;;;;;6rBAEA,SAASA,EAAMC,EAAYC,EAAYC,OAC/BC,EAAK,EAAID,SAGRA,EAAIA,EAAIA,EAAI,EAAIA,EAAIA,EAAIC,EAAKF,EAAK,EAAIC,EAAIC,EAAKA,EAAKH,WAsC7CI,EAAOC,EAAYL,EAAYM,EAAYL,GAM5B,SAAvBM,EAAwBC,OACtBN,EA3CV,SAAoBG,EAAYC,EAAYE,WAGtCN,EAAIM,EAEJC,EAAK,EAEa,KAAfC,KAAKC,IAAIF,IAAgB,IAG9BA,EADSV,EAAMM,EAAIC,EAAIJ,GACTM,EAEVE,KAAKC,IAAIF,GAAM,YACVP,EAETA,GAAKO,EAAK,SAELP,EA0BKU,CAAWP,EAAIC,EAAII,KAAKG,IAAIH,KAAKI,IAAI,EAAGN,GAAI,WAE/CT,EAAMC,EAAIC,EAAIC,UAGvBK,EAAKQ,WAAa,gBAAgBV,MAAML,MAAMM,MAAML,MAC7CM,WAeOS,EAAMC,EAAeC,GACN,SAAvBX,EAAwBY,OACtBC,EAAQ,EAAIH,SAEN,GAARE,EACK,GAEY,UAAbD,EAAuBE,EAAQ,GAAKV,KAAKW,MAAMF,EAAOC,GAASA,SAGzEb,EAAKQ,WAAa,SAASE,OAAUC,MAE9BX,kMAaF,MAAMe,EAA2BN,EAAM,EAAG,SAWpCO,EAAyBP,EAAM,EAAG,OAWlCQ,EAAuBpB,EAAO,EAAG,EAAG,EAAG,GAWvCqB,EAAq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