modules.setCurrentIndex=function(Q)return function(B,Z)if Q.isAnimating then return end local X=constants.SurfaceArtSelectorItemSize*Z Q.updateTarget(X)Q.targetIndex=Q.formatTargetIndex(B,Z)task.spawn(function()Q:setState({offset=math.abs(Z)})Q.isAnimating=true Q.motor:setGoal(Otter.spring(X,{frequency=3}))task.wait(.5)Q.isAnimating=false Q:setState({selectedIndex=B,offset=0})Q.motor:setGoal(Otter.instant(0))end)end end
--[[
	Sets the current index of the surface art.
]]
modules.setCurrentIndex = function(self)
	return function(index, offset)
		if self.isAnimating then
			return
		end

		-- Can't figure out the right way to do this - we can only calculate how much to move
		-- the frame using the images rendered within this frame, not the entire rendered indexes Frame
		local target = constants.SurfaceArtSelectorItemSize * offset

		self.updateTarget(target)
		self.targetIndex = self.formatTargetIndex(index, offset)

		task.spawn(function()
			self:setState({ offset = math.abs(offset) })
			self.isAnimating = true
			self.motor:setGoal(Otter.spring(target, { frequency = 3 }))
			task.wait(0.5)
			self.isAnimating = false
			self:setState({ selectedIndex = index, offset = 0 })
			self.motor:setGoal(Otter.instant(0))
		end)
	end
end
