This file contains 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
var assert = require('assert'); | |
/** | |
* Flattens array that are nested at n levels. | |
* @param {Array} arr The array to be flattened | |
* @return {Array} New array with flattened elements. | |
* ---------------------------------------------------------- | |
*/ | |
function flatten(arr) { | |
if(!arr) { | |
return []; |
This file contains 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
const animeObject = anime({ | |
/* describe animation */ | |
}); |
This file contains 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
{ | |
/* Animation Targets: div, .box, #sky, etc... */ | |
/* Animatable Properties: height, opacity, color, translateX, etc ... */ | |
/* Property Parameters: duration, delay, easing, etc... */ | |
/* Animation Properties: loop, direction, autoplay, etc... */ | |
} |
This file contains 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
anime({ | |
targets: '#box', | |
translateX: 200, | |
}); |
This file contains 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
const boxesAnimation = anime({ | |
targets: '.js-box', | |
translateX: (elm, index, t) => index * 50, | |
scale: 2, | |
easing: 'easeInOutSine', | |
delay: (elm, index, t) => index * 20, | |
duration: 1200, | |
loop: true, | |
direction: 'alternate', | |
}); |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<link rel="stylesheet" href="/squares.css"> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/animejs/2.2.0/anime.js"></script> | |
<title>Anime Animation</title> | |
</head> | |
<body> | |
<div class="boxes"> |
This file contains 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
html, body { | |
padding: 0; | |
margin: 0; | |
background-color: #25275a; | |
width: 100%; | |
height: 100%; | |
} | |
.box { | |
width: 50px; | |
height: 150px; |
This file contains 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
const boxesAnimation = window.anime({ | |
targets: '.js-box', | |
translateY: [150, 50], | |
backgroundColor: (el, i, t) => { | |
const r = 58 + (i * 12); | |
const g = 35 + (i * 12); | |
const b = 220; | |
const color = `rgb(${r}, ${g}, ${b})`; | |
return color; | |
}, |
This file contains 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
anime({ | |
property: { | |
value: ..., | |
transition: ..., | |
duration: ..., | |
/* etc */ | |
} | |
}); |
This file contains 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
anime({ | |
scale: { | |
value: 2, | |
transition: 'linear', | |
duration: 1000, | |
}, | |
opacity: 1, | |
height: [0, 100], | |
transition: 'easeInOutSine', | |
duration: 500, |
OlderNewer