import ScrollAnimator from "./animator"

class Fader extends ScrollAnimator{

    constructor(elementProvider, speedProvider, config){
        super(elementProvider, speedProvider);
        this.config = config;
    }

    doUpdate(element, scroll){
        let t = Math.abs(this.config.start - this.config.end) * scroll;
        if(t>this.config.end) t=this.config.end;
        if(t<this.config.start) t=this.config.start;
        element.style.opacity = t;
    }
}
export default Fader;