We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi I'm new to processing and was wandering if anybody could help me out with this.
**I need to make a slider that moves when the mouse is over it. When the mouse is no longer over them they remain in their last position. The slider does not need to report any information, it is purely for visual purpose **
Here's what i've so far.
void setup() { size(640,1136); }
void draw() {
background(230);
if (mouseY<(1136/6))
{ fill(202,45,36); noStroke(); rectMode(CORNERS); rect(mouseX,(1136/6),0,0); fill(100); }
textSize(20);
fill(255);
text("Keep the slider in last position! ", 320, 1136/12); textAlign(CENTER);
}
Thank you very much for any advice
Answers
Thanks for any help
When you put all the code for drawing the slider inside the if block checking for mouse over it, it will only exist when the mouse is over it... Also you will need a var to store the position, this var should be updated when mouse is over the slider. So move the drawing outside the if block and put there the updating of var.
something like this:
thank you so much, that makes perfect sense, a really good explanation.
Thanks again!!!!
My pleasure. Some side notes: soon you will see that using "hard numbers" are not a good choice, I mean, for instance, instead of
1136/6
you would rather use a var to store that value, and test against itint sliderY = 1136/6; if ( mouseY < sliderY){//blah;}
so if you need to change those numbers later it will be really easy. Also try to choose one:or
avoid using both in same code, as it gets harder to read.
_ vk, could you explain to me how to make a scrolling background? I have a question out there. But the answers I am getting kind of confused me. It's the one that asks about a scrolling background. Could you also do it with a 25 width by 50 height rectangle? Thanks :)
Thanks for the extra tips _VK
:)
@TechWiz777 I think my best advice for you is: learn how to learn and get help, or hire someone to make a software to you.
What is your point? Are you willing to learn code? If so, get all the advices you got from here put them together, understand them, and come back for more, with specific doubts when needed. Then you will be learning.
But if you just need the code done for you, offer money for the job and you might get someone to hire.
Since the confused cousin post, I don't feel that you are really trying to understand and learn from your's posts and it's answers.
To be more clear, an example. If you ask "how to make something" and someone tells you "look at this and that examples". Don't come back saying "is this going to help me" go there read the examples, try to understand them and come back with something like: " I cant get what
array[index%length]
means or "why is the code usingmousePressed()
and notmousePressed
". I'm sure people will be glad to help you then.:-c