[英]How can I realize this animation using TimelineMax and ScrollMagic plugin?
[英]How can i add velocity plugin to ScrollMagic with npm?
我需要将带有速度插件的 scrollMagic 添加到我的 npm 库中。
包.json
{
"name": "library",
"version": "1.0.10",
"description": "blabla",
"main": "index.js",
"dependencies": {
"shortid": "2.x",
"jquery": "2.x",
"scrollmagic": "2.x"
}
}
有没有办法做到这一点?
简单地添加 ScrollMagic 不包括插件。
如果需要更多信息,请告诉我。
编辑:
如果我添加这样的插件: require('scrollmagic/uncompressed/plugins/animation.velocity.js')
我收到这些错误。
ERROR in ./~/scrollmagic/scrollmagic/uncompressed/plugins/animation.velocity.js
Module not found: Error: Cannot resolve module 'ScrollMagic' in /home/av/local.dev/testest/node_modules/scrollmagic/scrollmagic/uncompressed/plugins
@ ./~/scrollmagic/scrollmagic/uncompressed/plugins/animation.velocity.js 31:2-46
ERROR in ./~/scrollmagic/scrollmagic/uncompressed/plugins/animation.velocity.js
Module not found: Error: Cannot resolve module 'velocity' in /home/av/local.dev/testest/node_modules/scrollmagic/scrollmagic/uncompressed/plugins
@ ./~/scrollmagic/scrollmagic/uncompressed/plugins/animation.velocity.js 31:2-46
我在 webpack.config.js 中添加了这些库来解决这个问题:
resolve: {
extensions: ['', '.js', '.json'],
root: [Path.join(__dirname, "node_modules")],
modulesDirectories: ['node_modules'],
alias: {
"ScrollMagic": Path.resolve('node_modules', 'scrollmagic/scrollmagic/minified/ScrollMagic.min.js'),
"animation.velocity": Path.resolve('node_modules', 'scrollmagic/scrollmagic/minified/plugins/animation.velocity.min.js'),
"velocity": Path.resolve('node_modules', 'velocity-animate/velocity.min.js')
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.