-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUITweenShape.pde
102 lines (81 loc) · 2.93 KB
/
UITweenShape.pde
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import de.looksgood.ani.*; //<>// //<>// //<>// //<>//
class UITweenShape { //<>// //<>// //<>// //<>//
ArrayList<Integer> shapesToRemove;
public UITweenShape() {
shapesToRemove = new ArrayList<Integer>();
}
void tweenShape(UIShape shape, String fieldName, int to, float duration, de.looksgood.ani.easing.Easing easing, float delay) {
Ani.to(shape, duration, delay, fieldName, to, easing);
}
void tweenShape(UIShape shape, String fieldName, int to, float duration) {
tweenShape(shape, fieldName, to, duration, Ani.CUBIC_OUT, 0);
}
//void step(float delta) {
// for (int i = 0; i < shapes.size(); i++) {
// UIShapeTweened s = shapes.get(i);
// s.step(delta);
// if (s.time > (s.duration + s.delay)) {
// s.shape.c = s.c & ~#000000 | (s.to << 24);
// s.shape.strokeColor = s.sc & ~#000000 | (s.to << 24);
// shapesToRemove.add(i);
// }
// }
// for (int i = shapesToRemove.size() - 1; i > -1; i--) {
// int inx = shapesToRemove.get(i);
// shapes.remove(inx);
// }
// shapesToRemove.clear();
//}
//class UIShapeTweened {
// float duration;
// float delay;
// float time;
// int from;
// int to;
// int alpha;
// UIShape shape;
// color c;
// color sc;
// color cc;
// public UIShapeTweened(UIShape _shape, int _from, int _to, float _duration, float _delay) {
// shape = _shape;
// from = _from;
// to = _to;
// duration = _duration;
// delay = _delay;
// c = shape.c;
// sc = shape.strokeColor;
// shape.c = c & 0xffffff | (from << 24);
// shape.strokeColor = sc & 0xffffff | (from << 24);
// }
// void step(float delta) {
// if (time >= delay) {
// alpha = round(EaseInOutQuad(time-delay, from, to - from, duration));
// shape.c = c & ~#000000 | (alpha << 24);
// shape.strokeColor = sc & ~#000000 | (alpha << 24);
// }
// time += delta;
// }
//}
//final float BezierBlend(float t)
//{
// return sqrt(t) * (3.0f - 2.0f * t);
//}
//final float EaseInOutQuad(float t, int from, int change, float duration) {
// t /= duration/2;
// if (t < 1) return change/2*t*t + from;
// t--;
// return -change/2 * (t*(t-2) - 1) + from;
//}
}
static class UITweenSprite {
static HashMap<Integer, Ani[]> animsMap = new HashMap<Integer, Ani[]>();
static void tweenSprite(UISprite sprite, String propertyList, float duration, float delay, Object callbackObject, String callback) {
Ani[] ani = Ani.to(sprite, duration, delay, propertyList, Ani.CUBIC_OUT, callbackObject, callback);
animsMap.put(sprite.hashCode(), ani);
}
static void tweenSprite(UISprite sprite, String propertyList, float duration, float delay, de.looksgood.ani.easing.Easing easing, Object callbackObject, String callback) {
Ani[] ani = Ani.to(sprite, duration, delay, propertyList, easing, callbackObject, callback);
animsMap.put(sprite.hashCode(), ani);
}
}