local p=require(script.Parent.Signal)local m={}m.__index=m function m.new(O)return setmetatable({Value=O;AnimationStarted=p.new();AnimationFinished=p.new(),Changed=p.new(),_class=m},m)end function m.Change(m,p)m.Value=p m.Changed:Fire(p)end function m.StartAnimation(O,p,m)O.AnimationStarted:Fire(p,m)end function m.FinishAnimation(p)p.AnimationFinished:Fire()end return m
-- Represents an animated value.
-- This is literally a Lua implementation of a generic *Value.

local Signal = require(script.Parent.Signal)

local Value = {}
Value.__index = Value

--[[
	Creates a new value with a starting inner value.
]]
function Value.new(initial)
	return setmetatable({
		Value = initial,
		AnimationStarted = Signal.new(),
		AnimationFinished = Signal.new(),
		Changed = Signal.new(),
		_class = Value,
	}, Value)
end

--[[
	Triggers a change in the value. This immediately changes the value for all
	objects it is used in, with no animation.
]]
function Value:Change(newValue)
	self.Value = newValue
	self.Changed:Fire(newValue)
end

--[[
	Starts an animation over the property's value, using supplied tween properties.
]]
function Value:StartAnimation(toValue, tweenInfo)
	self.AnimationStarted:Fire(toValue, tweenInfo)
end

--[[
	Finishes an animation; called by animated components.
]]
function Value:FinishAnimation()
	self.AnimationFinished:Fire()
end

return Value