Skip to content

Instantly share code, notes, and snippets.

@keeganbrown
Last active August 29, 2015 14:27
Show Gist options
  • Save keeganbrown/3a85977a76d11d6c2f8d to your computer and use it in GitHub Desktop.
Save keeganbrown/3a85977a76d11d6c2f8d to your computer and use it in GitHub Desktop.

Revisions

  1. keeganbrown renamed this gist Aug 23, 2015. 1 changed file with 20 additions and 3 deletions.
    23 changes: 20 additions & 3 deletions gistfile1.js → scene-skip.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    $(document).off('mousewheel');

    var isScrolling = null;
    $(document).on('mousewheel', function (e) {
    if ( e.deltaY != 0 && Math.abs(e.deltaY) > 5 ) {
    @@ -10,20 +12,35 @@ $(document).on('mousewheel', function (e) {
    master.seek(_label);
    _label = master.getLabelBefore();
    }
    if ( _label == 'breakpoint1' ) {
    master.seek(_label);
    _label = master.getLabelBefore();
    }
    while ( !!_label && !_label.match(/breakpoint|start/gi) ) {
    master.seek(_label);
    _label = master.getLabelBefore();
    }

    console.log(_label);
    } else if ( e.deltaY < 0 ) {
    _label = master.getLabelAfter();
    if ( !!_label && !_label.match(/breakpoint|start/gi) ) {
    master.seek(_label);
    _label = master.getLabelAfter();
    }
    }
    console.log(_label);

    if ( !!_label ) {
    master.pause();
    master.seek(_label);
    master.play();
    if (_label != 'breakpoint1') {
    master.play();
    }

    isScrolling = setTimeout( function () {
    isScrolling = null;
    master.play();
    }, 150 );
    }, 1000 );
    }
    }
    }
  2. keeganbrown renamed this gist Aug 22, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. keeganbrown created this gist Aug 22, 2015.
    31 changes: 31 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    var isScrolling = null;
    $(document).on('mousewheel', function (e) {
    if ( e.deltaY != 0 && Math.abs(e.deltaY) > 5 ) {
    if ( !isScrolling ) {
    $('video').each( function (i, ele) { ele.pause() } );
    var _label = '';
    if ( e.deltaY > 0 ) {
    _label = master.getLabelBefore();
    if ( !!_label ) {
    master.seek(_label);
    _label = master.getLabelBefore();
    }
    } else if ( e.deltaY < 0 ) {
    _label = master.getLabelAfter();
    }
    console.log(_label);

    if ( !!_label ) {
    master.pause();
    master.seek(_label);
    master.play();

    isScrolling = setTimeout( function () {
    isScrolling = null;
    master.play();
    }, 150 );
    }
    }
    }
    //console.log(e);
    });