Skip to content

Instantly share code, notes, and snippets.

View fredericoo's full-sized avatar

✦ freddie fredericoo

View GitHub Profile
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
import {anime} from 'anime.js';
class Parallaxer {
constructor(args = {
selector: '[data-parallax]'
}) {
this.argSelector = args.selector
this.easeFunction = 'easeOutSine'
this.interactiveElements = []
class Parallaxer {
constructor(args = {
selector: '[data-parallax]'
}) {
this.argSelector = args.selector;
this.easeFunction = 'easeOutSine'
this.interactiveElements = []
this.refreshGlobals()
this.setupAll()