Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
tamive
tamive's Profile
2
Posts
2
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Rotating array along horizontal line
[2 Replies]
22-May-2012 06:01 AM
Forum:
Programming Questions
code:
int data[] = {
199,
190,
180,
170,
160,
150,
140,
130,
120,
110,
100,
110,
120,
130,
140,
150,
160,
150,
140,
130,
120,
110,
100,
90,
80,
70,
60,
50,
40,
30,
20,
10,
05,
10,
20,
30,
40,
50,
60,
70,
80,
90,
100,
110,
120,
130,
140,
150,
160,
170,
180,
190,
200,
205,
210,
215,
220,
225,
230,
225,
220,
215,
210,
205,
200,
195,
190,
185,
180,
175,
170,
170,
170,
170,
170,
170,
170,
170,
170,
170,
170,
165,
160,
155,
150,
145,
140,
145,
150,
155,
160,
165,
170,
175,
180,
185,
190,
195,
200,
190,
180,
170,
160,
150,
160,
175,
175,
175,
175,
175,
175,
175,
175,
180,
185,
190,
185,
180,
175,
175,
175,
170,
165,
160,
155,
150,
155,
160,
165,
170,
175,
180,
185,
175,
165,
155,
145,
135,
125,
115,
105,
95,
85,
75,
65,
75,
85,
95,
105,
115,
125,
135,
145,
155,
165,
175,
185,
195,
200,
203,
206,
209,
212,
215,
218,
221,
224,
227,
230,
227,
224,
221,
218,
215,
212,
209,
206,
203,
200,
190,
180,
170,
170,
170,
170,
170,
170,
170,
170,
170,
170,
170,
170,
175,
180,
185,
190,
195,
200,
199,
198,
197,
196,
195,
194,
193,
192,
191,
190,
189,
188,
187,
186,
185,
184,
183,
182,
181,
180,
182,
184,
186,
188,
190,
192,
194,
196,
198,
200,
202,
204,
206,
208,
210,
212,
214,
216,
218,
219,
220,
222,
224,
226,
228,
230,
232,
234,
236,
238,
240,
242
};
void setup() {
size(500, 400);
smooth();
strokeWeight(1);
frameRate(25);
}
void draw() {
background(164, 200, 250);
stroke(1);
line(0, 200, 600, 200);
for ( int i = 0; i < data.length; i++) {
line(2*i, 200, 1.5*i, data[i]);
stroke( ((mouseX==2*i)&&(between(mouseY, 300, data[i])))?0:255, 255, 255 );
}
}
boolean between( int target, int bound1, int bound2 ) {
if ( target >= bound1 && target <= bound2 ) {
return( true );
}
if ( target <= bound1 && target >= bound2 ) {
return( true );
}
return( false );
}
Is it possible to get the array to rotate along the line(0, 200, 600, 200); ?
Rollover to change color - Beginner Help!
[4 Replies]
22-May-2012 01:25 AM
Forum:
Programming Questions
I'm very new to processing so I'm having problems with some basic things.
I have a set of various static lines that I want to make interactive.
Basically, when the mouse rolls over a line I want it to change a different color.
I have no idea how to go about figuring this out so I would really appreciate some help!
Thanks!
«Prev
Next »
Moderate user : tamive
Forum