pages/advent/assets/amator.8216e0d2.js

1 line
2.2 KiB
JavaScript

import{s as j}from"./bezier-easing.a990b400.js";var I=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function M(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function P(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach(function(n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}),t}var v={exports:{}},l=j,b={ease:l(.25,.1,.25,1),easeIn:l(.42,0,1,1),easeOut:l(0,0,.58,1),easeInOut:l(.42,0,.58,1),linear:l(0,0,1,1)};v.exports=F;v.exports.makeAggregateRaf=y;v.exports.sharedScheduler=y();function F(e,t,n){var a=Object.create(null),o=Object.create(null);n=n||{};var i=typeof n.easing=="function"?n.easing:b[n.easing];i||(n.easing&&console.warn("Unknown easing function in amator: "+n.easing),i=b.ease);var d=typeof n.step=="function"?n.step:h,u=typeof n.done=="function"?n.done:h,c=E(n.scheduler),w=Object.keys(t);w.forEach(function(r){a[r]=e[r],o[r]=t[r]-e[r]});var x=typeof n.duration=="number"?n.duration:400,g=Math.max(1,x*.06),f,s=0;return f=c.next(p),{cancel:O};function O(){c.cancel(f),f=0}function p(){var r=i(s/g);s+=1,A(r),s<=g?(f=c.next(p),d(e)):(f=0,setTimeout(function(){u(e)},0))}function A(r){w.forEach(function(m){e[m]=o[m]*r+a[m]})}}function h(){}function E(e){if(!e){var t=typeof window!="undefined"&&window.requestAnimationFrame;return t?S():T()}if(typeof e.next!="function")throw new Error("Scheduler is supposed to have next(cb) function");if(typeof e.cancel!="function")throw new Error("Scheduler is supposed to have cancel(handle) function");return e}function S(){return{next:window.requestAnimationFrame.bind(window),cancel:window.cancelAnimationFrame.bind(window)}}function T(){return{next:function(e){return setTimeout(e,1e3/60)},cancel:function(e){return clearTimeout(e)}}}function y(){var e=new Set,t=new Set,n=0;return{next:o,cancel:o,clearAll:a};function a(){e.clear(),t.clear(),cancelAnimationFrame(n),n=0}function o(u){t.add(u),i()}function i(){n||(n=requestAnimationFrame(d))}function d(){n=0;var u=t;t=e,e=u,e.forEach(function(c){c()}),e.clear()}}export{v as a,M as b,I as c,P as g};