-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataMain.pde
140 lines (98 loc) · 3.44 KB
/
DataMain.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
class DataMain
{
int NbLines =6;
int NbSteps = 30;
int NbStepsMultiplier = 1;
float StartAngle = 0;
float Rotation = 3; // first angle
float RotationTwitch = 0;
int RotationMultiplier = 1;
float Radius = 300; // firts circle radius
float RatioRadius = 0.9;
//float LineWeight = 1;
//float RatioWeight = 1;
boolean Mirror = false;
void LoadJson(JSONObject src)
{
if (src == null)
return;
NbLines = src.getInt("NbLines", NbLines);
NbSteps = src.getInt("NbSteps", NbSteps);
NbStepsMultiplier = src.getInt("NbStepsMultiplier", NbStepsMultiplier);
StartAngle = src.getFloat("StartAngle2", StartAngle);
Rotation = src.getFloat("Rotation", Rotation);
RotationMultiplier = src.getInt("RotationMultiplier", RotationMultiplier);
RotationTwitch = src.getFloat("RotationMultiplier", RotationTwitch);
Radius = src.getFloat("Radius", Radius);
RatioRadius = src.getFloat("RatioRadius", RatioRadius);
//LineWeight = json.getFloat("LineWeight", LineWeight);
//RatioWeight = json.getFloat("RatioWeight", RatioWeight);
Mirror = src.getBoolean("Mirror", Mirror);
}
JSONObject SaveJson()
{
JSONObject dest = new JSONObject();
dest.setInt("NbLines", NbLines);
dest.setInt("NbSteps", NbSteps);
dest.setInt("NbStepsMultiplier", NbStepsMultiplier);
dest.setFloat("StartAngle", StartAngle);
dest.setFloat("Rotation", Rotation);
dest.setInt("RotationMultiplier", RotationMultiplier);
dest.setFloat("RotationTwitch", RotationTwitch);
dest.setFloat("Radius", Radius);
dest.setFloat("RatioRadius", RatioRadius);
//json.setFloat("LineWeight", LineWeight);
//json.setFloat("RatioWeight", RatioWeight);
dest.setBoolean("Mirror", Mirror);
return dest;
}
}
class MainGUI extends UI_Panel
{
DataMain main;
Slider NbLines;
Slider NbSteps;
Slider NbStepsMultiplier;
Slider StartAngle;
Slider Rotation;
Slider RotationTwitch;
Slider RotationMultiplier;
Slider Radius;
Slider RatioRadius;
//Slider LineWeight;
//Slider RatioWeight;
Toggle Mirror;
void setGUIValues()
{
NbLines.setValue(main.NbLines);
NbSteps.setValue(main.NbSteps);
NbStepsMultiplier.setValue(main.NbStepsMultiplier);
StartAngle.setValue(main.StartAngle);
Rotation.setValue(main.Rotation);
RotationTwitch.setValue(main.RotationTwitch);
RotationMultiplier.setValue(main.RotationMultiplier);
Radius.setValue(main.Radius);
RatioRadius.setValue(main.RatioRadius);
}
void setupControls(ControlP5 cp5)
{
super.Init("Main", cp5);
main = data.main;
addLabel("Page");
NbLines = addSlider("NbLines", "Nb of Lines", main, 1, 36, true);
NbSteps = addSlider("NbSteps", "Nb Steps", main, 2, 100, false);
NbStepsMultiplier = addSlider("NbStepsMultiplier", "Nb Steps Multiplier", main, 1, 10, false);
StartAngle = addSlider("StartAngle", "Start Angle", main, 0, 360, false);
addLabel("Rotation");
Rotation = addSlider( "Rotation", "Rotation", main, 0, 180, false);
RotationTwitch = addSlider( "RotationTwitch", "Rotation Twitch", main, -3, 3, false);
RotationMultiplier = addSlider( "RotationMultiplier", "Rotation Multiplier", main, 1, 8, false);
addLabel("Size");
Radius = addSlider("Radius", "Radius", main, 0, 800, false);
RatioRadius = addSlider("RatioRadius", "Ratio Radius", main, 0.8, 1.2, false);
Mirror = addToggle( "Mirror", "Y Mirror", main);
}
void update()
{
}
}