Sha256: fbb82e870ad9c9ac346c1e679c84996cf4dba85c6434625744bebd4ab0fcbe6b

Contents?: true

Size: 1.4 KB

Versions: 64

Compression:

Stored size: 1.4 KB

Contents

import Fade from './transitions/fade';
import Translate from './transitions/translate';

export default class Transitioner {
	constructor(slider) {
		this.slider = slider;
		this.options = slider.options;

		this._animating = false;
		this._animation = undefined;

		this._translate = new Translate(this, slider, slider.options);
		this._fade = new Fade(this, slider, slider.options);
	}

	init() {
		this._fade.init();
		this._translate.init();
		return this;
	}

	isAnimating() {
		return this._animating;
	}

	enable() {
		this._animation && this._animation.enable();
	}

	disable() {
		this._animation && this._animation.disable();
	}

	apply(force, callback) {
		// If we don't force refresh and animation in progress then return
		if (this._animating && !force) {
			return;
		}

		switch (this.options.effect) {
			case 'fade':
				this._animation = this._fade;
				break;
			case 'translate':
			default:
				this._animation = this._translate;
				break;
		}

		this._animationCallback = callback;

		if (force) {
			this._animation && this._animation.disable();
		} else {
			this._animation && this._animation.enable();
			this._animating = true;
		}

		this._animation && this._animation.apply();

		if (force) {
			this.end();
		}
	}

	end() {
		this._animating = false;
		this._animation = undefined;
		this.slider.state.index = this.slider.state.next;
		if (this._animationCallback) {
			this._animationCallback();
		}
	}
}

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
intia-theme-0.1.65 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.64 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.63 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.62 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.61 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.60 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.59 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.58 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.57 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.56 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.55 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.54 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.53 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.52 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.51 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.50 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.49 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.48 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.47 node_modules/bulma-carousel/src/js/components/transitioner.js
intia-theme-0.1.46 node_modules/bulma-carousel/src/js/components/transitioner.js