Panel:NewAnimation
Örnek
Bu fonksiyonun nasıl kullanılacağına dair örnek, bir DFrame içinde bir düğmenin dairesel hareket yapmasını sağlar.
local frame = vgui.Create( "DFrame" )
frame:SetSize( 500, 500 )
frame:Center()
frame:MakePopup()
local butt = frame:Add( "DButton" )
butt:SetPos( 5, 30 )
butt:SetSize( 100, 40 )
function butt:doAnim()
local anim = self:NewAnimation( 10, 0, 1, function( anim, pnl )
self:doAnim()
end )
anim.Think = function( anim, pnl, fraction )
local radius = 200
pnl:SetPos( 250 + math.sin( Lerp( fraction, -math.pi, math.pi ) ) * radius - pnl:GetWide() / 2,
250 + math.cos( Lerp( fraction, -math.pi, math.pi ) ) * radius - pnl:GetTall() / 2 )
pnl:SetText( "Frac: " .. fraction .. "\nTime: " .. ( SysTime() - anim.StartTime ) )
end
end
butt:doAnim()
Tüm sunucular · GmodTR Launcher · Rehber · GMod Wiki · GmodTR nedir? · Sunucu ekle · Discord