@name canvas
@inputs EGP:wirelink
@outputs Posx Posy
@persist I Size Color:vector
@trigger 

#CHANGE THIS TO MATCH TOPLEFT, BOTTOMRIGHT WORLD COORDINATES
EGP:egpResolution(vec2(-1503,-3290),vec2(-2263,-2521))

interval(100) #decrease interval for smoother painting, but higher ops

if(first()){
    EGP:egpClear()
    EGP:egpBox(1,vec2(-1700,-3000),vec2(2000,2000)) #remove this for a black canvas
I = 2
}

if(findCanQuery())
{
    findIncludeClass("player")
    findInSphere(EGP:entity():pos(),500)
    Player = findClosest(EGP:entity():pos())
}

Pos = Player:pos()
Pos = round(Pos)

Posx = Player:pos():x()
Posy = Player:pos():y()
Posz = Player:pos():z()

if(changed(Pos)&Posz < 105){ #stops painting when jumping
I++
Color = teamColor(Player:team()) - I / 10 #change this for color
Size = Player:vel():length() / 10 #change this for size
EGP:egpCircle(I,vec2(Posx,Posy),vec2(Size,Size)) #also works with egpBox
EGP:egpColor(I,Color)
}

#egp object limit
if(I > 300){
    I = 1
}
