Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add animation in custom shape #52

Closed
JulioManzano opened this issue Oct 14, 2018 · 2 comments
Closed

Add animation in custom shape #52

JulioManzano opened this issue Oct 14, 2018 · 2 comments

Comments

@JulioManzano
Copy link

how can I add an animation for a custom shape

@m-Samhoury
Copy link

To animate custom shape just do this:
Here I created a rectangular shape for a button, multiplying with the value parameter does the job of animating the custom shape.

Find below the code snippet(Kotlin):

override fun draw(canvas: Canvas?, point: PointF?, value: Float, paint: Paint?) {
               canvas?.drawRect((point?.x ?: 0f),
                       (point?.y ?: 0f),
                       ((point?.x ?: 0f) + width) * value,
                       ((point?.y ?: 0f) + height) * value, paint)
           }

@TakuSemba
Copy link
Owner

Yep. You can create a custom shape to tweak the animation.
Thank you @m-Samhoury .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants