UNPKG

@huluvu424242/honey-slideshow

Version:

Text to Speech component wich is reading texts from DOM elements.

62 lines (58 loc) 2.28 kB
'use strict'; require('./index-99ba775b.js'); require('./helpers-0a6f41ce.js'); const animation = require('./animation-6bf85eb3.js'); const index$1 = require('./index-5b797ee0.js'); const mdTransitionAnimation = (_, opts) => { const OFF_BOTTOM = '40px'; const CENTER = '0px'; const backDirection = (opts.direction === 'back'); const enteringEl = opts.enteringEl; const leavingEl = opts.leavingEl; const ionPageElement = index$1.getIonPageElement(enteringEl); const enteringToolbarEle = ionPageElement.querySelector('ion-toolbar'); const rootTransition = animation.createAnimation(); rootTransition .addElement(ionPageElement) .fill('both') .beforeRemoveClass('ion-page-invisible'); // animate the component itself if (backDirection) { rootTransition .duration(opts.duration || 200) .easing('cubic-bezier(0.47,0,0.745,0.715)'); } else { rootTransition .duration(opts.duration || 280) .easing('cubic-bezier(0.36,0.66,0.04,1)') .fromTo('transform', `translateY(${OFF_BOTTOM})`, `translateY(${CENTER})`) .fromTo('opacity', 0.01, 1); } // Animate toolbar if it's there if (enteringToolbarEle) { const enteringToolBar = animation.createAnimation(); enteringToolBar.addElement(enteringToolbarEle); rootTransition.addAnimation(enteringToolBar); } // setup leaving view if (leavingEl && backDirection) { // leaving content rootTransition .duration(opts.duration || 200) .easing('cubic-bezier(0.47,0,0.745,0.715)'); const leavingPage = animation.createAnimation(); leavingPage .addElement(index$1.getIonPageElement(leavingEl)) .onFinish(currentStep => { if (currentStep === 1 && leavingPage.elements.length > 0) { leavingPage.elements[0].style.setProperty('display', 'none'); } }) .fromTo('transform', `translateY(${CENTER})`, `translateY(${OFF_BOTTOM})`) .fromTo('opacity', 1, 0); rootTransition.addAnimation(leavingPage); } return rootTransition; }; exports.mdTransitionAnimation = mdTransitionAnimation;