Jump to content
Search Community

shshaw

Business
  • Posts

    3
  • Joined

  • Last visited

About shshaw

Recent Profile Visitors

2,044 profile views

shshaw's Achievements

  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. My directory structure isn't anything unusual. The GSAP files are all under node_modules/gsap . Since the ModifiersPlugin has no problems and issue seems to be with the seemingly extraneous code at the bottom of the ScrollToPlugin I thought it was pertinent for y'all to know. For future reference, adding that alias to /build/webpack.base.conf.js under resolve solved the problem. "TweenLite": "gsap/src/uncompressed/TweenLite" Thanks
  2. I've been using Vue.js a lot lately, and working with the webpack template. Importing GSAP after `npm install -s gsap` works correctly, but the ScrollToPlugin has some oddities. In one of my Vue components, I have this: import "gsap"; import ModifiersPlugin from "../../../node_modules/gsap/src/uncompressed/plugins/ModifiersPlugin.js"; And ModifiersPlugin works great. But when I try to do the same for ScrollToPlugin... import ScrollToPlugin from '../../../node_modules/gsap/src/uncompressed/plugins/ScrollToPlugin.js'; I get this error in Vue/Webpack ./~/gsap/src/uncompressed/plugins/ScrollToPlugin.js Module not found: Error: Cannot resolve module 'TweenLite' in /Users/shaw/Sites/green-mountain/node_modules/gsap/src/uncompressed/plugins resolve module TweenLite in /Users/shaw/Sites/green-mountain/node_modules/gsap/src/uncompressed/plugins looking for modules in /Users/shaw/Sites/green-mountain/node_modules /Users/shaw/Sites/green-mountain/node_modules/TweenLite doesn't exist (module as directory) resolve 'file' TweenLite in /Users/shaw/Sites/green-mountain/node_modules resolve file /Users/shaw/Sites/green-mountain/node_modules/TweenLite doesn't exist /Users/shaw/Sites/green-mountain/node_modules/TweenLite.js doesn't exist /Users/shaw/Sites/green-mountain/node_modules/TweenLite.vue doesn't exist looking for modules in /Users/shaw/Sites/green-mountain/node_modules /Users/shaw/Sites/green-mountain/node_modules/TweenLite doesn't exist (module as directory) resolve 'file' TweenLite in /Users/shaw/Sites/green-mountain/node_modules resolve file /Users/shaw/Sites/green-mountain/node_modules/TweenLite doesn't exist /Users/shaw/Sites/green-mountain/node_modules/TweenLite.js doesn't exist /Users/shaw/Sites/green-mountain/node_modules/TweenLite.vue doesn't exist [/Users/shaw/Sites/green-mountain/node_modules/TweenLite] [/Users/shaw/Sites/green-mountain/node_modules/TweenLite] [/Users/shaw/Sites/green-mountain/node_modules/TweenLite] [/Users/shaw/Sites/green-mountain/node_modules/TweenLite] [/Users/shaw/Sites/green-mountain/node_modules/TweenLite.js] [/Users/shaw/Sites/green-mountain/node_modules/TweenLite.js] [/Users/shaw/Sites/green-mountain/node_modules/TweenLite.vue] [/Users/shaw/Sites/green-mountain/node_modules/TweenLite.vue] @ ./~/gsap/src/uncompressed/plugins/ScrollToPlugin.js 181:2-34 Looking at ScrollToPlugin.js, it seems to be triggered by this section of code at the very end, starting at line 174, which ModifiersPlugin does not have. //export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) (function(name) { "use strict"; var getGlobal = function() { return (_gsScope.GreenSockGlobals || _gsScope)[name]; }; if (typeof(define) === "function" && define.amd) { //AMD define(["TweenLite"], getGlobal); } else if (typeof(module) !== "undefined" && module.exports) { //node require("../TweenLite.js"); module.exports = getGlobal(); } }("ScrollToPlugin")); Looks like the `require` on line 183 is triggering the error. If I remove that block of code, the ScrollToPlugin works as expected. I haven't tested all the other plugins, but I would assume if they have that block, they will produce a similar error. Any idea what's going on?
  3. Posting this for future Google searchers: To slow down a repeating animation in GSAP so it seems like it's losing momentum until it reaches the end position, animate both the 'timeScale' and 'progress' properties! Thanks to zadvorsky and zachsaucier for their help. var spin = TweenMax.to('#group',2,{ transformOrigin: 'center center', rotation: 360, ease: 'Linear.easeNone', repeat: -1, paused: true }); document.getElementById('finish').addEventListener('click',function(){ var remaining = spin.timeScale() * ( spin.duration() - spin.time() ) * 3; TweenMax.to(spin, remaining, { timeScale: 0, ease: 'Linear.easeNone', onComplete: function(){ spin.pause(); } },0); TweenMax.to(spin, remaining, { progress: 1, ease: 'Power3.easeOut', },0); }); I haven't figured out a better way to calculate how long the slow-down animation should last. "spin.timeScale() * ( spin.duration() - spin.time() ) * 3" feels right for this animation, but three is a bit of a magic number. Any ideas on how to better calculate that?
×
×
  • Create New...