@name Bezier Magic
@inputs 
@outputs 
@persist T
@trigger 

E=entity()
if(first()){
    T=0
    
    holoCreate(1)

    holoCreate(100,E:toWorld(vec(75,0,0)))
    holoCreate(101,E:toWorld(vec(-75,0,0)))
    holoColor(101,vec(255,100,0))
    holoCreate(102,E:toWorld(vec(0,0,85)))
    holoColor(102,vec(100,255,0))
    
    function vector bezier(Src:vector,End:vector,CurvePoint:vector,Progress:number)
    {
        return mix(mix(Src,CurvePoint,Progress),mix(CurvePoint,End,Progress),Progress)
    }
    function vector bezier2(Src:vector,End:vector,CurvePoint1:vector,CurvePoint2:vector,Progress:number)
    {
        local M1 = mix(mix(End,CurvePoint2,Progress),mix(CurvePoint2,CurvePoint1,Progress),Progress)
        local M2 = mix(mix(CurvePoint2,CurvePoint1,Progress),mix(CurvePoint1,Src,Progress),Progress)
        return mix(M1,M2,Progress)
    }
}
interval(1)
T=T+0.01
if(T==1){
    T=0
}

holoPos(1,bezier(holoEntity(100):pos(),holoEntity(101):pos(),holoEntity(102):pos(),T))

print(_HUD_PRINTCENTER,toString(T))
