@name LoadingThing
@inputs 
@outputs AngOutput:string 
@persist Ang:angle FM 
@trigger 
interval(100)

if (first()) {
    holoCreate(1)
    holoModel(1,"models/hunter/tubes/tube2x2x025d.mdl")
    holoAng(1,ang(180,0,90))
    
    holoCreate(2)
    holoModel(2,"models/hunter/tubes/tube2x2x025d.mdl")
    holoAng(2,ang(-90,0,90))
    
    holoCreate(3)
    holoModel(3,"models/hunter/tubes/tube2x2x025d.mdl")
    holoAng(3,ang(0,0,90))
    
    holoCreate(4)
    holoModel(4,"models/hunter/tubes/tube2x2x025d.mdl")
    holoAng(4,ang(90,0,90))
    
    for(I = 1,4) {
        holoMaterial(I,"models/debug/debugwhite")
        holoDisableShading(I,1)
        holoScale(I,vec(1,1,1))
    }
    
    Ang = ang(180,0,90)
    
    timer("wait1",9400)
}

FM +=0.002
FM = clamp(FM,0,1)

if (changed(FM)) {
    local N = FM*255
    for(I = 1,4) {holoColor(I,vec(N,255-N,0))}
}

Ang += ang(1,0,0)

Ang = clamp(Ang,0,180+362)

AngOutput = Ang:toString()

holoAng(1,Ang)

if (clk("wait1")) {
    holoAlpha(2,0)
    timer("wait2",9400)
}

if (clk("wait2")) {
    holoAlpha(3,0)
    timer("wait3",9400)
    for(I = 1,4) {
        holoClipEnabled(I,1,1)
        holoClip(I,entity():pos()+vec(1,0,0),vec(-1,0,0),1)
    }
}

if (clk("wait3")) {
    holoAlpha(4,0)
}


