AvatarMask

Sets up a panel to have a custom shaped mask for displaying avatars of players. Do not call this on AvatarImage panels, one is created internally for you (<Panel>.Avatar). The panel also gets two new functions: SetPlayer and SetSteamID, exactly mirroring those of AvatarImage.

Arguments

Function mask(Panel s, Number w, Number h) Used to draw the mask.

Example

local av = vgui.Create("DPanel") -- DO NOT USE AVATARIMAGE!!!
av:AvatarMask(function(s, w, h)
    surface.DrawPoly({
        {x = w/2, y = h*(math.cos(CurTime()*5)+1)/2},
        {x = w, y = h},
        {x = 0, y = h}
    })
end):SetPlayer(LocalPlayer(), 184) -- SetPlayer and SetSteamID functions are added internally after the AvatarMask class is added!
Output:

results matching ""

    No results matching ""