Guest User

Untitled

a guest
Nov 20th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. override fun onDraw(canvas: Canvas) {
  2. super.onDraw(canvas)
  3.  
  4. //draw circles separated by a space the size of waveGap
  5. var currentRadius = initialRadius + waveRadiusOffset
  6. while (currentRadius < maxRadius) {
  7. val path = createStarPath(currentRadius, wavePath)
  8.  
  9. val offset = currentRadius / maxRadius
  10. val rounding = lerp(currentRadius / 2f, currentRadius * 4f, offset)
  11. wavePaint.pathEffect = CornerPathEffect(rounding)
  12.  
  13. canvas.drawPath(path, wavePaint)
  14. currentRadius += waveGap
  15. }
  16.  
  17. canvas.drawPaint(gradientPaint)
  18. }
  19.  
  20. // linear interpolation
  21. private fun lerp(a: Float, b: Float, t: Float): Float {
  22. return a + (b - a) * t
  23. }
Add Comment
Please, Sign In to add comment