Jump to content
Search Community

onCompleteAll with anonymous function?

LilaQ 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

Hi guys,

 

can't staggerFromTo -> onCompleteAll handle anonymous functions?

I do this with a normal onComplete in a regular Tween all the time, since I think it's more intuitive to have the functions inline.

 

My call:

TweenMax.staggerFrom($(".kontakt-artist"), 1, {transformOrigin: "100% 0%", scaleX: 0, onCompleteAll: function() {
						console.log("should be rotating");
						TweenMax.staggerFromTo($(".kontakt-image"), 0.4, {rotationX: 360, opacity: 0}, {rotationX: 0, opacity: 1}, 0.25);
					}}, 0.25);

The console output:

 

 

invalid onCompleteAll tween value: function () {

console.log("should be rotating");
TweenMax.staggerFromTo($(".kontakt-image"), 0.4, {rotationX: 360, opacity: 0}, {rotationX: 0, opacity: 1}, 0.25);
}

 

Thanks for your help!

Link to comment
Share on other sites

 Hi LilaQ  :)

 

pls try this :

 

See the Pen myVRdd by MAW (@MAW) on CodePen

TweenMax.staggerFrom($(".box"), 1, {transformOrigin: "100% 0%", scaleX: 0} , 0.25 , FN );

function FN (){
console.log("should be rotating");
TweenMax.staggerFromTo($(".box"), 0.4, {rotationX: 360, opacity: 0}, {rotationX: 0, opacity: 1}, 0.25);
}

as you can read on the Docs :

 

TweenMax.staggerFrom( targets:Array, duration:Number, vars:Object, stagger:Number, onCompleteAll:Function, onCompleteAllParams:Array, onCompleteAllScope:* ) : Array

 

http://greensock.com/docs/#/HTML5/GSAP/TweenMax/staggerFrom/

  • 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...