Home > three-story-controls > ScrollAdaptor
Emits normalized values for the amount a given DOM element has been scrolled through.
Signature:
export declare class ScrollAdaptor extends BaseAdaptor
Extends: BaseAdaptor
See ScrollAdaptorProps for all properties that can be passed to the constructor. See ScrollAdaptorEvent for emitted event signatures.
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
})
Constructor | Modifiers | Description |
---|---|---|
(constructor)(props) | Constructs a new instance of the ScrollAdaptor class |
Method | Modifiers | Description |
---|---|---|
connect() | ||
disconnect() | ||
isEnabled() | ||
parseOffset(offset) | ||
update() |