freya_elements/attributes/transform_attributes.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
use crate::def_attribute;
def_attribute!(
    /// Specify the rotation for this element.
    ///
    /// Syntax is `<0-360>deg`.
    ///
    /// Note: Rotations don't affect neither layout or mouse events, they are merely a rendering effect.
    ///
    /// ### Example
    ///
    /// ```rust, no_run
    /// # use freya::prelude::*;
    /// fn app() -> Element {
    ///     rsx!(
    ///         rect {
    ///             background: "red",
    ///             rotate: "180deg",
    ///             label {
    ///                 "Freya!"
    ///             }
    ///         }
    ///     )
    /// }
    /// ```
    rotate,
    /// Specify the opacity for this element.
    ///
    /// Accepted values is from `0` to `1`.
    ///
    /// ### Example
    ///
    /// ```rust, no_run
    /// # use freya::prelude::*;
    /// fn app() -> Element {
    ///     rsx!(
    ///         rect {
    ///             opacity: "0.5",
    ///             label {
    ///                 "Freya!"
    ///             }
    ///         }
    ///     )
    /// }
    /// ```
    opacity,
    /// Specify the scale for this element.
    ///
    /// Accepted syntax:
    /// - `<f32>`: Same value for both scale x and y.
    /// - `<f32>, <f32>`: Specify the scale x and y separately.
    ///
    /// Note: Scaling doesn't affect neither layout or mouse events, it is only a rendering effect.
    ///
    /// ### Example
    ///
    /// ```rust, no_run
    /// # use freya::prelude::*;
    /// fn app() -> Element {
    ///     rsx!(
    ///         rect {
    ///             background: "red",
    ///             scale: "0.7",
    ///             label {
    ///                 "Freya!"
    ///             }
    ///         }
    ///     )
    /// }
    /// ```
    scale,
);