@name Digital Picture Frame
@persist Images:array Stage Trans Speed
@inputs Scr:wirelink
if (first() | changed(Scr)) {
    Images=array()
    Scr:egpClear()
    function adds(S:string) {
        Images[Images:count()+1,string]=S
    }
    Speed=255/30 #how much alpha is added/removed per tick
    Trans=255
    adds("console/background_2fort")
    adds("console/background_gravelpit")
    adds("console/background_mvm")
    adds("console/background_upward")
    adds("console/background_xmas2011")
    adds("console/portal2_product_1")
    adds("console/portal2_product_2")
    adds("console/title_blue")
    adds("console/title_fullmoon")
    adds("console/title_red")
    adds("console/title_team")
    adds("console/title_team_halloween")
    adds("console/title_team_halloween2011")
    adds("console/title_team_halloween2012")
    adds("console/title_war")
    adds("console/title_war_widescreen")
    adds("vgui/main_menu/meta_cityonfire512")
    adds("vgui/main_menu/motd_mechaupdate")
    adds("vgui/main_menu/motd_robo_2013")
    adds("vgui/main_menu/screamfortress")
    adds("vgui/illustrations/gamemode_merasmus")
    adds("vgui/appchooser/background_ep2")
    adds("vgui/appchooser/background_episodic")
    adds("vgui/appchooser/background_hl2")
    adds("vgui/appchooser/background_orange")
    adds("vgui/appchooser/background_portal")
    adds("vgui/appchooser/background_tf")
    adds("vgui/appchooser/ep2")
    adds("vgui/appchooser/episodic")
    adds("vgui/appchooser/hl2")
    adds("vgui/appchooser/tf")
    adds("vgui/steam_trading")
    print("Picture frame loaded, found "+(Images:count())+" pictures to cycle through.")
    Scr:egpBox(1,vec2(256,256),vec2(512,512))
    Scr:egpBox(2,vec2(256,256),vec2(512,512))
    Scr:egpMaterial(1,Images[random(Images:count()),string])
    Scr:egpMaterial(2,Images[random(Images:count()),string])
    Stage=1
    #stage=1 make 2 transparent
    #stage=2 make 2 visible
}

    interval(random(5000,10000))
    if (!clk("cycle") & !clk("fade")) {
    timer("cycle",10)
}
    
    if (clk("cycle")) {
    if (Stage==1) {
        Stage=2
        Scr:egpMaterial(2,Images[random(Images:count()),string])
    } else {
        Stage=1
        Scr:egpMaterial(1,Images[random(Images:count()),string])
    }
    timer("fade",10)
}
if (clk("fade")) {
    if (Stage==1) {
        Trans=Trans-Speed
        if (Trans>0) {
            timer("fade",50)
    } else {Trans=0}
    } else {
        Trans=Trans+Speed
        if (Trans<255) {
            timer("fade",50)
    } else {Trans=255}
    }
    #print(_HUD_PRINTCENTER,""+Trans)
    Scr:egpAlpha(2,Trans)
    Scr:egpAlpha(1,255-Trans)
}






