-
-
Save AndrewRMillar/1ebb607385c5db9a4acf1291fdc6928a to your computer and use it in GitHub Desktop.
JS code for AnimeJS demo
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
| 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