Effect

特效:阴影与模糊。

type Effect = ShadowEffect | BlurEffect | LiquidGlassEffect | MotionBlurEffect;

ShadowEffect

阴影。

interface ShadowEffect {
  readonly type: 'DROP_SHADOW' | 'INNER_SHADOW'
  readonly color: RGBA
  readonly offset: Vector
  readonly spread: number
  readonly radius: number
  readonly isVisible: boolean
  readonly blendMode: BlendMode
}
  • type :阴影类型,取值为 DROP_SHADOW 外阴影,或 INNER_SHADOW 内阴影。
  • color :阴影颜色。
  • offset :阴影的位置。
  • spread :扩张度。
  • radius :弧度。
  • isVisible :是否可见。
  • blendMode :混合模式,具体可查看类型 BlendMode

BlurEffect

模糊。

interface BlurEffect {
  readonly type: 'LAYER_BLUR' | 'BACKGROUND_BLUR'
  readonly radius: number
  readonly isVisible: boolean
  readonly blendMode: BlendMode
  readonly gradient: PluginGradientEffect
}

interface PluginGradientEffect {
  readonly mode: 'EVEN' | 'PROGRESSIVE';
  readonly gradientStops?: ReadonlyArray<PluginGradientStopItem>;
  readonly gradientHandlePositions?: [Point, Point];
  readonly transform?: Transform;
}

interface PluginGradientStopItem {
  readonly position: number;
  readonly value: number;
}

interface Point {
  readonly x: number;
  readonly y: number;
}
  • type :模糊类型,取值为 LAYER_BLUR 高斯模糊,或 BACKGROUND_BLUR 背景模糊。
  • radius :圆角。
  • isVisible :是否可见。
  • blendMode :混合模式,具体可查看类型 BlendMode
  • gradient :渐变模糊。
  • mode :渐变模式,取值为 EVEN 均匀模糊,或 PROGRESSIVE 渐进模糊。
  • gradientStops :渐变点和对应的值。
  • gradientHandlePositions :渐变位置。
  • transform :变换,具体可查看类型 Transform

LiquidGlassEffect

液态玻璃。

interface LiquidGlassEffect {
  readonly type: 'LIQUID_GLASS';
  readonly depth: number;
  readonly dispersion: number;
  readonly refraction: number;
  readonly lightIntensity: number;
  readonly lightAngle: number;
  readonly isVisible: boolean;
  readonly radius: number;
  readonly blendMode: BlendMode;
}
  • type :类型,取值为 LIQUID_GLASS 液态玻璃。
  • depth :深度。
  • dispersion :色散。
  • refraction :折射。
  • lightIntensity :强度 光强。
  • lightAngle :角度 光角度。
  • isVisible :是否可见。
  • blendMode :混合模式,具体可查看类型 BlendMode

MotionBlurEffect

动感模糊。

interface MotionBlurEffect {
  readonly isVisible: boolean;
  readonly radius: number;
  readonly angle: number;
  readonly blendMode: BlendMode;
}
  • isVisible :是否可见。
  • radius :模糊半径。
  • angle :角度。
  • blendMode :混合模式,具体可查看类型 BlendMode