How to use the liquid-fire.Promise.resolve function in liquid-fire

To help you get started, we’ve selected a few liquid-fire examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ember-animation / ember-animated / app / views / liquid-outlet.js View on Github external
_adaptDimension: function(dimension, before, after) {
    if (before[dimension] === after[dimension] || !this.get('enableGrowth')) {
      var elt = this.$();
      if (elt) {
        elt[dimension](after[dimension]);
      }
      return Promise.resolve();
    } else {
      // Velocity deals in literal width/height, whereas jQuery deals
      // in box-sizing-dependent measurements.
      var target = {};
      target[dimension] = [
        after['literal'+capitalize(dimension)],
        before['literal'+capitalize(dimension)],
      ];
      return animate(this, target, {
        duration: this._durationFor(before[dimension], after[dimension]),
        queue: false,
        easing: this.get('growEasing')
      });
    }
  },
github runspired / liquid-fire-ios / addon / transitions / move-over-half.js View on Github external
var overlay = jQuery('<div class="transition-overlay"></div>');
  elementToOverlay.append(overlay);

  if (dimension.toLowerCase() === 'x') {
    property = 'translateX';
    measure = 'width';
  } else {
    property = 'translateY';
    measure = 'height';
  }

  if (isAnimating(this.oldElement, 'moving-in')) {
    firstStep = finish(this.oldElement, 'moving-in');
  } else {
    stop(this.oldElement);
    firstStep = Promise.resolve();
  }

  return firstStep.then(() =&gt; {
    var bigger = biggestSize(this, measure);

    this.oldElement[0].style.zIndex = direction &gt; 0 ? 5 : 0;
    this.newElement[0].style.zIndex = direction &gt; 0 ? 0 : 5;

    oldParams[property] = (bigger * (direction &gt; 0 ? 1 : -0.5)) + 'px';
    newParams[property] = ["0px", (bigger * (direction &gt; 0 ? -0.5 : 1)) + 'px'];

    return Promise.all([
      animate(overlay, overlayParams, opts),
      animate(this.oldElement, oldParams, opts),
      animate(this.newElement, newParams, opts, 'moving-in')
    ]).then(() =&gt; overlay.remove());
github pzuraq / liquid-tether / app / transitions / fly-to.js View on Github external
export default function flyTo(opts={}) {
  if (!this.newElement) {
    return Promise.resolve();
  } else if (!this.oldElement) {
    this.newElement.css({visibility: ''});
    return Promise.resolve();
  }

  var oldTarget = this.oldElement.find('.liquid-tether').length ?
                  this.oldElement.find('.liquid-tether').children().eq(0) :
                  this.oldElement;

  var newTarget = this.newElement.find('.liquid-tether').length ?
                  this.newElement.find('.liquid-tether').children().eq(0) :
                  this.newElement;

  var oldOffset = oldTarget.offset();
  var newOffset = newTarget.offset();
github html-next / vertical-collection / addon / transitions / default.js View on Github external
export default function defaultTransition() {
  if (this.newElement) {
    this.newElement.css({visibility: ''});
  }
  if (this.newView) {
    var view = getRealChildView(this.newView);
    if (view && view.didAnimateTransition) {
      view.didAnimateTransition();
    }
  }
  return Promise.resolve();
}
github html-next / vertical-collection / addon / transitions / move-over-half.js View on Github external
var overlay = jQuery('<div class="transition-overlay"></div>');
  this.oldElement.append(overlay);

  if (dimension.toLowerCase() === 'x') {
    property = 'translateX';
    measure = 'width';
  } else {
    property = 'translateY';
    measure = 'height';
  }

  if (isAnimating(this.oldElement, 'moving-in')) {
    firstStep = finish(this.oldElement, 'moving-in');
  } else {
    stop(this.oldElement);
    firstStep = Promise.resolve();
  }

  return firstStep.then(() =&gt; {
    var bigger = biggestSize(this, measure);

    this.oldElement[0].style.zIndex = direction &gt; 0 ? 5 : 0;
    this.newElement[0].style.zIndex = direction &gt; 0 ? 0 : 5;

    oldParams[property] = (bigger * (direction &gt; 0 ? 1 : -0.5)) + 'px';
    newParams[property] = ["0px", (bigger * (direction &gt; 0 ? -0.5 : 1)) + 'px'];

    return Promise.all([
      animate(overlay, overlayParams, opts),
      animate(this.oldElement, oldParams, opts),
      animate(this.newElement, newParams, opts, 'moving-in')
    ]);
github pzuraq / liquid-tether / app / transitions / move-over.js View on Github external
property,
      measure;

  if (dimension.toLowerCase() === 'x') {
    property = 'translateX';
    measure = 'width';
  } else {
    property = 'translateY';
    measure = 'height';
  }

  if (isAnimating(this.oldElement, 'moving-in')) {
    firstStep = finish(this.oldElement, 'moving-in');
  } else {
    stop(this.oldElement);
    firstStep = Promise.resolve();
  }

  return firstStep.then(() => {
    var bigger = biggestSize(this, measure);
    oldParams[property] = (bigger * direction) + 'px';
    newParams[property] = ["0px", (-1 * bigger * direction) + 'px'];

    return Promise.all([
      animate(this.oldElement, oldParams, opts),
      animate(this.newElement, newParams, opts, 'moving-in')
    ]);
  });
}
github runspired / liquid-fire-hooks / addon / transitions / default.js View on Github external
this.newElement.css({visibility: ''});
  }

  if (this.newView) {
    const component = getComponent(this.newView);

    if (component) {
      if (component.didAnimateTransition) {
        component.didAnimateTransition();
      }
      if (component.trigger) {
        component.trigger('didAnimateTransition');
      }
    }
  }
  return Promise.resolve();

}
github cardstack / ember-toolbars / addon / transition-helpers.js View on Github external
export function waitForPrevious(context, name) {
  if (isAnimating(context.oldElement, name)) {
    return finish(context.oldElement, name);
  } else {
    stop(context.oldElement);
    return Promise.resolve();
  }
}