• 검색 결과가 없습니다.

ScrollMagic Cheat Sheet

N/A
N/A
Protected

Academic year: 2022

Share "ScrollMagic Cheat Sheet"

Copied!
1
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

The javascript library for magical scroll interactions.

ScrollMagic Cheat Sheet

DEMO: http://bit.ly/ScrollMagicDemo GITHUB: http://bit.ly/ScrollMagicSRC

DOCUMENTATION: http://bit.ly/ScrollMagicDocs CDN: https://cdnjs.com/libraries/ScrollMagic

Click the link above and start now!

SCROLLMAGIC 101

http://bit.ly/scrollmagic-course Free Online Course

The Quickest Way To Get Started With ScrollMagic

Created with ♥ by Petr Tichy, happy scrolling! https://www.ihatetomatoes.net

Controller

// Create a controller - vertically scrolling window var controller = new ScrollMagic.Controller();

// Create a controller with a custom options var controller = new ScrollMagic.Controller({

container: 'window', // main container for scrolling vertical: true/false, // false = horizontal

globalSceneOptions: { // options for every scene triggerHook: 'onLeave'

},

refreshInterval: 100, // set to 0 to disable loglevel: 3

});

// Add previously defined scene or scenes controller.addScene(scene);

controller.addScene([scene, scene2]);

// Add a newly created scene

controller.addScene(new ScrollMagic.Scene({

duration : 0 }));

// Remove a scene

controller.removeScene(scene);

// Destroy with scene reset

controller = controller.destroy(true);

// Enable or Disable controller controller.enabled(true/false);

// Update a specific scene immediately controller.updateScene(scene, true);

Scene

// Create a scene and add it to controller

var myScene = new ScrollMagic.Scene().addTo(controller);

// Create a scene with custom options var myScene = new ScrollMagic.Scene({

duration: 0, // duration in px eg. 300, 0 = autoplay duration: '100%', // resposive duration in %

offset: 100, // offset trigger position by 100px triggerElement: '#main', // what will trigger scene triggerHook: 0.5, // 0=top, 0.5=middle, 1=bottom triggerHook: 'onEnter' or 'onCenter'or 'onLeave', reverse: true/false, // plays scene on the way up?

loglevel: 2 // 3 = errors, warnings, debuginfo });

Toggle Class

// add 'myclass' to 'my-elem' during a scene scene.setClassToggle('#my-elem', 'myClass');

// add multiple classes to multiple elements

scene.setClassToggle('.classChange', 'class1 class2');

// classes will remain on element outside of a scene scene.removeClassToggle(false);

Pin Element

// pin element for the duration of a scene scene.setPin('#my-pin');

// pin element but don’t push followers

scene.setPin('#my-pin', {pushfollowers: false});

Events

// fire a callback function at the respective event scene.on("change update progress

start end enter leave", callback);

// enter, start, progress - scrolling down // progress, start, leave - scrolling up

// add a single tween directly

scene.setTween(TweenMax.to('#obj'), 1, {x: 100});

// add a signle tween via variable

var tween = TweenMax.to('#obj'), 1, {x: 100};

scene.setTween(tween);

// add a timeline to a scene var timeline = new TimelineMax();

timeline.to('#obj', 1, {x: 100}) .to('#obj', 1, {y: 200});

scene.addTween(timeline);

With GSAP

// Loop through ‘.project’ elements (jQuery loop)

$('.project').each(function(){

// Create a scene for each project var myScene = new ScrollMagic.Scene({

triggerElement: this, triggerElement: 0.8 })

.setClassToggle(this, 'fade-in') .addTo(controller);

});

Multiple Scenes

scene.addIndicators({

name: 'triggerDown', // custom name for your scene indent: 520, // indent from the browser edge

colorStart: 'yellow', // custom color - colorEnd colorTrigger: 'yellow',

})

Debugging with addIndicators Plugin

참조

관련 문서

Figure 3 shows sample signal patterns for three consecutive cars moving near sensors, which are acquired using a magnetometer and three digital-type PIR sensors. The first graph

When the cut-off frequency f c of the Butterworth window is set at 0.439 Hz, the sidelobe attenuation increases as the filter order N increases, while the 3 dB

Container molecules such as carcerand,1 hemicarcerand, 2 and self-assembled molecular capsule 3 have been charac ­ terized as molecular scavengers, molecular storages,

A secondary assembler is a company which is engaged only in a process of labelling the product container where the product is already enclosed in its primary container

The weight of carbon dioxide, the temperature of lithium container for producing acetylene and the activation temperature of catalyst which was used for the cyclization of

특히 연구모형과 가설을 설정함에 있어서 운송수단의 선택이 인간의 판단과 태도에 근거한 행위로 보고 화주들의 철도에 대한 태도와 철도로의 전환의도가 철도선택에

GetDlgItem(IDC_EDIT_INPUT)->EnableWindow(TRUE); // 활성화 GetDlgItem(IDC_EDIT_INPUT)->EnableWindow(FALSE); // 비활성화. 활성화

H4: When a pre-process, post-schedule wait occurs in a low expectations situation versus a high expectations situation, for a given service recovery strategy, cus-