1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【JetpackCompose】Canvasで作った円形の背景にグラデーションを設定する方法

Posted at

前回は通常の画面の背景にグラデーションを設定しましたが、今回は円形の背景にグラデーションを設定してみようと思います。

CircleGradation.kt
@Composable
fun CircleGradation() {
    Canvas(
        modifier = Modifier.size(80.dp),
        onDraw = {
            drawCircle(
                Brush.verticalGradient(
                    listOf(
                        Color.Blue,
                        Color.White
                    )
                )
            )
        }
    )
}

前回と同じくBrushを作成してdrawCircle設定します。

スクリーンショット 2023-03-05 12.36.53.png

こんな感じになりました。
サイズやカラーは自由に変更してください!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?