Jump to content
Search Community

How resize and update square block animation

chiho test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

$(document).ready(function() {
	$(".client-logo").each(function(element) {
		TweenMax.defaultEase 	= Linear.easeNone;
		var tl 					= new TimelineMax({ onUpdate:updateUI,  repeatDelay: 0, paused:true, repeat: -1 });    

		var tlWidth 			= $('.image-client-inner').innerWidth();
		var tlHeight 			= $('.image-client-inner').innerHeight();
		var tlMargin 			= 10;

		tl.to(element.previousElementSibling, 0.58, {left: tlWidth-tlMargin}).
			to(element.previousElementSibling, 0.58, {top: tlHeight-tlMargin}).
			to(element.previousElementSibling, 0.58, {left: 0-tlMargin}).
			to(element.previousElementSibling, 0.58, {top:  0-tlMargin});
			
			element.animation = tl;

		})

		$(".client-logo").hover(over, out);
		
		function over() {
			this.animation.resume();
			console.log(this.animation);
		}

		function out() {
			this.animation.pause();
		}
		
		function updateUI()
		{
		//	alert('done');
		}	
});

When the window is resizing, the animation should be repositioning themselves correctly. How should I do that properly?

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...