This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function aperture(n, arr) { | |
if (n > arr.length) { | |
return []; | |
} else { | |
return arr.slice(n - 1) // makes a COPY (does NOT modify arr) starting at the index of n - 1 (that's the only argument of slice in this case). | |
// slice is applied here basically to set the returned array with the proper length. For tuples it'd be equal to n minus one, always. | |
.map( // Manipulates array in previous line going through each of the elements. Renamed variables for your better understanding | |
// going through each of the n-1 array, it'll modify each entry to accomodate a different value. | |
(currentValue, currentIndex) => arr.slice(currentIndex, currentIndex + n) // each element is then replaced by a sliced arr (the original one, in the argument) starting at currentIndex (so first item would be 0, the beginning of arr) and stopping at currentIndex + n (here's the n-tuples magic!) | |
// notice how currentValue (the value of the instance being analysed in th |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {anime} from 'anime.js'; | |
class Parallaxer { | |
constructor(args = { | |
selector: '[data-parallax]' | |
}) { | |
this.argSelector = args.selector | |
this.easeFunction = 'easeOutSine' | |
this.interactiveElements = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parallaxer { | |
constructor(args = { | |
selector: '[data-parallax]' | |
}) { | |
this.argSelector = args.selector; | |
this.easeFunction = 'easeOutSine' | |
this.interactiveElements = [] | |
this.refreshGlobals() | |
this.setupAll() |