pub enum StylePaint {
Solid {
color: Animated<Color>,
},
Gradient(Gradient),
}Expand description
Paint on a style node: solid color or gradient. Animated so whole-list keyframes (e.g. stop-color morphs) work through the existing machinery.
Variants§
Implementations§
Source§impl StylePaint
impl StylePaint
pub fn solid(color: Color) -> Self
pub fn linear(start: DVec2, end: DVec2, stops: GradientStops) -> Self
pub fn radial(center: DVec2, end: DVec2, stops: GradientStops) -> Self
Sourcepub fn sample(&self, frame: f64) -> ScenePaint
pub fn sample(&self, frame: f64) -> ScenePaint
Sample the paint into a ScenePaint at frame.
Sourcepub fn snapshot(&self, frame: f64) -> Self
pub fn snapshot(&self, frame: f64) -> Self
Produce a static paint snapshot at frame.
Current paint is tool state, not an animation track, so copying paint from a document should sample it rather than copying its keyframes.
Sourcepub fn set_base_color(&mut self, color: Color)
pub fn set_base_color(&mut self, color: Color)
Change the representative color while preserving paint type.
For a gradient, this updates its first stop rather than destroying the gradient and converting it to a solid.
Source§impl StylePaint
impl StylePaint
Sourcepub fn base_color(&self) -> Color
pub fn base_color(&self) -> Color
For a solid paint: the (possibly keyed) base color. For a gradient: the first stop’s color (stable handle for conversions).
Trait Implementations§
Source§impl Clone for StylePaint
impl Clone for StylePaint
Source§fn clone(&self) -> StylePaint
fn clone(&self) -> StylePaint
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StylePaint
impl Debug for StylePaint
Source§impl<'de> Deserialize<'de> for StylePaint
impl<'de> Deserialize<'de> for StylePaint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for StylePaint
impl PartialEq for StylePaint
Source§impl PropValue for StylePaint
impl PropValue for StylePaint
fn into_value(self) -> Value
fn from_value(v: &Value) -> Option<Self>
Source§impl Serialize for StylePaint
impl Serialize for StylePaint
impl StructuralPartialEq for StylePaint
Auto Trait Implementations§
impl Freeze for StylePaint
impl RefUnwindSafe for StylePaint
impl Send for StylePaint
impl Sync for StylePaint
impl Unpin for StylePaint
impl UnsafeUnpin for StylePaint
impl UnwindSafe for StylePaint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more