函数名称:UI\Draw\Matrix::rotate()
函数描述:该函数用于在UI\Draw\Matrix对象上应用旋转变换。
适用版本:PHP 7.4.0 及以上版本
用法:
public UI\Draw\Matrix::rotate ( float $angle [, float $centerX = 0.0 [, float $centerY = 0.0 ]] ) : void
参数:
返回值:无返回值。
示例:
// 创建一个新的Matrix对象
$matrix = new UI\Draw\Matrix();
// 定义旋转角度为45度
$angle = deg2rad(45);
// 在默认中心点(0, 0)处进行旋转
$matrix->rotate($angle);
// 在指定中心点(100, 100)处进行逆时针旋转
$matrix->rotate(-$angle, 100, 100);
注意事项:
deg2rad()函数将角度转换为弧度。