Garry's Mod Wiki

DModelPanel:SetAnimSpeed

DModelPanel:SetAnimSpeed( number animSpeed )

Description

Sets the speed used by DModelPanel:RunAnimation to advance frame on an entity sequence.

Entity:FrameAdvance doesn't seem to have any functioning arguments and therefore changing this will not have any affect on the panel entity's sequence speed without reimplementation. It only affects the value returned by DModelPanel:GetAnimSpeed

Arguments

1 number animSpeed
The animation speed.

Example

A reimplementation of DModelPanel:LayoutEntity which will modify the entity's sequence playback rate based on the set animation speed. This example has Alyx run twice as fast as normal.

local mdl = vgui.Create("DModelPanel") mdl:SetPos(20, 20) mdl:SetSize(200, 200) mdl:SetModel("models/alyx.mdl") -- Play sequence twice as fast mdl:SetAnimSpeed(2) -- Make Alyx run mdl:GetEntity():SetSequence(mdl:GetEntity():LookupSequence("run_all")) -- Play animation function mdl:LayoutEntity(ent) -- Playback rate based on anim speed ent:SetPlaybackRate(self:GetAnimSpeed()) -- Advance frame ent:FrameAdvance() end

Page Links


Special Pages


Wikis

?

Render Time: 63ms

DB GetPage 37
Generate Html 3
SaveChanges (1) 9
Render Body 0
Render Sidebar 6