{"version":3,"file":"AnimationUtil.635f4748.js","sources":["../../app/javascript/v2/utils/AnimationUtil.js"],"sourcesContent":["import {inView, animate} from \"motion\"\n\nexport default class AnimationUtil {\n constructor() {\n this.initAnimations()\n }\n\n setUp(animationType, animationTrigger, elementSelector) {\n if (animationType === 'none') {\n return\n }\n\n let animation = this.getAnimation(animationType)\n\n if (animationTrigger === 'In View') {\n this.inViewAnimation(animation, elementSelector)\n return\n }\n\n animate(elementSelector, animation.keyframes, animation.options)\n }\n\n inViewAnimation(animation, elementSelector) {\n inView(elementSelector, (animationElement) => {\n animate(animationElement.target, animation.keyframes, animation.options)\n })\n }\n\n getAnimation(animationType) {\n if (animationType === 'Fade Up') {\n return this.animations.FloatUp\n } else if (animationType === 'Fade Right') {\n return this.animations.FadeRight\n } else if (animationType === 'Fade Left') {\n return this.animations.FadeLeft\n } else if (animationType === 'Rotate') {\n return this.animations.Flip\n }\n }\n\n initAnimationProperty() {\n return {\n type: 'none',\n trigger: ''\n }\n }\n\n initAnimations() {\n this.animations = {\n Flip: this.flipTransform(),\n FloatUp: this.floatUpTransform(),\n FadeRight: this.fadeRightTransform(),\n FadeLeft: this.fadeLeftTransform()\n }\n }\n\n fadeRightTransform() {\n return {\n keyframes: {\n opacity: [0, 1],\n transform: [\"translateX(-5rem)\", \"translateX(0px)\"]\n },\n options: {\n duration: 2\n }\n }\n }\n\n fadeLeftTransform() {\n return {\n keyframes: {\n opacity: [0, 1],\n transform: [\"translateX(5rem)\", \"translateX(0px)\"]\n },\n options: {\n duration: 2\n }\n }\n }\n\n floatUpTransform() {\n return {\n keyframes: {\n opacity: [0, 1],\n transform: [\"translateY(5rem)\", \"translateY(0px)\"]\n },\n options: {\n duration: 2\n }\n }\n }\n\n flipTransform() {\n return {\n keyframes: {\n transform: [\n \"perspective(1200px) rotate3d(1, 0, 0, 90deg)\",\n \"perspective(1200px) rotate3d(1, 0, 0, 60deg)\",\n \"perspective(1200px) rotate3d(1, 0, 0, 30deg)\",\n \"perspective(1200px) rotate3d(1, 0, 0, 15deg)\",\n \"perspective(1200px)\",\n ]\n },\n options: {\n duration: 1.5\n }\n }\n }\n}"],"names":["AnimationUtil","animationType","animationTrigger","elementSelector","animation","animate","inView","animationElement"],"mappings":"+EAEe,MAAMA,CAAc,CAC/B,aAAc,CACV,KAAK,eAAgB,CACxB,CAED,MAAMC,EAAeC,EAAkBC,EAAiB,CACpD,GAAIF,IAAkB,OAClB,OAGJ,IAAIG,EAAY,KAAK,aAAaH,CAAa,EAE/C,GAAIC,IAAqB,UAAW,CAChC,KAAK,gBAAgBE,EAAWD,CAAe,EAC/C,MACH,CAEDE,EAAQF,EAAiBC,EAAU,UAAWA,EAAU,OAAO,CAClE,CAED,gBAAgBA,EAAWD,EAAiB,CACxCG,EAAOH,EAAkBI,GAAqB,CAC1CF,EAAQE,EAAiB,OAAQH,EAAU,UAAWA,EAAU,OAAO,CACnF,CAAS,CACJ,CAED,aAAaH,EAAe,CACxB,GAAIA,IAAkB,UAClB,OAAO,KAAK,WAAW,QACpB,GAAIA,IAAkB,aACzB,OAAO,KAAK,WAAW,UACpB,GAAIA,IAAkB,YACzB,OAAO,KAAK,WAAW,SACpB,GAAIA,IAAkB,SACzB,OAAO,KAAK,WAAW,IAE9B,CAED,uBAAwB,CACpB,MAAO,CACH,KAAM,OACN,QAAS,EACZ,CACJ,CAED,gBAAiB,CACb,KAAK,WAAa,CACd,KAAM,KAAK,cAAe,EAC1B,QAAS,KAAK,iBAAkB,EAChC,UAAW,KAAK,mBAAoB,EACpC,SAAU,KAAK,kBAAmB,CACrC,CACJ,CAED,oBAAqB,CACjB,MAAO,CACH,UAAW,CACP,QAAS,CAAC,EAAG,CAAC,EACd,UAAW,CAAC,oBAAqB,iBAAiB,CACrD,EACD,QAAS,CACL,SAAU,CACb,CACJ,CACJ,CAED,mBAAoB,CAChB,MAAO,CACH,UAAW,CACP,QAAS,CAAC,EAAG,CAAC,EACd,UAAW,CAAC,mBAAoB,iBAAiB,CACpD,EACD,QA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