Math Help on Pet CFrame Attack

local origin = script.Parent.CFrame
game:GetService("RunService").Heartbeat:Connect(function()
	local t= tick()
	local s = math.sin(t/.2)/1
	local rad = -math.sin(t/.4)/.05
	script.Parent.CFrame = origin * CFrame.new(0, 0, s) * CFrame.Angles(math.rad(rad),0, 0)
end)

I want to make the rad and the s increase gradually and then decline really quickly. Similar to the example above.


So far i got this but its a sudden jump not making it that smooth

local origin = script.Parent.CFrame

game:GetService("RunService").Heartbeat:Connect(function()
	local t = tick()

	local x = (t % 2) / 2
	if x > 1 then
		x = 2 - x
	end

	local rad = 20 * math.sin(2 * math.asin(x - 1)) + 10
	local s = math.sin(2 * math.asin(x - 1)) * 3
	local y = math.sin(x/3)

	print(rad)
	script.Parent.CFrame = origin * CFrame.new(0, y, -s) * CFrame.Angles(-math.rad(rad), 0, 0) 
end)

Have you considered using an animation instead? I believe that you can use an animationcontroller to play animations for non-humanoids.