Jump to content
Search Community

dillon

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by dillon

  1. Just for those who may find it helpful, I managed to get the DrawSVGPlugin working with the following setup and webpack.

     

    I created a `vendor` folder beside my standard `modules` folder, copied the minified js from the GSAP downloads and required the DrawSVGPlugin.min.js using the `script-loader` from webpack (https://github.com/webpack/script-loader) after importing 'gsap'.

     

    The webpack configuration I use references a few configuration files, but I will copy that below as well for anyone that finds it useful.

    import 'gsap';
    require('script-loader!../vendor/DrawSVGPlugin.min.js');
    
    import $ from 'jquery';
    
    const STRENGTH = 15;
    
    export default class ZigZag {
        constructor(el) {
            this.el = el;
    
            TweenMax.from("#zigzag", 3, {
                drawSVG: 0
            }, 0.1);
    
        }
    
    //     animate(event) {
    //
    //         let x = 50 + ( (event.offsetX / this.el.width() ) * STRENGTH);
    //         let y = 50 + ( (event.offsetY / this.el.height()) * STRENGTH);
    //
    //         this.image.css('background-position', x + '% ' + y +'%' );
    //
    //     }
    //
    // // .-zigzag
    
    }
    
    
    var webpackConfig = {
            context: "javascripts",
            plugins: [],
            resolve: {
                root: javascripts,
                extensions: ["js", "json"]
            },
            module: {
                loaders: [
                    {
                        test: /\.js$/,
                        loader: 'babel-loader',
                        exclude: /node_modules/,
                        query: "presets": ["es2015", "stage-1"],
            "plugins": []
                    }
                ]
            },
            externals: {
            }
        }
    
    • Like 2
×
×
  • Create New...