figma_api/models/drop_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#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct DropShadowEffect {
16 /// The color of the shadow
17 #[serde(rename = "color")]
18 pub color: Box<models::Rgba>,
19 /// Blend mode of the shadow
20 #[serde(rename = "blendMode")]
21 pub blend_mode: models::BlendMode,
22 /// How far the shadow is projected in the x and y directions
23 #[serde(rename = "offset")]
24 pub offset: Box<models::Vector>,
25 /// Radius of the blur effect (applies to shadows as well)
26 #[serde(rename = "radius")]
27 pub radius: f64,
28 /// 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.
29 #[serde(rename = "spread", skip_serializing_if = "Option::is_none")]
30 pub spread: Option<f64>,
31 /// Whether this shadow is visible.
32 #[serde(rename = "visible")]
33 pub visible: bool,
34 #[serde(rename = "boundVariables", skip_serializing_if = "Option::is_none")]
35 pub bound_variables: Option<Box<models::BaseShadowEffectBoundVariables>>,
36 /// Whether to show the shadow behind translucent or transparent pixels
37 #[serde(rename = "showShadowBehindNode")]
38 pub show_shadow_behind_node: bool,
39}
40
41impl DropShadowEffect {
42 pub fn new(color: models::Rgba, blend_mode: models::BlendMode, offset: models::Vector, radius: f64, visible: bool, show_shadow_behind_node: bool) -> DropShadowEffect {
43 DropShadowEffect {
44 color: Box::new(color),
45 blend_mode,
46 offset: Box::new(offset),
47 radius,
48 spread: None,
49 visible,
50 bound_variables: None,
51 show_shadow_behind_node,
52 }
53 }
54}
55