Skip to main content

parse_angle_to_deg

Function parse_angle_to_deg 

Source
pub fn parse_angle_to_deg(s: &str) -> Option<f32>
Expand description

CSS 角度値(<angle>)を度(deg)単位の f32 に変換する。 W3C CSS Values and Units Level 3 §6.1 準拠:

  • deg: 360deg = 1周
  • grad: 400grad = 360deg (1grad = 0.9deg)
  • rad: 2π rad = 360deg (1rad = 180 / π deg ≈ 57.2957795deg)
  • turn: 1turn = 360deg
  • 単位なし(0 または裸数値): 0 の場合は 0deg、それ以外も寛容に度としてパース。