pub type TransformOperation = GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>;
Expand description

A single operation in a computed CSS transform

Aliased Type§

enum TransformOperation {
Show 23 variants Matrix(GenericMatrix<f32>), Matrix3D(GenericMatrix3D<f32>), Skew(Angle, Angle), SkewX(Angle), SkewY(Angle), Translate(LengthPercentage, LengthPercentage), TranslateX(LengthPercentage), TranslateY(LengthPercentage), TranslateZ(CSSPixelLength), Translate3D(LengthPercentage, LengthPercentage, CSSPixelLength), Scale(f32, f32), ScaleX(f32), ScaleY(f32), ScaleZ(f32), Scale3D(f32, f32, f32), Rotate(Angle), RotateX(Angle), RotateY(Angle), RotateZ(Angle), Rotate3D(f32, f32, f32, Angle), Perspective(GenericPerspectiveFunction<CSSPixelLength>), InterpolateMatrix { from_list: GenericTransform<GenericTransformOperation<Angle, f32, CSSPixelLength, i32, LengthPercentage>>, to_list: GenericTransform<GenericTransformOperation<Angle, f32, CSSPixelLength, i32, LengthPercentage>>, progress: Percentage, }, AccumulateMatrix { from_list: GenericTransform<GenericTransformOperation<Angle, f32, CSSPixelLength, i32, LengthPercentage>>, to_list: GenericTransform<GenericTransformOperation<Angle, f32, CSSPixelLength, i32, LengthPercentage>>, count: i32, },
}

Variants§

§

Matrix(GenericMatrix<f32>)

Represents a 2D 2x3 matrix.

§

Matrix3D(GenericMatrix3D<f32>)

Represents a 3D 4x4 matrix.

§

Skew(Angle, Angle)

A 2D skew.

If the second angle is not provided it is assumed zero.

Syntax can be skew(angle) or skew(angle, angle)

§

SkewX(Angle)

skewX(angle)

§

SkewY(Angle)

skewY(angle)

§

Translate(LengthPercentage, LengthPercentage)

translate(x, y) or translate(x)

§

TranslateX(LengthPercentage)

translateX(x)

§

TranslateY(LengthPercentage)

translateY(y)

§

TranslateZ(CSSPixelLength)

translateZ(z)

§

Translate3D(LengthPercentage, LengthPercentage, CSSPixelLength)

translate3d(x, y, z)

§

Scale(f32, f32)

A 2D scaling factor.

Syntax can be scale(factor) or scale(factor, factor)

§

ScaleX(f32)

scaleX(factor)

§

ScaleY(f32)

scaleY(factor)

§

ScaleZ(f32)

scaleZ(factor)

§

Scale3D(f32, f32, f32)

scale3D(factorX, factorY, factorZ)

§

Rotate(Angle)

Describes a 2D Rotation.

In a 3D scene rotate(angle) is equivalent to rotateZ(angle).

§

RotateX(Angle)

Rotation in 3D space around the x-axis.

§

RotateY(Angle)

Rotation in 3D space around the y-axis.

§

RotateZ(Angle)

Rotation in 3D space around the z-axis.

§

Rotate3D(f32, f32, f32, Angle)

Rotation in 3D space.

Generalization of rotateX, rotateY and rotateZ.

§

Perspective(GenericPerspectiveFunction<CSSPixelLength>)

Specifies a perspective projection matrix.

Part of CSS Transform Module Level 2 and defined at § 13.1. 3D Transform Function.

The value must be greater than or equal to zero.

§

InterpolateMatrix

A intermediate type for interpolation of mismatched transform lists.

§

AccumulateMatrix

A intermediate type for accumulation of mismatched transform lists.

Implementations§

source§

impl TransformOperation

source

fn try_animate_mismatched_transforms_in_place( left: &[Self], right: &[Self], procedure: Procedure ) -> Result<Self, ()>

If there are no size dependencies, we try to animate in-place, to avoid creating deeply nested Interpolate* operations.

source

