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

Animate the Circle anti-clockwise #2

Open
carlos-osejo opened this issue Dec 11, 2014 · 2 comments
Open

Animate the Circle anti-clockwise #2

carlos-osejo opened this issue Dec 11, 2014 · 2 comments

Comments

@carlos-osejo
Copy link

There is not an option to change the animation from clockwise to anit-clokwise, I have to spent a couple of hours researching for implementing the anti-clockwise animation that I need to develop, so I think you can add this feature to your component and be custom in that way to. It very useful and works excellent.

I did it changing this line
mDrawAnimator = ObjectAnimator.ofFloat(this, "phase", mPhase,1.0f).setDuration(3000);

for this:
mDrawAnimator = ObjectAnimator.ofFloat(this, "phase", 1.0f,mPhase).setDuration(3000);

I dont know if there a better way, but I hope it will help.

@alexandersch
Copy link

alexandersch commented Oct 19, 2016

Your modification didn't really work for me as hoped.

I had to rework the showValue method. I've also modified some paint colors for the drawWholeCirlcle and drawInnerCircle method, for everything to work.

So basicly I've modified the showValue method:

calcAngle(toShow / total * 100f)
to:
calcAngle((100f - (toShow / total) * 100f)) * -1;

It calculates the remaining percentage instead of the percentage to fill.
It also reverses the angle to a negative angle which is needed to reverse the animation.

In the example below, the circle then goes from full -> empty, instead of empty -> full.

ezgif-1423373869

@bandarunaresh
Copy link

bandarunaresh commented Apr 6, 2017

i filled the color in clockwise direction. I want to reverse animation like anticlockwise with remove the filled color with clockwise direction.

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