Jump to content
Search Community

Function in function

Ivan 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

Hello everybody!
Can't understand why GSAP animate only first transition (rotate).
Second transition it's made, but witout animation, as if duration changes to 0.
Thanks for any help!
 
link for project:

http://htmlfabric.ru/test/club.2/

 

UPD: js code:

var
		tl = new TimelineMax({ onComplete: changePhotos }),
		photoContainer = $('#container'),
		footContainer = $('#foot__container'),
		needDelay = 1,
		fadeTime = 1.5,
		piBlock = $('.pi__block'),
		allItems = $('.pi__img'),
		logoItems = $('.pii--logo');
	
	//fade in & out
	function logo() {
		
		tl//.staggerTo(logoItems, fadeTime, { autoAlpha: 1, delay: needDelay }, 0.2)
		//.to(allItems, fadeTime*1.5, { autoAlpha: 1, delay: needDelay })
		//.staggerTo(logoItems, fadeTime, { autoAlpha: .35, delay: needDelay }, 0.2)
		//.to(allItems, fadeTime*1.5, { autoAlpha: .35, delay: needDelay });
		.to(allItems, 1, { delay: needDelay })
		
	}
	logo();
	
	//change photos
	var
		sideA,
		sideB,
		sideAnumber = 0,
		sideBnumber = 1;
	
	function changePhotos() {

		sideAnumber += 1;
		sideBnumber += 1;
		
		sideA = $('.side'+sideAnumber);
		sideB = $('.side'+sideBnumber);
		
		tl.to(sideB, fadeTime*0.5, { autoAlpha: 1, delay: needDelay, rotationY: '+=180deg', transformOrigin: '50% 50% 50px' }, 'together')
		.to(sideA, fadeTime*0.5, { autoAlpha: 0, delay: needDelay, rotationY: '-=180deg', transformOrigin: '50% 50% 50px' }, 'together');
		
		logo();
	}
Link to comment
Share on other sites

The problem was in Label (in my case "together")

For each timeline i update it and its work!

 

tl.to(sideB, fadeTime*0.5, { autoAlpha: 1, delay: needDelay, rotationY: '+=180deg', transformOrigin: '50% 50% 50px' }, 'together')
  • Like 2
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...