Skip to content

Latest commit

 

History

History
48 lines (32 loc) · 1.74 KB

three-story-controls.scrolladaptor.md

File metadata and controls

48 lines (32 loc) · 1.74 KB

Home > three-story-controls > ScrollAdaptor

ScrollAdaptor class

Emits normalized values for the amount a given DOM element has been scrolled through.

Signature:

export declare class ScrollAdaptor extends BaseAdaptor 

Extends: BaseAdaptor

Remarks

See ScrollAdaptorProps for all properties that can be passed to the constructor. See ScrollAdaptorEvent for emitted event signatures.

Example

Scroll adaptor

const scrollAdaptor = new ScrollAdaptor({ scrollElement: document.querySelector('.scroller'), dampingFactor: 0.1 })
scrollAdaptor.connect()
scrollAdaptor.addEventListener('update', (event) => {
  cube.rotation.y = event.dampenedValues.scrollPercent*Math.PI*2
})

Constructors

Constructor Modifiers Description
(constructor)(props) Constructs a new instance of the ScrollAdaptor class

Methods

Method Modifiers Description
connect()
disconnect()
isEnabled()
parseOffset(offset)
update()