--!native -- Compiled with roblox-ts v3.0.0 local TS = _G[script] local TweenService = TS.import(script, TS.getModule(script, "@rbxts", "services")).TweenService local MathTools = TS.import(script, script.Parent, "math_tools").MathTools local StringTools = TS.import(script, script.Parent, "string_tools").StringTools local TweenTools = {} do local _container = TweenTools --[[ * * * @param instance * @param tween_info * @param properties properties to tween * @param play autoplay * @param await auto tween.Completed.Wait(); * @returns ]] local function CreateTween(instance, tween_info, properties, play, await) if play == nil then play = true end if await == nil then await = true end local tween = TweenService:Create(instance, tween_info, properties) if play then tween:Play() if await then tween.Completed:Wait() end end return tween end _container.CreateTween = CreateTween local Lerp = MathTools.Lerp --*lerps the value with alpha local function LerpValue(start_value, target_value, alpha) local _start_value = start_value local value_type = typeof(_start_value) if value_type == "number" then return Lerp(start_value, target_value, alpha) elseif value_type == "string" then return StringTools.LerpTextTo(start_value, target_value, alpha) elseif value_type == "CFrame" then return start_value:Lerp(target_value, alpha) elseif value_type == "Vector3" then local value_0 = start_value local value_1 = target_value return value_0:Lerp(value_1, alpha) elseif value_type == "Vector2" then return start_value:Lerp(target_value, alpha) elseif value_type == "Color3" then return start_value:Lerp(target_value, alpha) elseif value_type == "UDim2" then local value_0 = start_value local value_1 = target_value return value_0:Lerp(value_1, alpha) elseif value_type == "UDim" then local value_0 = start_value local value_1 = target_value return UDim.new(Lerp(value_0.Scale, value_1.Scale, alpha), Lerp(value_0.Offset, value_1.Offset, alpha)) elseif value_type == "Rect" then local value_0 = start_value local value_1 = target_value return Rect.new(value_0.Min:Lerp(value_1.Min, alpha), value_0.Max:Lerp(value_1.Max, alpha)) elseif value_type == "boolean" then return if alpha >= 0.5 then true else false end local value_0 = start_value local value_1 = target_value local direction = value_1 - value_0 local _vector2int16 = Vector2int16.new(direction.X * alpha, direction.Y * alpha) return value_0 + _vector2int16 end _container.LerpValue = LerpValue --[[ * * tweens value with EasingStyle / EasingDirection * @param start_value * @param target_value * @param alpha * @param easing_style * @param easing_direction * @returns ]] local function TweenValue(start_value, target_value, alpha, easing_style, easing_direction) if easing_style == nil then easing_style = Enum.EasingStyle.Sine end if easing_direction == nil then easing_direction = Enum.EasingDirection.In end local new_alpha = TweenService:GetValue(alpha, easing_style, easing_direction) return LerpValue(start_value, target_value, new_alpha) end _container.TweenValue = TweenValue end return { TweenTools = TweenTools, }