Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override fun onDraw(canvas: Canvas) {
- super.onDraw(canvas)
- //draw circles separated by a space the size of waveGap
- var currentRadius = initialRadius + waveRadiusOffset
- while (currentRadius < maxRadius) {
- val path = createStarPath(currentRadius, wavePath)
- val offset = currentRadius / maxRadius
- val rounding = lerp(currentRadius / 2f, currentRadius * 4f, offset)
- wavePaint.pathEffect = CornerPathEffect(rounding)
- canvas.drawPath(path, wavePaint)
- currentRadius += waveGap
- }
- canvas.drawPaint(gradientPaint)
- }
- // linear interpolation
- private fun lerp(a: Float, b: Float, t: Float): Float {
- return a + (b - a) * t
- }
Add Comment
Please, Sign In to add comment