math.cosh()

类型 函数
math.*
返回值 数字
版本 版本 2024.3703
关键词 双曲余弦, cosh, 余弦, cos
另请参阅 math.sinh()
math.cos()

概述

返回 x 的双曲余弦值。

语法

math.cosh( x )
x (必填)

数字. 一个数字。

示例

-- 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 )