feat:新增旋转功能

This commit is contained in:
奔跑的面条
2022-05-03 16:24:31 +08:00
parent ab96d0919f
commit ef9e4c8ea4
8 changed files with 120 additions and 19 deletions
+10 -2
View File
@@ -47,11 +47,19 @@ export const animationsClass = (animations: string[]) => {
}
// 滤镜
export const getStyle = (styles: StylesType | EditCanvasConfigType) => {
export const getFilterStyle = (styles: StylesType | EditCanvasConfigType) => {
const { opacity, saturate, contrast, hueRotate, brightness } = styles
return {
// 透明度
opacity: opacity,
filter: `saturate(${saturate}) contrast(${contrast}) hue-rotate(${hueRotate}deg) brightness(${brightness})`
filter: `saturate(${saturate}) contrast(${contrast}) hue-rotate(${hueRotate}deg) brightness(${brightness})`,
}
}
// 变换
export const getTranstormStyle = (styles: StylesType) => {
const { rotateZ, rotateX, rotateY, skewX, skewY } = styles
return {
transform: `rotateZ(${rotateZ || 0}deg) rotateX(${rotateX || 0}deg) rotateY(${rotateY || 0}deg) skewX(${skewX || 0}deg) skewY(${skewY || 0}deg)`,
}
}