@name ElevateSmoothen
@inputs A B C
@outputs Length Freeze
@persist State Max Min It Cur Hold

if (first()) {
    Max=357.53
    Min=8
    It=100
    Cur=0
}

if (!Hold & (A | B | C)) {
    State=!State
    Hold=1
}
if (!A & !B & !C) {Hold=0}

if (State) {
    if (Cur<1) {
        Cur+=(1/It)
        Freeze=0
    } else {
        Freeze=1
    }
} else {
    if (Cur>0) {
        Cur-=(1/It)
        Freeze=0
    } else {
        Freeze=1
    }
}

Length=(Max-Min)*Cur+Min
interval(100)
