Подпишитесь на наш Telegram-канал, чтобы всегда быть в курсе важных обновлений! Перейти

Ищу скрипт Как сделать анимацию при скопе

code_language.lua:
Expand Collapse Copy
function clamp(x, min, max)

    if min > max then
        return math.min(math.max(x, max), min)
    else
        return math.min(math.max(x, min), max)
    end
                  
    return x
end
                      
function linear_interpolation(start, end_pos, time)
    return (end_pos - start) * time + start
end
                      
anim.lerp = function(start, end_pos, time)
    if type(start) == 'userdata' then
        local color_data = {0, 0, 0, 0}
        for i, color_key in ipairs({'r', 'g', 'b', 'a'}) do color_data[i] = anim.lerp(start[color_key], end_pos[color_key], time) end

        return Color.new(unpack(color_data))
    end
                          
    --[[
        Color Animation
        local val = return true/false or GlobalVars.realtime % 4 > 2  --Anim enabler
        local color = anim.new('test color', val and Color.new(1, 1, 1) or Color.new(0, 0, 0), 0.005)  --Anim Color
      
        Move Animation
        local val = return true/false or GlobalVars.realtime % 4 > 2  --Anim enabler
        local y = anim.new('test y', val and 400 or 500, 0.007)   --Anim Strafe setup             
        local pos = Vector2.new(200, y) --Anim Strafe start
    ]]--
                          
    time = time or 0.005
    time = clamp(GlobalVars.frametime * time * 175.0, 0.01, 1.0)

    return linear_interpolation(start, end_pos, time)
end

anim.new = function(name, value, time)
    if anim.data[name] == nil then
        anim.data[name] = value
    end

    anim.data[name] = anim.lerp(anim.data[name], value, time)

    return anim.data[name]
end

proper animation by @prince1337 которую я досих пор юзаю в современных реалиях

а эти две строчки переведи сам на нл в3
local g_LocalPlayer = EntityList.GetLocalPlayer()
local g_Scoped = g_LocalPlayer:GetProp("m_bIsScoped")
скопед возвращает труе или фалсе (аля включен или выключен и можно делать проверку если он включен то анимка включена и наоборот)
 
code_language.lua:
Expand Collapse Copy
function clamp(x, min, max)

    if min > max then
        return math.min(math.max(x, max), min)
    else
        return math.min(math.max(x, min), max)
    end
                 
    return x
end
                     
function linear_interpolation(start, end_pos, time)
    return (end_pos - start) * time + start
end
                     
anim.lerp = function(start, end_pos, time)
    if type(start) == 'userdata' then
        local color_data = {0, 0, 0, 0}
        for i, color_key in ipairs({'r', 'g', 'b', 'a'}) do color_data[i] = anim.lerp(start[color_key], end_pos[color_key], time) end

        return Color.new(unpack(color_data))
    end
                         
    --[[
        Color Animation
        local val = return true/false or GlobalVars.realtime % 4 > 2  --Anim enabler
        local color = anim.new('test color', val and Color.new(1, 1, 1) or Color.new(0, 0, 0), 0.005)  --Anim Color
     
        Move Animation
        local val = return true/false or GlobalVars.realtime % 4 > 2  --Anim enabler
        local y = anim.new('test y', val and 400 or 500, 0.007)   --Anim Strafe setup            
        local pos = Vector2.new(200, y) --Anim Strafe start
    ]]--
                         
    time = time or 0.005
    time = clamp(GlobalVars.frametime * time * 175.0, 0.01, 1.0)

    return linear_interpolation(start, end_pos, time)
end

anim.new = function(name, value, time)
    if anim.data[name] == nil then
        anim.data[name] = value
    end

    anim.data[name] = anim.lerp(anim.data[name], value, time)

    return anim.data[name]
end

proper animation by @prince1337 которую я досих пор юзаю в современных реалиях

а эти две строчки переведи сам на нл в3
local g_LocalPlayer = EntityList.GetLocalPlayer()
local g_Scoped = g_LocalPlayer:GetProp("m_bIsScoped")
скопед возвращает труе или фалсе (аля включен или выключен и можно делать проверку если он включен то анимка включена и наоборот)
зачем щас использовать лерп если есть easing??
 
спросил же бро
А нахуя тебе out_expo или in_expo, если тебе нужна линейная интерполяция? Зачем мне еще какая то хуйня, если мне нужно сделать самую простую анимацию?
 
А нахуя тебе out_expo или in_expo, если тебе нужна линейная интерполяция? Зачем мне еще какая то хуйня, если мне нужно сделать самую простую анимацию?
темболее тому кенту просто надо проверку на зум и чтоб его индики при скопе просто сделали плавный мув в другую сторону
 
Назад
Сверху Снизу