Skip to content

Instantly share code, notes, and snippets.

Created Jul 24, 2017
What would you like to do?
class FernView : View {
var fern: Fern = BarnsleyFern()
var n: Int = 100000
constructor(ctx: Context) : super(ctx)
constructor(ctx: Context, attributeSet: AttributeSet) : super(ctx, attributeSet)
val paint = Paint()
override fun onDraw(canvas: Canvas) {
canvas.translate(width / 2f, 0f) = Paint.Style.FILL
paint.color = Color.WHITE
paint.color = Color.parseColor("#006200")
val points = fern.generateFern(n)
canvas.drawPoints(points, paint)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment