Jorge Castillo
07/24/2020, 1:43 PMLayout
?Adam Powell
07/24/2020, 1:59 PMJorge Castillo
07/24/2020, 2:08 PMCanvas
, want to clip the canvas only up to a specific height, and clipRect
would require absolute position in px if I'm not mistaken?fun DrawScope.plainClip(currentFillPhase: Float, block: DrawScope.() -> Unit) {
val halfWidth = (size.width / 2f)
val halfHeight = (size.height / 2f)
val left = center.dx - halfWidth
val top = center.dy - halfHeight
val right = center.dx + halfWidth
val bottom = center.dy + halfHeight
this.clipRect(
left = left,
top = (bottom - top) * (1f - currentFillPhase),
right = right,
bottom = bottom,
clipOp = ClipOp.intersect,
block = block
)
}
I'd like to clip up to a given height percent on the canvas, but not 100% sure that'd need to require global y for the clipping rect or should it be relative like this.Adam Powell
07/24/2020, 2:21 PMJorge Castillo
07/24/2020, 2:25 PMAdam Powell
07/24/2020, 2:32 PMJorge Castillo
07/24/2020, 2:33 PM