I'm trying to learn to how to create something similar to this animation: https://dribbble.com/shots/5311359-Diprella-Login
So currently the issue i have is when the "Green" or "Blue" in my case expands > moves > shrinks i cant get the same effect with using "Width" because it shrinks from right side, where i want it to shrink from left side after it moves.
Attaching my CodePen: https://codepen.io/MariusZMM/pen/jJWebK
JS used:
var start = anime.timeline({
easing: 'easeInOutSine',
autoplay: false
});
start
.add({
targets: '.square',
width: 600,
duration: 500
})
.add(
{
targets: '.square',
translateX: 400,
duration: 500
},
'-=100'
)
.add({
targets: '.square',
width: 400,
duration: 500
});
document.querySelector('.btn').onclick = function() {
start.play();
if (start.began) {
start.reverse();
}
};
I have also tried using Padding but i think AnimeJS does not like the values 0 0 0 300px