How to use the ember-animated.wait function in ember-animated

To help you get started, we’ve selected a few ember-animated 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 / tests / dummy / app / pods / index / utils / animated-code-diff / component.js View on Github external
if (this.isShowingFinal) {
      removedSprites.forEach(fadeOut);

      // Need to set inserted sprites to 0 opacity in case their animation is interrupted
      insertedSprites.forEach(sprite => {
        sprite.applyStyles({
          opacity: '0'
        });
      });

      keptSprites.map(sprite => {
        fadeIn(sprite);
        move(sprite);
      });

      yield wait(duration);

      while (this.animationPaused) {
        yield wait(100);
      }

      // this.set('isAnimatingInsertedLines', true);
      this.onAnimationChange(true);

      for (let sprite of insertedSprites) {
        sprite.moveToFinalPosition();
        sprite.applyStyles({
          overflow: 'hidden',
          opacity: '1',
          display: 'inline-block',
          width: 'auto'
        });
github ember-animation / ember-animated / tests / dummy / app / components / swap-nested.js View on Github external
//
      // These receivedSprites are homed inside the receivedSprite that is doing
      // the outerBox transition. I *think* that if we moved *both* of them to
      // initial position of their matched sprites, their relative positioning
      // may make sense?
      //
      // TODO: either design an API that makes moved-by-default explicit instead
      // of implicit, OR see if there is an automatic nested behavior that we're
      // failing to do.
      sprite.moveToFinalPosition();

      sprite.applyStyles({ opacity: 0 });
    });

    if (receivedSprites.length > 0) {
      yield wait(duration * 0.8);
      receivedSprites.forEach(sprite => {
        opacity(sprite, { from: 0, to: 1, duration: duration * 0.2 });
      });
    }
  },
github ember-animation / ember-animated / tests / dummy / app / pods / index / utils / animated-code-diff / component.js View on Github external
width: 'auto'
        });

        let totalWidth = sprite.element.getBoundingClientRect().width;
        let chars = sprite.element.textContent;
        let characterWidth = totalWidth / chars.length;

        sprite.reveal();

        for (var i = 0; i < chars.length; i++) {
          sprite.applyStyles({
            width: characterWidth * (i + 1)
          });

          if (chars[i] !== " ") {
            yield wait(15);
          }

        }
      }

      // this.set('isAnimatingInsertedLines', false);
      this.onAnimationChange(false);

    } else {
      removedSprites.forEach(fadeOut);
      keptSprites.map(sprite => {
        fadeIn(sprite);
        move(sprite);
      });
      insertedSprites.forEach(fadeIn);
    }
github ember-animation / ember-animated / tests / dummy / app / pods / index / utils / animated-code-diff / component.js View on Github external
// Need to set inserted sprites to 0 opacity in case their animation is interrupted
      insertedSprites.forEach(sprite => {
        sprite.applyStyles({
          opacity: '0'
        });
      });

      keptSprites.map(sprite => {
        fadeIn(sprite);
        move(sprite);
      });

      yield wait(duration);

      while (this.animationPaused) {
        yield wait(100);
      }

      // this.set('isAnimatingInsertedLines', true);
      this.onAnimationChange(true);

      for (let sprite of insertedSprites) {
        sprite.moveToFinalPosition();
        sprite.applyStyles({
          overflow: 'hidden',
          opacity: '1',
          display: 'inline-block',
          width: 'auto'
        });

        let totalWidth = sprite.element.getBoundingClientRect().width;
        let chars = sprite.element.textContent;
github ef4 / living-animation / src / ui / routes / affordances / index / controller.js View on Github external
let magnify = awayDistance * screenBounds.width / distanceFromCenter;

      // our sprite's center and the screen's center form a line. We
      // want to aim for a place along that line far offscreen.
      sprite.endAtPixel({ x: magnify * dx,  y: magnify * dy });
      distances.set(sprite, distanceFromCenter);

      // TODO: this is a workaround for an issue in ember-animated,
      // you shouldn't ever need to invoke this hook manually.
      arguments[0].onMotionStart(sprite);
    });

    removedSprites.sort((a,b) => distances.get(b) - distances.get(a));
    for (let sprite of removedSprites) {
      move(sprite, { easing: easeIn });
      yield wait(perSpriteDelay);
    }

    sentSprites.concat(receivedSprites).forEach(sprite => {
      sprite.applyStyles({
        zIndex: 1
      });
      move(sprite);
      scale(sprite);
    });

    receivedSprites.forEach(sprite => {
      motionCenterX = sprite.absoluteFinalBounds.left + sprite.absoluteFinalBounds.width / 2;
      motionCenterY = sprite.absoluteFinalBounds.top + sprite.absoluteFinalBounds.height / 2;
    });
github ember-animation / ember-animated / tests / dummy / app / pods / index / demo-3 / component.js View on Github external
* shuffleWithStagger({ receivedSprites }) {
    for (let sprite of receivedSprites) {
      sprite.applyStyles({
        zIndex: (receivedSprites.length - receivedSprites.indexOf(sprite)) * 100
      });
      move(sprite);
      scale(sprite);

      yield wait(75);
    }
  },
github ember-animation / ember-animated / tests / dummy / app / controllers / demos / sandbox.js View on Github external
width: `${width * 0.6}px`,
      });

      yield wait(duration / 5);

      sprite.applyStyles({
        width: `${width * 0.8}px`,
      });

      yield wait(duration / 5);

      sprite.applyStyles({
        width: `${width}px`,
      });

      yield wait(duration / 5);
    }
  },
});
github cardstack / portfolio / packages / common / addon / components / moving-box.js View on Github external
inner: function * ({ receivedSprites, sentSprites, duration }) {
    sentSprites.forEach(sprite => {
      move(sprite);
      opacity(sprite, { to: 0, duration: duration * 0.2 });
      sprite.applyStyles({ 'z-index': 1 });
    });

    receivedSprites.forEach(sprite => {
      let diff = sprite.difference('finalBounds', sprite, 'initialBounds');
      sprite.translate(diff.dx, diff.dy);
      sprite.applyStyles({ opacity: 0 });
    });

    if (receivedSprites.length > 0) {
      yield wait(duration * 0.75);
      receivedSprites.forEach(sprite => {
        opacity(sprite, { from: 0, to: 1, duration: duration * 0.2 });
      });
    }
  },