modules.setCurrentIndex=function(T)return function(z,C)if T.isAnimating then return end local M=constants.SurfaceArtSelectorItemSize*C T.updateTarget(M)T.targetIndex=T.formatTargetIndex(z,C)task.spawn(function()T:setState({offset=math.abs(C)})T.isAnimating=true T.motor:setGoal(Otter.spring(M,{frequency=3}))task.wait(.5)T.isAnimating=false T:setState({selectedIndex=z;offset=0})T.motor:setGoal(Otter.instant(0))end)end end

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
