-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClockNumber.pde
91 lines (75 loc) · 1.67 KB
/
ClockNumber.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
class ClockNumber{
final int FrameLoopStart=12;
final int FrameLoopEnd=17;
final float fr_vel=.2;
final float fr_inter=5;
private int cur_num;
private float cur_frame;
private int dest_num;
private int dest_frame;
private int total_frame;
private int itype;
private int MLOOP=2*28;
private int minter_loop;
ClockNumber(int set_num,int set_total,int set_type){
total_frame=set_total;
itype=set_type;
Reset(set_num,0);
}
// void Reset(int set_num){
// cur_num=set_num;
// cur_frame=cur_num*fr_inter;
// dest_frame=(int)cur_frame;
// }
// void updateNum(int set_dest){
// if(set_dest==dest_num) return;
// println(cur_num+"->"+set_dest);
// dest_num=set_dest;
// dest_frame=set_dest*(int)fr_inter;
// }
// void update(){
// if(dest_frame!=floor(cur_frame)){
// cur_frame=(cur_frame+fr_vel)%total_frame;
// }else{
// cur_num=dest_num;
// }
// }
void Reset(int set_num,int set_frame){
cur_num=set_num;
dest_num=cur_num;
cur_frame=set_frame;
minter_loop=0;
}
void updateNum(){
minter_loop=MLOOP+1;
}
boolean updateNum(int set_dest){
if(set_dest==dest_num) return false;
println(cur_num+"->"+set_dest);
dest_num=set_dest;
// updateNum();
return true;
// dest_frame=set_dest*(int)fr_inter;
}
void update(){
cur_frame+=fr_vel;
if(ceil(cur_frame)==FrameLoopEnd+1){
if(minter_loop<MLOOP){
cur_frame=FrameLoopStart;
minter_loop++;
// println("LOOP= "+minter_loop);
}
}
if(cur_frame>total_frame){
cur_frame%=total_frame;
minter_loop=0;
if(dest_num!=cur_num) cur_num=dest_num;
}
}
int getCurNum(){
return cur_num;
}
int getCurFrame(){
return floor(cur_frame);
}
}