math.cosh()

Type Function
Library math.*
Return value Number
Revision Release 2022.3683
Keywords hyperbolic cosine, cosh, cosine, cos
See also math.sinh()
math.cos()

Overview

Returns the hyperbolic cosine of x.

Syntax

math.cosh( x )
x (required)

Number. A number.

Example

-- move a circle along a path
local myCircle = display.newCircle( 0, display.viewableContentHeight/2, 20 )
myCircle:setFillColor( 1, 0, 0 )
local function onFrame( event )
    myCircle.y = math.cosh( 15*(myCircle.x/display.viewableContentWidth-0.5) )
    myCircle.x = (myCircle.x + 5) % display.viewableContentWidth
end
Runtime:addEventListener( "enterFrame", onFrame )