Type Alias style::values::computed::transform::TransformOperation

source ·
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

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 ComputeSquaredDistance for TransformOperation

source§

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

Computes the squared distance between two animatable values.
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