I want to move away from jQuery for animation so I have been using GSAP. I am trying to figure out how to fire multiple animations on an element and its children. Basically I want to give the #navicon
a "720 cork" effect which is working fine and a fade/toggle the icon to the children of this #navicon
container which is not working at all.
If I was using jQuery only, I would have probably just add multiple classes as needed and use them to trigger some CSS3 transforms. However, GSAP seems to be really fast.
I have read the GSAP docs pretty thoroughly. And I see how to chain tweens with "timeline" but I am not sure how to fire multiple tweens on different elements based on one event.
Here is my code so far:
var toggleMobiMenu = function() {
$('#navicon').on('click touchstart', function() {
TweenMax.to($(this), 0.5, { rotationY: 720, rotationX: -720 })
.to($(this).find('#open'), 0.5, { opacity: 0 })
.to($(this).find('#closed'), 0.5, { opacity: 1 });
});
}
toggleMobiMenu();
and here is the fiddle of the same. Does anyone know how to tween all these 3 elements at once?