fn animate_mismatched_transforms( left: &[Self], right: &[Self], procedure: Procedure ) -> Result<Self, ()>

source§

impl TransformOperation

source

pub fn to_translate_3d(&self) -> Self

Convert to a Translate3D.

Must be called on a Translate function

source

pub fn to_rotate_3d(&self) -> Self

Convert to a Rotate3D.

Must be called on a Rotate function.

source

pub fn to_scale_3d(&self) -> Self

Convert to a Scale3D.

Must be called on a Scale function

source§

impl<Angle, Number, Length, Integer, LengthPercentage> TransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero, LengthPercentage: Zero + ZeroNoPercent, Number: PartialEq,

source

pub fn is_rotate(&self) -> bool

Check if it is any rotate function.

source

pub fn is_translate(&self) -> bool

Check if it is any translate function

source

pub fn is_scale(&self) -> bool

Check if it is any scale function

Trait Implementations§

source§

impl Animate for TransformOperation

source§

fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()>

Animate a value towards another one, given an animation procedure.
source§

impl<Angle, Number, Length: Clone, Integer: Clone, LengthPercentage> Clone for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + Clone, LengthPercentage: Zero + ZeroNoPercent + Clone, Number: PartialEq + Clone,

source§

fn clone( &self ) -> GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ComputeSquaredDistance for TransformOperation

source§

fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>

Computes the squared distance between two animatable values.
source§

impl<Angle, Number, Length: Debug, Integer: Debug, LengthPercentage> Debug for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + Debug, LengthPercentage: Zero + ZeroNoPercent + Debug, Number: PartialEq + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de, Angle, Number, Length, Integer, LengthPercentage> Deserialize<'de> for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + Deserialize<'de>, LengthPercentage: Zero + ZeroNoPercent + Deserialize<'de>, Number: PartialEq + Deserialize<'de>, Length: Deserialize<'de>, Integer: Deserialize<'de>,

source§

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<Angle, Number, Length, Integer, LengthPercentage> MallocSizeOf for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + MallocSizeOf, LengthPercentage: Zero + ZeroNoPercent + MallocSizeOf, Number: PartialEq + MallocSizeOf, Length: MallocSizeOf, Integer: MallocSizeOf,

source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.
source§

impl<Angle, Number, Length: PartialEq, Integer: PartialEq, LengthPercentage> PartialEq<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>> for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + PartialEq, LengthPercentage: Zero + ZeroNoPercent + PartialEq, Number: PartialEq + PartialEq,

source§

fn eq( &self, other: &GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage> ) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Angle, Number, Length, Integer, LengthPercentage> Serialize for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + Serialize, LengthPercentage: Zero + ZeroNoPercent + Serialize, Number: PartialEq + Serialize, Length: Serialize, Integer: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<Angle, Number, Length, Integer, LengthPercentage> SpecifiedValueInfo for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + SpecifiedValueInfo, LengthPercentage: Zero + ZeroNoPercent + SpecifiedValueInfo, Number: PartialEq + SpecifiedValueInfo, Length: SpecifiedValueInfo, Integer: SpecifiedValueInfo,

source§

const SUPPORTED_TYPES: u8 = 0u8

Supported CssTypes by the given value type. Read more
source§

