OneScript

clipShape

使用矩形、圆形或胶囊形裁切视图。

clipShape(shape) 会裁切前序 Modifier 产生的全部内容。

import { Image, Modifier, Shape } from "onescript/views"

const avatarURL = new URL("https://example.com/avatar.png")

<Image
  url={avatarURL}
  resizable
  modifier={Modifier
    .scaledToFill()
    .frame({ width: 64, height: 64 })
    .clipShape(Shape.circle)}
/>

可用形状包括 Shape.rect(cornerRadius)、Shape.circle 和 Shape.capsule,详见 Shape。

How is this guide?

最后更新于