(options, resolve)
| 276 | speed > 0 ? computeValue(value, index) / speed : 0; |
| 277 | |
| 278 | const addAnimations = (options, resolve) => { |
| 279 | const { |
| 280 | elements = null, |
| 281 | easing = "out-elastic", |
| 282 | duration = 1000, |
| 283 | delay: timeout = 0, |
| 284 | speed = 1, |
| 285 | loop = false, |
| 286 | optimize = false, |
| 287 | direction = "normal", |
| 288 | blur = null, |
| 289 | change = null, |
| 290 | ...rest |
| 291 | } = options; |
| 292 | |
| 293 | const last = { |
| 294 | totalDuration: -1 |
| 295 | }; |
| 296 | |
| 297 | getElements(elements).forEach(async (element, index) => { |
| 298 | const keyframes = createAnimationKeyframes(rest, index); |
| 299 | const animation = { |
| 300 | element, |
| 301 | keyframes, |
| 302 | loop, |
| 303 | optimize, |
| 304 | direction, |
| 305 | change, |
| 306 | easing: decomposeEasing(easing), |
| 307 | duration: setSpeed(speed, duration, index) |
| 308 | }; |
| 309 | |
| 310 | const animationTimeout = setSpeed(speed, timeout, index); |
| 311 | const totalDuration = animationTimeout + animation.duration; |
| 312 | |
| 313 | if (direction != "normal") |
| 314 | reverseKeyframes(keyframes); |
| 315 | |
| 316 | if (element) { |
| 317 | if (optimize) |
| 318 | accelerate(element, keyframes); |
| 319 | |
| 320 | if (blur) { |
| 321 | animation.blur = normalizeBlur(computeValue(blur, index)); |
| 322 | animation.gaussian = blurs.add(animation); |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | if (totalDuration > last.totalDuration) { |
| 327 | last.animation = animation; |
| 328 | last.totalDuration = totalDuration; |
| 329 | } |
| 330 | |
| 331 | if (animationTimeout) await delay(animationTimeout); |
| 332 | rAF.add(animation); |
| 333 | }); |
| 334 | |
| 335 | const {animation} = last; |
no test coverage detected