Thank you @Rodrigo !
I updated the code as you suggested: https://codesandbox.io/p/sandbox/jolly-kalam-tspd3w?file=/src/pages/Home/index.jsx:21,36
I followed the steps of the FLIP acronym (inside useLayoutContext() and gsap.context() since i'm using react) :
F -> First i define the state:
const state = Flip.getState('.flip-container');
//btw , this produces "Invalid scope" warning in chrome dev tools, but may be related to this
L -> Lastly i insert how i want the result to be:
const container = document.querySelector(".flip-container");
const target = document.querySelector(".flip-target");
console.log(state)
setTimeout(() => {
target.appendChild(container)
}, 2000);
Finally , i call the Flip.from() method in order to animate the transition:
Flip.from(state, {
absolute:'.flip-container',
targets: ".flip-container",
duration: 1
})
here i call both
•the absolute property (because documentation says "This solves layout challenges with flexbox, grid, etc" ) and infact the header is inside a flex;
•the targets because documentation states this while using flip with a framework like react.
Still the preparenting effect is not animated by the Flip.
What am i missing ?