@name keyf_test
@inputs 
@outputs CurTime DeltaTime Test
@persist CurTime DeltaTime Animation:table
@trigger 

if (first()) {
    
    function dt( Interval ) {
        interval(Interval)
        
        DeltaTime = curtime() - CurTime
        CurTime   = curtime()
    }
    
    CurTime = curtime()
    
    function table:playAnim() {       
        This["SequenceT", number] = min(1, This["SequenceT", number] + (1/This["Duration", number])*DeltaTime)
        This["Realtime", number] = This["SequenceT", number]*This["Duration", number]

        if (This["SequenceT", number] < 1) {
            local Frames = This["Frames", table]
            local FrameTime = This["Duration", number] / Frames:count()
            
            print( FrameTime /This["Realtime", number] )
            #if ((This["Realtime", number] % FrameTime) == Frames:count()) {
            #    print("go")    
            #}

           # if (This["Realtime", number] % FrameTime) { 
                #print(This["SequenceT", number])
           # }
    
            local CurrentFrame = This["SequenceF", number]
            
            local Frame = Frames[CurrentFrame, array]
            local Index = Frame[1, number]
            local Angle = Frame[2, angle]
            
            holoAng(Index, Angle)
        }
    }

    function table:setAnimDuration( Time ) {
        This["Duration", number] = Time
    }

    Animation = table( 
        "Frames" = table(
            1 = array( 1, ang() ),
            2 = array( 1, ang(45, 0, 0) )
        ),

        "SequenceT" = 0,
        "SequenceF" = 1,
        "Duration"  = 5
    )
 
    holoCreate(1)
    
    
}

dt(60)

Animation:playAnim()

Test = Animation["Realtime", number]

