I have a row of shapes which I have made, with a slider from the p5.gui library controlling the rotation speed of one of the shapes. I would like the “Fan” slider to be able to pick specific shapes so I can change the speed of all of them separately. Sorry if I have worded this badly I am just a beginner and am struggling quite heavily I’ve been looking around for something to help me and haven’t been successful
first step is to go back and try without GUI,
you need a array of speeds (ok) and a array of current angle ( not only ONE )
and a smarter draw function.
https://editor.p5js.org/kll/sketches/kaYULGIFA
now start again with GUI,
on a click/change event
must set/change the speed of the selected fan inside the speed array.
Awesome! Thanks for the help.
that is the problem with the libraries,
at the beginning ( using one of the examples )
all looks a lot easier as to try to code it…
but if you want something out of the ordinary ( like your 2 slider multiplex idea )
you have to dig deep, not understand the advanced examples or the documentation
and finally have to say
" i not know if that can be done with that library"
so possibly wasted lots of time, better play
https://p5js.org/reference/#/p5/createSlider
https://editor.p5js.org/p5/sketches/Dom:_Slider
anyhow the point is that your idea would require a EVENT thinking:
if ( Fan Number Slider Changed ) set Speed Slider to setpoint from speed array [ Fan ]
-
- ( and that i not found how to do with that lib )
if ( Speed Slider Changed ) read Speed Slider and write to speed array [ Fan ]
if you want try that idea again, start from
https://editor.p5js.org/kll/sketches/ingo688HL
i think i found a way
or use a selector for the fan instead slider?
https://editor.p5js.org/kll/sketches/n8b0Ej894
Wow! Thank you so much! That’s so cool I’ll spend some time looking through references and your code. I’m still rather new but really enjoy working out how things work and stuff. Thanks again.