Skip to content

Commit

Permalink
Merge pull request #15 from tajchert/master
Browse files Browse the repository at this point in the history
Animate from void to any number ! Thanks tajchert
  • Loading branch information
adnan-SM committed Aug 27, 2014
2 parents 9ed59a9 + 4b206a8 commit ee681c0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ public ObjectAnimator animate(int start, int end) {
return ObjectAnimator.ofObject(this, CONTROL_POINTS_PROPERTY, new TimelyEvaluator(), startPoints, endPoints);
}

public ObjectAnimator animate(int end) {
float[][] startPoints = NumberUtils.getControlPointsFor(-1);
float[][] endPoints = NumberUtils.getControlPointsFor(end);

return ObjectAnimator.ofObject(this, CONTROL_POINTS_PROPERTY, new TimelyEvaluator(), startPoints, endPoints);
}

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class NumberUtils {

public static float[][] getControlPointsFor(int start) {
switch (start) {
case (-1):
return Null.getInstance().getControlPoints();
case 0:
return Zero.getInstance().getControlPoints();
case 1:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.github.adnansm.timelytextview.model.number;


import com.github.adnansm.timelytextview.model.core.Figure;

public class Null extends Figure {
private static final float[][] POINTS = {
{0.5f, 0.5f}, {0.5f, 0.5f}, {0.5f, 0.5f},
{0.5f, 0.5f}, {0.5f, 0.5f}, {0.5f, 0.5f},
{0.5f, 0.5f}, {0.5f, 0.5f}, {0.5f, 0.5f},
{0.5f, 0.5f}, {0.5f, 0.5f}, {0.5f, 0.5f},
{0.5f, 0.5f}
};

private static final Null INSTANCE = new Null();

protected Null() {
super(POINTS);
}

public static Null getInstance() {
return INSTANCE;
}
}

0 comments on commit ee681c0

Please sign in to comment.