figma_api/models/
base_shadow_effect.rs

1/*
2 * Figma API
3 *
4 * This is the OpenAPI specification for the [Figma REST API](https://www.figma.com/developers/api).  Note: we are releasing the OpenAPI specification as a beta given the large surface area and complexity of the REST API. If you notice any inaccuracies with the specification, please [file an issue](https://github.com/figma/rest-api-spec/issues).
5 *
6 * The version of the OpenAPI document: 0.31.0
7 * Contact: support@figma.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// BaseShadowEffect : Base properties shared by all shadow effects
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct BaseShadowEffect {
17    /// The color of the shadow
18    #[serde(rename = "color")]
19    pub color: Box<models::Rgba>,
20    /// Blend mode of the shadow
21    #[serde(rename = "blendMode")]
22    pub blend_mode: models::BlendMode,
23    /// How far the shadow is projected in the x and y directions
24    #[serde(rename = "offset")]
25    pub offset: Box<models::Vector>,
26    /// Radius of the blur effect (applies to shadows as well)
27    #[serde(rename = "radius")]
28    pub radius: f64,
29    /// The distance by which to expand (or contract) the shadow.  For drop shadows, a positive `spread` value creates a shadow larger than the node, whereas a negative value creates a shadow smaller than the node.  For inner shadows, a positive `spread` value contracts the shadow. Spread values are only accepted on rectangles and ellipses, or on frames, components, and instances with visible fill paints and `clipsContent` enabled. When left unspecified, the default value is 0.
30    #[serde(rename = "spread", skip_serializing_if = "Option::is_none")]
31    pub spread: Option<f64>,
32    /// Whether this shadow is visible.
33    #[serde(rename = "visible")]
34    pub visible: bool,
35    #[serde(rename = "boundVariables", skip_serializing_if = "Option::is_none")]
36    pub bound_variables: Option<Box<models::BaseShadowEffectBoundVariables>>,
37}
38
39impl BaseShadowEffect {
40    /// Base properties shared by all shadow effects
41    pub fn new(color: models::Rgba, blend_mode: models::BlendMode, offset: models::Vector, radius: f64, visible: bool) -> BaseShadowEffect {
42        BaseShadowEffect {
43            color: Box::new(color),
44            blend_mode,
45            offset: Box::new(offset),
46            radius,
47            spread: None,
48            visible,
49            bound_variables: None,
50        }
51    }
52}
53