Transforms
sunnylqm(100.00%)
本文档贡献者:Transforms are style properties that will help you modify the appearance and position of your components using 2D or 3D transformations. However, once you apply transforms, the layouts remain the same around the transformed component hence it might overlap with the nearby components. You can apply margin to the transformed component, the nearby components or padding to the container to prevent such overlaps.
示例
- 函数组件示例
- Class组件示例
Reference
Methods
transform()
transform
accepts an array of transformation objects. Each object specifies the property that will be transformed as the key, and the value to use in the transformation. Objects should not be combined. Use a single key/value pair per object.
The rotate transformations require a string so that the transform may be expressed in degrees (deg) or radians (rad). For example:
transform([{ rotateX: '45deg' }, { rotateZ: '0.785398rad' }]);
The skew transformations require a string so that the transform may be expressed in degrees (deg). For example:
transform([{ skewX: '45deg' }]);
Type | Required |
---|---|
array of objects: {perspective: number}, {rotate: string}, {rotateX: string}, {rotateY: string}, {rotateZ: string}, {scale: number}, {scaleX: number}, {scaleY: number}, {translateX: number}, {translateY: number}, {skewX: string}, {skewY: string} | No |
decomposedMatrix
, rotation
, scaleX
, scaleY
, transformMatrix
, translateX
, translateY
已过时。 Use the
transform
prop instead.