fn collect_completion_keywords(_f: &mut dyn FnMut(&[&'static str]))

Collect value starting words for the given specified value type. This includes keyword and function names which can appear at the beginning of a value of this type. Read more
source§

impl ToAnimatedZero for TransformOperation

Build an equivalent ‘identity transform function list’ based on an existing transform list. http://dev.w3.org/csswg/css-transforms/#none-transform-animation

source§

fn to_animated_zero(&self) -> Result<Self, ()>

Returns a value that, when added with an underlying value, will produce the underlying value. This is used for SMIL animation’s “by-animation” where SMIL first interpolates from the zero value to the ‘by’ value, and then adds the result to the underlying value. Read more
source§

impl<Angle, Number, Length, Integer, LengthPercentage> ToComputedValue for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + ToComputedValue, LengthPercentage: Zero + ZeroNoPercent + ToComputedValue, Number: PartialEq + ToComputedValue, <Angle as ToComputedValue>::ComputedValue: Zero, <LengthPercentage as ToComputedValue>::ComputedValue: Zero + ZeroNoPercent, <Number as ToComputedValue>::ComputedValue: PartialEq, Length: ToComputedValue, Integer: ToComputedValue,

§

type ComputedValue = GenericTransformOperation<<Angle as ToComputedValue>::ComputedValue, <Number as ToComputedValue>::ComputedValue, <Length as ToComputedValue>::ComputedValue, <Integer as ToComputedValue>::ComputedValue, <LengthPercentage as ToComputedValue>::ComputedValue>

The computed value type we’re going to be converted to.
source§

fn from_computed_value(from: &Self::ComputedValue) -> Self

Convert a computed value to specified value form. Read more
source§

fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue

Convert a specified value to a computed value, using itself and the data inside the Context.
source§

impl<Angle, Number, Length, Integer, LengthPercentage> ToCss for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + ToCss, LengthPercentage: Zero + ZeroNoPercent + ToCss, Number: PartialEq + ToCss, Length: ToCss, Integer: ToCss,

source§

fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Resultwhere W: Write,

Serialize self in CSS syntax, writing to dest.
source§

fn to_css_string(&self) -> String

Serialize self in CSS syntax and return a string. Read more
source§

impl<Angle, Number, Length, Integer, LoP> ToMatrix for TransformOperation<Angle, Number, Length, Integer, LoP>where Angle: Zero + ToRadians + Copy, Number: PartialEq + Copy + Into<f32> + Into<f64>, Length: ToAbsoluteLength, LoP: Zero + ToAbsoluteLength + ZeroNoPercent,

source§

fn to_3d_matrix( &self, reference_box: Option<&Rect<ComputedLength>> ) -> Result<Transform3D<f64>, ()>

If |reference_box| is None, we will drop the percent part from translate because we cannot resolve it without the layout info, for computed TransformOperation. However, for specified TransformOperation, we will return Err(()) if there is any relative lengths because the only caller, DOMMatrix, doesn’t accept relative lengths.

source§

fn is_3d(&self) -> bool

Check if it is a 3d transform function.
source§

impl<Angle, Number, Length, Integer, LengthPercentage> ToResolvedValue for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + ToResolvedValue, LengthPercentage: Zero + ZeroNoPercent + ToResolvedValue, Number: PartialEq + ToResolvedValue, <Angle as ToResolvedValue>::ResolvedValue: Zero, <LengthPercentage as ToResolvedValue>::ResolvedValue: Zero + ZeroNoPercent, <Number as ToResolvedValue>::ResolvedValue: PartialEq, Length: ToResolvedValue, Integer: ToResolvedValue,

§

type ResolvedValue = GenericTransformOperation<<Angle as ToResolvedValue>::ResolvedValue, <Number as ToResolvedValue>::ResolvedValue, <Length as ToResolvedValue>::ResolvedValue, <Integer as ToResolvedValue>::ResolvedValue, <LengthPercentage as ToResolvedValue>::ResolvedValue>

The resolved value type we’re going to be converted to.
source§

fn from_resolved_value(from: Self::ResolvedValue) -> Self

Convert a resolved value to resolved value form.
source§

fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue

Convert a resolved value to a resolved value.
source§

impl<Angle, Number, Length, Integer, LengthPercentage> ToShmem for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + ToShmem, LengthPercentage: Zero + ZeroNoPercent + ToShmem, Number: PartialEq + ToShmem, Length: ToShmem, Integer: ToShmem,

source§

fn to_shmem(&self, builder: &mut SharedMemoryBuilder) -> Result<Self>

Clones this value into a form suitable for writing into a SharedMemoryBuilder. Read more
source§

impl<Angle, Number, Length, Integer, LengthPercentage> StructuralPartialEq for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero, LengthPercentage: Zero + ZeroNoPercent, Number: PartialEq,