Kanvas
WORK IN PROGRESS
Make canvas easier to use in Kotlin blush
Use shapes & write less code to do more magic
Examples
Available shapes
Shapes | link |
---|---|
Rect | |
Circle | |
Text | |
Arc | |
Line | |
Triangle | |
Drawable | |
Path |
Animation
Follow the example of SwitchView
Shape animations are executed by an instance of ShapeAnimator
attached to your view
All animated methods of shapes are wrapped into the method .animate()
For example, for a CircleShape
, you can animate his position (centerX) using
Then use your ShapeAnimator
to execute this animation
Added support methods to Canvas
drawArc(centerX, centerY, circleRadius, startAngle, sweepAngle, paint)
drawArc(center: PointF, circleRadius, startAngle, sweepAngle, paint)
drawArc(left, top, right, bottom, startAngle, sweepAngle, useCenter, paint)
drawOval(left, top, right, bottom, startAngle, sweepAngle, useCenter, paint)
drawLine(start: PointF, end: PointF, paint)
drawRoundRect(left, top, right, bottom, rx, ry, paint)
Added support methods to Path
addRoundRect(left, top, right, bottom, rx, ry, dir: Path.Direction)
addRoundRect(left, top, right, bottom, radiiArray, dir: Path.Direction)
arcTo(centerX, centerY, circleRadius, startAngle, sweepAngle, forceMoveTo)
arcTo(center: PointF, circleRadius, startAngle, sweepAngle, forceMoveTo)
arcTo(left, top, right, bottom, startAngle, sweepAngle, forceMoveTo)