Hey Everyone! So I'm 100% new to Tweening, GSAP and this forum, I have a board game I'm making in Three.js and I need to animate a piece moving one square (with an a flip animation) over and over again, the path the pieces take is set (unless it gets knocked off the board, then it's back to the start) so I know the exact to and from positions. The to and from positions and the direction and the direction of the flip need to be dynamic since the piece and it's location changing every turn. I need to have dynamically changing timeline, I plan to use the same animation timeline for every piece, so even the model has to be dynamic, I have come up with using a function to create a timeline on execution and then to run that timeline, each time the function is ran it overwrites the old timeline. The index of each piece is stored in an array (will be a database in the end), My codepen is far from tidy and the code is messy but it seems to work, is there a better way to do this? is what I've done a terrible idea?
Note: there is only 2 pieces on the codepen for testing there will be much more once done. Move pattern is 4 left, 1 up, 7 right, 1 down, 1 left.
Any comments, ideas, help would be great!
Thanks.