SHARE
TWEET

Untitled

a guest Aug 18th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. shiftContentOver({ silently = false } = {}): void {
  2.   this.contentTransitionDuration = `${silently ? '0' : this.animDuration}s`;
  3.   this.contentLeft = `-${this.blockWidth}`;
  4. }
  5.  
  6. shiftContentBack({ silently = false } = {}): void {
  7.   this.contentTransitionDuration = `${silently ? '0' : this.animDuration}s`;
  8.   this.contentLeft = '0';
  9. }
  10.  
  11. shift(forward: boolean): void {
  12.   if (this.isAnimating) return;
  13.   this.isAnimating = true;
  14.   const coefficient = forward ? this.blocksAtOnce : -1;
  15.   const newBlock = this.blocks.atBeyond(this.index + coefficient);
  16.   this.visibleBlocks.insert(newBlock, forward);
  17.   this.shiftContentOver({ silently: !forward });
  18.   if (!forward) setTimeout(this.shiftContentBack, 0);
  19.   this.index += forward ? 1 : -1;
  20.   setTimeout((): void => {
  21.     this.visibleBlocks.remove(!forward);
  22.     if (forward) this.shiftContentBack({ silently: true });
  23.     this.isAnimating = false;
  24.   }, this.animDuration * 1000);
  25. }
  26.  
  27. shiftLeft(): void {
  28.   this.shift(true);
  29. }
  30.  
  31. shiftRight(): void {
  32.   this.shift(false);
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top