Skip to content

Instantly share code, notes, and snippets.

@AndrewRMillar
Forked from Kvaibhav01/anime.js
Last active September 19, 2019 06:27
Show Gist options
  • Select an option

  • Save AndrewRMillar/1ebb607385c5db9a4acf1291fdc6928a to your computer and use it in GitHub Desktop.

Select an option

Save AndrewRMillar/1ebb607385c5db9a4acf1291fdc6928a to your computer and use it in GitHub Desktop.
JS code for AnimeJS demo
var btn = document.getElementById('cta');
var btn2 = document.getElementById('cta2');
btn.onclick = function () {
var morphing = anime({
targets: '.polymorph',
points: [
{ value: '215, 110 0, 110 0, 0 47.7, 0 67, 76' },
{ value: '215, 110 0, 110 0, 0 0, 0 67, 76' }
],
easing: 'easeOutQuad',
duration: 1200,
loop: false
});
anime({
targets: '#blip',
opacity: 1,
duration: 500,
translateY: 150
});
var promise = morphing.finished.then(() => {
btn2.onclick = function () {
var morphing = anime({
targets: '.polymorph',
points: [
{ value: '215, 110 0, 110 0, 0 47.7, 0 67, 76' },
{ value: '215,110 0,110 0,0 49.3,0 215,0' }
],
easing: 'easeOutQuad',
duration: 1200,
loop: false
});
anime({
targets: '#blip',
opacity: 0,
duration: 500,
translateY: -800
});
};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment