wxr
2022-11-24 2af932533ef851bf983385244e9912976dbd4daa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package com.mm.android.deviceaddmodule.mobilecommon.widget.linechart.animate;
 
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
 
import com.mm.android.deviceaddmodule.mobilecommon.widget.linechart.charts.LineChart;
 
 
public class LAnimator {
 
    float _hitValueY = 1;
    float _hitValueX = 1;
 
    LineChart _LineChart;
 
    public LAnimator(LineChart lineChart) {
        this._LineChart = lineChart;
    }
 
 
    public void animateX(long duration) {
        ValueAnimator animator = ObjectAnimator.ofFloat(0f, 1f);
        animator.setDuration(1000);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                _hitValueX = (float) animation.getAnimatedValue();
 
                _LineChart.postInvalidate();
            }
        });
        animator.start();
    }
 
    public void animateY(long duration) {
        ValueAnimator animator = ObjectAnimator.ofFloat(0f, 1f);
        animator.setDuration(1000);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                _hitValueY = (float) animation.getAnimatedValue();
 
                _LineChart.postInvalidate();
            }
        });
        animator.start();
    }
 
    public void animateXY(long duration) {
        ValueAnimator animator = ObjectAnimator.ofFloat(0f, 1f);
        animator.setDuration(1000);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                _hitValueX = (float) animation.getAnimatedValue();
                _hitValueY = _hitValueX;
 
                _LineChart.postInvalidate();
            }
        });
        animator.start();
    }
 
    public float get_hitValueY() {
        return _hitValueY;
    }
 
    public void set_hitValueY(float _hitValueY) {
        this._hitValueY = _hitValueY;
    }
 
    public float get_hitValueX() {
        return _hitValueX;
    }
 
    public void set_hitValueX(float _hitValueX) {
        this._hitValueX = _hitValueX;
    }
}