Loading...
Processing Forum
Recent Topics
All Forums
Move this topic
Forum :
Share your Work
Programming Questions
Core Library Questions
Contributed Library Questions
Android Processing
Processing with Other Languages
Integration and Hardware
Library and Tool Development
Events and Opportunities
General Discussion
Sub forum :
Move this topic
Cancel
Programming Questions
volcanooh..
what is wrong in my code? can you help me to check out?
in
Programming Questions
•
2 years ago
float x,addX;
void setup(){
size (400,400);
smooth();
}
void draw(){
background(255);
stroke(0);
strokeWeight(2);
addX = mouseX/3;
for ( x = addX;x < width;x *= 2){
line( x,height/20,x,height-(height/20));
}
println(x);
}
1
Replies(3)
quarks
Re: what is wrong in my code? can you help me to check out?
2 years ago
The problem is that when the program starts mouseX is initiialised to zero so addX is 0 so the loop counter x starts at 0 and will remain 0 since 2*x (2*0) is always zero so you have an infinite loop try changing the for loop to
for(x = addX + 1; x < width; x *= 2)
this will avoid the infinite loop
Leave a comment on quarks's reply
un_bsd
Re: what is wrong in my code? can you help me to check out?
2 years ago
There could be some problems where you are putting addX = mouseX/3; in your draw statement.
I would do:
void mouseMoved() {
addX = mouseX/3;
}
You might was to experiment and see what this does.
Leave a comment on un_bsd's reply
volcanooh..
Re: what is wrong in my code? can you help me to check out?
2 years ago
thank you quarks,you are right, and i use "+1" solved the problem. thank you .
and un_bsd, also thank you .
Leave a comment on volcanoohead's reply
Change topic type
Topic Type :
Discussions
Questions
No of days :
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
Change topic type
Cancel
Link this topic
Provide the permalink of a topic that is related to this topic
Permalink
Save
Close
Reply to volcanoohead's question
Top
Reply
{"z5277740":[25080000000727258],"z4105124":[25080000000728178],"z5718130":[25080000000726243,25080000000726256]}
Statistics
3
Replies
273
Views
0
Followers
Tags
No tags available for this topic.
Cancel
Actions
Permalink
Related Posts
Creating a simple, interactive shuf...
"Pixel Sorting"
Cannot Destroy Context while it is ...
Projecting a 2d (flat) image onto a...
How to make a ball bounce with grav...