Jump to content
Search Community

Uncaught TypeError: tween.pause is not a function

purepixels test
Moderator Tag

Go to solution Solved by Carl,

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,

 

I'm new to GSAP. I used a bunch of script sand plugins on my page:

 

http://design.purepixels.nl/hofstad/demo/talent-video.html

 

I'm getting an error on my page when I check de Chrome console.

 

The error is: Uncaught TypeError: tween.pause is not a function (jquery.superscrollorama.js: line 315)

 

I don't know how to solve this. Is there anybody who knows how to solve this issue?

 

Thanks in advance for your reply!

 

Best regards,

 

Jeroen

See the Pen talent-video.html by hofstad (@hofstad) on CodePen

Link to comment
Share on other sites

Hello purepixels and welcome to the GreenSock Forum!

 

The only thing i can think of by looking at your site is to try and load TweenMax.min.js before you load Superscrollorama. Your loading it after Superscrollorama and after other GSAP plugins. You should load TweenMax.min.js before all other GSAP plugins and before Superscrollorama so it can detect GSAP when it loads. But this looks more of an issue with Superscrollorama then with GSAP API question.

 

Superscrollorama is a 3rd party plugin created by John Polacek and not GreenSock. You can try posting your question in the github issues area for that Superscrollorama:

 

https://github.com/johnpolacek/superscrollorama/issues?q=is%3Aissue+is%3Aclosed

 

Maybe others here could help you with that question if they use Superscrollorama. Oh and Superscrollorama is now ScrollMagic ;)

 

https://github.com/janpaepke/ScrollMagic

 

:)

Link to comment
Share on other sites

  • Solution

Its very difficult to try to hunt down errors with all that code and 3rd party plugins. 

However, the console error led me to this:

 

function morphLoop() {
count++;
if (count === 4) count=1;
tl = new TimelineMax({onComplete:morphLoop});
tl.to(icon, 1, {morphSVG:"#icon-"+count, ease:Circ.easeInOut})
.to(".caption"+count, 1, {scale:1, autoAlpha:1, ease:Circ.easeOut},0)
.to(".caption"+count, 0.5, {scale:0, autoAlpha:0, ease:Circ.easeIn}, "+=1")
.set(".caption"+count, {scale:5});
}
 
morphLoop();
 
var controller = jQuery.superscrollorama();
controller.addTween('#choose_talent', morphLoop(), 0, 0, 0);
 
Notice how you are passing morphLoop into controller.add() ? You should be passing in an GSAP animation like a tween or timeline. That's why Superscrollerama is saying tween.pause() is not a function. 
 
I think if you change the morphLoop function to return an animation it will work
 
 
 
function morphLoop() {
count++;
if (count === 4) count=1; 
tl = new TimelineMax({onComplete:morphLoop});
tl.to(icon, 1, {morphSVG:"#icon-"+count, ease:Circ.easeInOut})
.to(".caption"+count, 1, {scale:1, autoAlpha:1, ease:Circ.easeOut},0)
.to(".caption"+count, 0.5, {scale:0, autoAlpha:0, ease:Circ.easeIn}, "+=1")
.set(".caption"+count, {scale:5});


//important to return the tl animation


return tl;


}


//do not call this function here!
//morphLoop();


var controller = jQuery.superscrollorama();
//get the animation that morphLoop returns by adding morphLoop() NOT morphLoop
controller.addTween('#choose_talent', morphLoop, 0, 0, 0);
  • Like 2
Link to comment
Share on other sites

for some reason my code is being changed. please use this as the last line:

 

controller.addTween('#choose_talent', morphLoop(), 0, 0, 0);

 

The () in morphLoop() are very important.

 

Hi Carl,

 

Thanks so much for your help!

 

return morphLoop();

 

does the trick. There is no error anymore.

 

Best regards,

 

Jeroen

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