makeTransform()
Part of the @remotion/animation-utils package.
Applies a sequence of transformation functions to generate a combined CSS transform property.
API
Takes an array of strings (generated from the below transformation functions) and combines them into a single string.
Usage
tsxmakeTransform ,rotate ,translate } from "@remotion/animation-utils";consttransform =makeTransform ([rotate (45),translate (50, 50)]);// => "rotate(45deg) translate(50px, 50px)"constmarkup = <div style ={{transform }} />;
tsxrotate } from "@remotion/animation-utils";consttransform =rotate (45);// => "rotate(45deg)"constmarkup = <div style ={{transform }} />;
Transformation Functions
matrix()
tsxmatrix } from "@remotion/animation-utils";consttransform =matrix (1, 0, 0, 1, 50, 50);// => "matrix(1, 0, 0, 1, 50, 50)"
matrix3d()
tsxmatrix3d } from "@remotion/animation-utils";consttransform =matrix3d (1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 50, 50, 0, 1);// => "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 50, 50, 0, 1)"
perspective()
tsxperspective } from "@remotion/animation-utils";consttransform =perspective (100);// => "perspective(100px)"
rotate()
tsxrotate } from "@remotion/animation-utils";consttransform =rotate (45);// => "rotate(45deg)"
rotate3d()
tsxrotate3d } from "@remotion/animation-utils";consttransform =rotate3d (1, 0, 0, 45);// => "rotate3d(1, 0, 0, 45deg)"consttransform2 =rotate3d (1, 0, 0, "45deg");// => "rotate3d(1, 0, 0, 45deg)"consttransform3 =rotate3d (1, 0, 0, 45, "deg");// => "rotate3d(1, 0, 0, 45deg)"
rotateX()
tsxrotateX } from "@remotion/animation-utils";consttransform =rotateX (45);// => "rotateX(45deg)"consttransform2 =rotateX ("45deg");// => "rotateX(45deg)"consttransform3 =rotateX (1, "rad");// => "rotateX(45rad)"
rotateY()
tsxrotateY } from "@remotion/animation-utils";consttransform =rotateY (45);// => "rotateY(45deg)"consttransform2 =rotateY ("45deg");// => "rotateY(45deg)"consttransform3 =rotateY (1, "rad");// => "rotateY(1rad)"
rotateZ()
tsxrotateZ } from "@remotion/animation-utils";consttransform =rotateZ (45);// => "rotateZ(45deg)"consttransform2 =rotateZ ("45deg");// => "rotateZ(45deg)"consttransform3 =rotateZ (1, "rad");// => "rotateZ(1rad)"
scale()
tsxscale } from "@remotion/animation-utils";consttransform =scale (2);// => "scale(2, 2)"consttransform2 =scale (2, 3);// => "scale(2, 3)"
scale3d()
tsxscale3d } from "@remotion/animation-utils";consttransform =scale3d (2, 3, 4);// => "scale3d(2, 3, 4)"
scaleX()
tsxscaleX } from "@remotion/animation-utils";consttransform =scaleX (2);// => "scaleX(2)"
scaleY()
tsxscaleY } from "@remotion/animation-utils";consttransform =scaleY (2);// => "scaleY(2)"
scaleZ()
tsxscaleZ } from "@remotion/animation-utils";consttransform =scaleZ (2);// => "scaleZ(2)"
skew()
tsxskew } from "@remotion/animation-utils";consttransform =skew (45);// => "skew(45deg)"
skewX()
tsxskewX } from "@remotion/animation-utils";consttransform =skewX (45);// => "skewX(45deg)"consttransform2 =skewX ("45deg");// => "skewX(45deg)"consttransform3 =skewX (1, "rad");// => "skewX(1rad)"
skewY()
tsxskewY } from "@remotion/animation-utils";consttransform =skewY (45);// => "skewY(45deg)"consttransform2 =skewY ("45deg");// => "skewY(45deg)"consttransform3 =skewY (1, "rad");// => "skewY(1rad)"
translate()
tsxtranslate } from "@remotion/animation-utils";consttransform =translate (10);// => "translate(10px)"consttransform2 =translate ("12rem");// => "translate(12rem)"consttransform3 =translate (10, 20);// => "translate(10px, 20px)"consttransform4 =translate (10, "%");// => "translate(10%)"consttransform5 =translate (0, "%", 10, "%");// => "translate(0%, 10%)"consttransform6 =translate ("10px", "30%");// => "translate(10px, 20%)"
translate3d()
tsxtranslate3d } from "@remotion/animation-utils";consttransform =translate3d (10, 20, 30);// => "translate3d(10px, 20px, 30px)"consttransform2 =translate3d ("10px", "20%", "30rem");// => "translate3d(10px, 20%, 30rem)"consttransform3 =translate3d (10, "%", 20, "px", 30, "px");// => "translate3d(10%, 20px, 30px)"
translateX()
tsxtranslateX } from "@remotion/animation-utils";consttransform =translateX (10);// => "translateX(10px)"consttransform2 =translateX ("12rem");// => "translateX(12rem)"consttransform3 =translateX (10, "%");// => "translateX(10%)"
translateY()
tsxtranslateY } from "@remotion/animation-utils";consttransform =translateY (10);// => "translateY(10px)"consttransform2 =translateY ("12rem");// => "translateY(12rem)"consttransform3 =translateY (10, "px");// => "translateY(10px)"
translateZ()
tsxtranslateZ } from "@remotion/animation-utils";consttransform =translateZ (10);// => "translateZ(10px)"consttransform2 =translateZ ("12rem");// => "translateZ(12rem)"consttransform3 =translateZ (10, "px");// => "translateZ(10px)"