-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsRings.pde
93 lines (76 loc) · 2.32 KB
/
sRings.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
/**
* Bounce.
*
* When the shape hits the edge of the window, it reverses its direction.
*/
int rad = 60; // Width of the shape
float xpos, ypos; // Starting position of shape
float FR = 30;
void setup()
{
//size(640*1.5,480*1.5);
//size(1280, 960);
size(960,720);
noStroke();
frameRate(FR);
ellipseMode(RADIUS);
// Set the starting position of the shape
xpos = width/2;
ypos = height/2;
}
void draw()
{
println("FrameCount= ",frameCount);
background(102);
strokeCap(SQUARE);
//fill(255);
// Draw the shape
//ellipse(xpos, ypos, rad, rad);
//stroke(255,0,0);
stroke(0);
strokeWeight(4);
translate(xpos,ypos);
//arc(0,0, 50, 50, 0, HALF_PI);
noFill();
int nArcs = 45;
float diameter = height/2;
float R= diameter* 0.8;
float radiusStep = diameter / nArcs;
float phase = HALF_PI*4;
for(int i = 0; i< nArcs+1 ; i++){
if(i == 0) stroke (0,0,255);
else stroke(0);
R = diameter - i*radiusStep;
float FC = frameCount;
float t4C = FR * 3; //time4Cycle (seconds)
float step = PI * ((FC%t4C) /t4C); ///This makes a [0..1..0]
float TT = sin(step); ///----^
//println("Step= ", step, "TT ", TT);
//float arc = HALF_PI*4 * (cos(step/nArcs*i)/2 + 0.5);
//println("arc["+i+"]= "+(cos(TWO_PI/nArcs*i)/2 + 0.5));
/////////////////////// ( )
//arc(0, 0, R, R, PI, PI + arc * 0.99);
float ark = HALF_PI*4* TT;
//println("ark["+i+"]= "+ark);
stroke(255/nArcs * i);
//arc(0, 0, R, R, PI, PI + ark);
noFill();
stroke(0);
stroke(220,10,220);
//noStroke();
//phaseTotal * WF
//FC =0;
arc(0, 0, R, R, PI, PI + 2*PI * map(sin(PI*4/(nArcs) * ((i+1+0)%nArcs)) ,-1.0, 1.0, 0.0, 1.0) );
//println("DD["+i+"]= "+ (sin(2*PI/(nArcs) * ((i+1+FC)%nArcs)) ));
//////-----------------------------
float GG2 = (cos(PI*2/(nArcs) * (i+map(((FC%t4C)/t4C),0.0,1.0,0.0,(float)nArcs))%nArcs) );
float x2 = map( GG2 , -1.0, 1.0, 0.0, 1.0);
stroke(250);
arc(0, 0, R, R, PI, PI + PI*2 * x2 );
float GG = (sin(PI*6/(nArcs) * (i+map(((FC%t4C)/t4C),0.0,1.0,0.0,(float)nArcs))%nArcs) );
float x = map( GG , -1.0, 1.0, 0.0, 1.0);
println("--"+i+"->"+ GG + " |"+ x);
stroke(0);
arc(0, 0, R, R, PI, PI + PI*2 * x );
}
}