Dynamic component light and switch

hi, I would like to ask for help to make a dynamic component, I managed to make the switch dynamic but I would like to make the effect that when I press the switch, the light disappears and reappears by pressing the switch again…
I saw this user who made the combination of dynamic components between the tap crank and the water that flows from the tap aGel [dinamic faucet](https://www.youtube.com/watch?v=tf6vN4C-Pus) ![rubinetto acqua|690x409](upload://quVCWJg6079ryjn4lYTsHFbSNMz.jpeg)

you can string instructions using semicolon

animate(“lever”,0,90); set(“color”,“red”,“green”)

1 Like

thank you so much, but now I have another problem I have to make the automatic shutter controlled by a single commutator switch, would you know how to help me i will thank you very much, thank yoy

basic shutter.skp (47.6 KB)

G’day folks. I’ve made a mixer tap & put some OnClick functions on it.
But…I’d like to make the right hand side handle/lever rotate on both the X & Y axis. Currently it only rotates on the Y axis, which turns on the cold or hot water, but to get hot or cold, it should also rotate forward (cold) & back (hot)(say spout faces forward) on the X axis as well.
The left side handle/lever supplies filtered water only (OnClick to turn on/off)…sorted.
The spout rotates if you OnClick it too.
Just can’t quite get the hot/cold rotation to work as it should. I mucked around trying a few things but alas, I just made a dog’s breakfast of it…lol. I’ve set up some components to use as parent components hoping I could use it to add some rotation on the X axis if it was already rotated on the Y axis (ie. IF statement or similar etc) but again, it got as messy, as messy as Lionel after the last world cup…lol.
Attachment file is SU 2022 because I forgot to backdate it to 2017, but let me know if you need it, no problemo.
If anyone feels like helping out, much appreciated.
MixerTap_OnClick_MultipleRotations_SS001.skp (555.9 KB)

adding a random rotation

MixerTap_OnClick_MultipleRotations_SS001.skp (550.5 KB)

0r if you want predicable, then a common attribute which feeds the plan movements, each action govern by a condition on the steps or timeline
animate (“steps”, 1,100)
if step<10 do this
if and(steps>=10,steps<20) do that …

Thanks pcmoor. The random is pretty good actually. Hadn’t thought about a random action. I was on the right track…then figured I could save myself some hair pulling by posting up here. Some things haven’t changed…good old pcmoor to the rescue…lol.
I’ll see if I can get it to work using the steps method, do some tidying up & keep you posted.
Cheers mate.

Well, I mucked around with trying a few things but failed…again. Just have to stick with random at this stage. Not a lot of help out there on this topic I must say. I’m close to getting it to work but the devil’s in the detail…& not sure where you find that detail in regards to dynamic components & SU. The thing is, it has to be exactly right or it won’t work, & trying to learn it by trial & error isn’t exactly the most efficient way of learning something. I find it’s much quicker to learn if someone who already knows how to do it shows you. Maybe I should put in a request on the SU YouTube channel…lol.

Well I persevered & I got the right handle to onClick rotate predictably…and the left handle rotates on the X axis…but…they do it at the same time. So…I need to implement some steps to separate the actions over time but can’t work out how exactly to implement this into my current Component Attributes.
Any suggestions much appreciated.