@expofp/floorplan
Version:
Interactive floor plan library for expos and events
2 lines (1 loc) • 758 B
JavaScript
import{__decorate as l}from"tslib";import{easeQuadInOut as b}from"d3-ease";import{observable as A,reaction as M}from"mobx";const s=new Map;export default class a{constructor(t){this.booth=t,N(()=>t.selected,n=>this.selectBgAnimationPart=b(n),1e3,8,!0)}static get(t){let n=s.get(t);return n||(n=new a(t),s.set(t,n)),n}}l([A],a.prototype,"selectBgAnimationPart",void 0);function N(c,t,n,i,m){const p=m?u:f;i%2===1&&i++,M(c,()=>{if(c()){const o=performance.now(),r=o+i*n,e=()=>{if(c()){if(performance.now()>=r){t(1);return}t(p(o,n)),window.requestAnimationFrame(e)}};e()}else t(0)},{fireImmediately:!0});function f(o,r){return(performance.now()-o)%r/1e3}function u(o,r){const d=((performance.now()-o)%(r*2)-r)/1e3;return 1-Math.abs(Math.abs(d)-r/1e3)/(r/1e3)}}