Giter Club home page Giter Club logo

angular-scroll-magic's Introduction

angular-scroll-magic

An angular directive for ScrollMagic, define pins and tweens in markup

Demo

http://homerjam.github.io/angular-scroll-magic/

Installation

  1. Install via npm npm i -S angular-scroll-magic

  2. Include the necessary files and dependencies (ScrollMagic, GSAP) on your page or in your build process

  3. Add hj.scrollMagic to app's module dependencies

Usage

Turn on indicators to help during development

// In your app config
scrollMagicProvider.addIndicators = true;

smScene

Create a scene, by applying the sm-scene directive this determines the timing for the desired behaviour

<div sm-scene="sceneId" duration="500" offset="100" trigger-hook="0.75"></div>

sm-scene: [string] scene identifier trigger-element: (optional) [element|selector] defaults to the directive element duration: (optional) [integer|string|function] if using a string with a % symbol this will be calculated against viewport height offset: (optional) [integer|string] if using a string with a % symbol this will be calculated against the height of the trigger element (if specified) or document trigger-hook: (optional) [float] this determines the position of the trigger point relative to the viewport

smTween

<div sm-tween="sceneId" duration="1" from-vars="{left: '100%'}" to-vars="{left: '0%'}"></div>

sm-tween: [string] the identifier of the scene (trigger) to use duration: [number] duration of tween relative to length of scene from-vars: (optional) [object] to-vars|vars: [object] options used by GSAP such as CSS properties

smClassToggle

<div sm-class-toggle="sceneId" classes=""></div>

sm-class-toggle: [string] the identifier of the scene (trigger) to use classes: [string] the classes to add/remove

smPin

<div sm-pin="sceneId"></div>

sm-pin: [string] the identifier of the scene (trigger) to use

Gotchas

ScrollMagic doesn't work as expected with Webpack, try using the script-loader like so:

    import 'script!scrollmagic';
    import 'script!scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap';
    import 'script!scrollmagic/scrollmagic/uncompressed/plugins/debug.addIndicators';

    import angularScrollMagic from 'angular-scroll-magic';

angular-scroll-magic's People

Contributors

homerjam avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.