i'm starting android wear , want make circle animation, making grow. know how it, think, it's doing very slow, hope can me
i have class variable
paint manimation;
intialized on method oncreate
manimation = new paint(paint.anti_alias_flag); manimation.setstyle(paint.style.fill); manimation.setcolor(color.green);
and on ondraw method have
@override public void ondraw(canvas canvas, rect bounds) { int width = bounds.width(); int height = bounds.height(); float centerx = width / 2f; float centery = height / 2f; // draw background. canvas.drawrect(0, 0, bounds.width(), bounds.height(), mbackgroundpaint); canvas.drawcircle(0, centery, radiusplus, manimation); radiusplus += 20; }
the animation "correct", slow, if paused.
thanks!!
edit
i found example , found why. didn't invalidate view @ end of ondraw. it's working fine. thanks.
@override public void ondraw(canvas canvas, rect bounds) { int width = bounds.width(); int height = bounds.height(); float centerx = width / 2f; float centery = height / 2f; // draw background. canvas.drawrect(0, 0, bounds.width(), bounds.height(), mbackgroundpaint); canvas.drawcircle(0, centery, radiusplus, manimation); radiusplus += 5; if (isvisible() && !isinambientmode()) { invalidate(); } }