initPhase(phase) {
        const easing = this._easing;
        this._phase = phase;
        switch (phase) {

            // the door is in its initial state
            case CONSTS.DOOR_PHASE_CLOSED:
                this._time = 0;
                break;

            // the door will open. Easing must be initialized
            case CONSTS.DOOR_PHASE_OPENING:
                easing.setOutputRange(0, this._offsetMax);
                easing.setStepCount(this._slidingDuration);
                this._time = 0;
                this.events.emit('opening');
                break;

            // the door is currently opening
            case CONSTS.DOOR_PHASE_OPEN:
                this._offset = this._offsetMax;
                this._time = this._maintainDuration;
                this.events.emit('open');
                break;

            // the door is fully open, waiting for autoclose
            case CONSTS.DOOR_PHASE_CLOSING:
                const checkEvent = {context: this, cancel: false};
                this.events.emit('check', checkEvent);
                if (checkEvent.cancel) {
                    // the door closing has been cancel : something in the way ?
                    // back to phase OPEN with reduced maintain duration
                    this._time = CONSTS.DOOR_SECURITY_INTERVAL;
                    this._phase = CONSTS.DOOR_PHASE_OPEN;
                } else {
                    easing.setOutputRange(this._offsetMax, 0);
                    easing.setStepCount(this._slidingDuration);
                    easing.setFunction(this._cfunc);
                    this._time = 0;
                    this.events.emit('closing');
                }
                break;


            // the door is now closed
            case CONSTS.DOOR_PHASE_DONE:
                this._time = 0;
                this._offset = 0;
                this.events.emit('close');
                break;
        }
    }
/**
     * sets a new phase
     * @param phase
     */
sets a new phase
@param phase
sets a new phase @param phase
initPhase(phase) {
        const easing = this._easing;
        this._phase = phase;
        switch (phase) {
            case CONSTS.DOOR_PHASE_CLOSED:
                this._time = 0;
                break;
            case CONSTS.DOOR_PHASE_OPENING:
                easing.setOutputRange(0, this._offsetMax);
                easing.setStepCount(this._slidingDuration);
                this._time = 0;
                this.events.emit('opening');
                break;
            case CONSTS.DOOR_PHASE_OPEN:
                this._offset = this._offsetMax;
                this._time = this._maintainDuration;
                this.events.emit('open');
                break;
            case CONSTS.DOOR_PHASE_CLOSING:
                const checkEvent = {context: this, cancel: false};
                this.events.emit('check', checkEvent);
                if (checkEvent.cancel) {
                    this._time = CONSTS.DOOR_SECURITY_INTERVAL;
                    this._phase = CONSTS.DOOR_PHASE_OPEN;
                } else {
                    easing.setOutputRange(this._offsetMax, 0);
                    easing.setStepCount(this._slidingDuration);
                    easing.setFunction(this._cfunc);
                    this._time = 0;
                    this.events.emit('closing');
                }
                break;
            case CONSTS.DOOR_PHASE_DONE:
                this._time = 0;
                this._offset = 0;
                this.events.emit('close');
                break;
        }
    }
initPhase ( phase ) { const easing = this . _easing ; this . _phase = phase ; switch ( phase ) { case CONSTS . DOOR_PHASE_CLOSED : this . _time = 0 ; break ; case CONSTS . DOOR_PHASE_OPENING : easing . setOutputRange ( 0 , this . _offsetMax ) ; easing . setStepCount ( this . _slidingDuration ) ; this . _time = 0 ; this . events . emit ( 'opening' ) ; break ; case CONSTS . DOOR_PHASE_OPEN : this . _offset = this . _offsetMax ; this . _time = this . _maintainDuration ; this . events . emit ( 'open' ) ; break ; case CONSTS . DOOR_PHASE_CLOSING : const checkEvent = { context : this , cancel : false } ; this . events . emit ( 'check' , checkEvent ) ; if ( checkEvent . cancel ) { this . _time = CONSTS . DOOR_SECURITY_INTERVAL ; this . _phase = CONSTS . DOOR_PHASE_OPEN ; } else { easing . setOutputRange ( this . _offsetMax , 0 ) ; easing . setStepCount ( this . _slidingDuration ) ; easing . setFunction ( this . _cfunc ) ; this . _time = 0 ; this . events . emit ( 'closing' ) ; } break ; case CONSTS . DOOR_PHASE_DONE : this . _time = 0 ; this . _offset = 0 ; this . events . emit ( 'close' ) ; break ; } }
sets a new phase
 @param phase
sets a new phase @param phase
// the door is in its initial state // the door will open. Easing must be initialized // the door is currently opening // the door is fully open, waiting for autoclose // the door closing has been cancel : something in the way ? // back to phase OPEN with reduced maintain duration // the door is now closed