style/values/animated/
svg.rs1use super::{Animate, Procedure};
8use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
9use crate::values::generics::svg::SVGStrokeDashArray;
10
11impl<L> Animate for SVGStrokeDashArray<L>
13where
14 L: Clone + Animate,
15{
16 #[inline]
17 fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
18 if matches!(procedure, Procedure::Add | Procedure::Accumulate { .. }) {
19 return Err(());
21 }
22 match (self, other) {
23 (&SVGStrokeDashArray::Values(ref this), &SVGStrokeDashArray::Values(ref other)) => {
24 Ok(SVGStrokeDashArray::Values(
25 super::lists::repeatable_list::animate(this, other, procedure)?,
26 ))
27 },
28 _ => Err(()),
29 }
30 }
31}
32
33impl<L> ComputeSquaredDistance for SVGStrokeDashArray<L>
34where
35 L: ComputeSquaredDistance,
36{
37 #[inline]
38 fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
39 match (self, other) {
40 (&SVGStrokeDashArray::Values(ref this), &SVGStrokeDashArray::Values(ref other)) => {
41 super::lists::repeatable_list::squared_distance(this, other)
42 },
43 _ => Err(()),
44 }
45 }
46}