style/values/computed/
motion.rs1use crate::derives::*;
8use crate::values::computed::basic_shape::BasicShape;
9use crate::values::computed::url::ComputedUrl;
10use crate::values::computed::{Angle, LengthPercentage, Position};
11use crate::values::generics::motion::{
12 GenericOffsetPath, GenericOffsetPathFunction, GenericOffsetPosition, GenericRayFunction,
13};
14use crate::Zero;
15
16pub type RayFunction = GenericRayFunction<Angle, Position>;
18
19pub type OffsetPathFunction = GenericOffsetPathFunction<BasicShape, RayFunction, ComputedUrl>;
21
22pub type OffsetPath = GenericOffsetPath<OffsetPathFunction>;
24
25pub type OffsetPosition = GenericOffsetPosition<LengthPercentage, LengthPercentage>;
27
28#[inline]
29fn is_auto_zero_angle(auto: &bool, angle: &Angle) -> bool {
30 *auto && angle.is_zero()
31}
32
33#[derive(
35 Animate,
36 Clone,
37 ComputeSquaredDistance,
38 Copy,
39 Debug,
40 Deserialize,
41 MallocSizeOf,
42 PartialEq,
43 Serialize,
44 ToAnimatedValue,
45 ToAnimatedZero,
46 ToCss,
47 ToResolvedValue,
48 ToTyped,
49)]
50#[repr(C)]
51pub struct OffsetRotate {
52 #[animation(constant)]
57 #[css(represents_keyword)]
58 pub auto: bool,
59 #[css(contextual_skip_if = "is_auto_zero_angle")]
61 pub angle: Angle,
62}
63
64impl OffsetRotate {
65 #[inline]
67 pub fn auto() -> Self {
68 OffsetRotate {
69 auto: true,
70 angle: Zero::zero(),
71 }
72 }
73}