janpaepke / ScrollMagic

The javascript library for magical scroll interactions.
http://ScrollMagic.io
Other
14.9k stars 2.17k forks source link

Error load animation.gsap.min.js in requirejs #912

Open arifinofficial opened 5 years ago

arifinofficial commented 5 years ago

Hell, I work with Magento 2, which is Magento 2 using requirejs. I've tried my code in local without requirejs, it worked. But in magento with requirejs always fail with error in console.

This is my requirejs.config.js

var config = { paths: { 'scrollmagic': 'scrollmagic/ScrollMagic.min', 'bootstrapjs': 'bootstrap/js/bootstrap.min', 'tweenmax' : 'scrollmagic/plugins/TweenMax.min', // 'timelinemax' : 'scrollmagic/plugins/TimelineMax.min', 'sc.gsap' : 'scrollmagic/plugins/animationgsap.min', 'tweenlite' : 'scrollmagic/plugins/TweenLite.min' }, shim: { 'scrollmagic': { 'deps': ['jquery', 'tweenmax'] }, 'bootstrapjs' : { 'deps' : ['jquery'] }, 'tweenmax': { 'exports': 'tweenmax' }, 'sc.gsap' : { 'deps': ['tweenmax', 'scrollmagic'], 'exports': 'sc.gsap' } } };

I load in page on magento like this: requirejs([ 'jquery', 'scrollmagic', 'tweenmax', 'timelinemax', 'sc.gsap' ], function($,ScrollMagic){ // my code here });

my console appear error Script error for: sc.gsap

but if delete 'sc.gsap' my console appear error (intermediate value).setTween is not a function

jonkwheeler commented 4 years ago

I made this to combat these issues https://github.com/jonkwheeler/ScrollScene