Jump to content
Search Community

Stop Box from Pulsing on Mousedown

bichant test
Moderator Tag

Recommended Posts

What I Want

When you 'click' the 'Mode' button #rect should pulse in and out (opacity). //This is working the way it is now.
When you 'mousedown' the 'Mode' button #rect should fade out (opacity) then hold its opacity on 'mouseup'.

What is Happening

Mousedown and #rect begins to fade, but on mousup it starts to pulse.

 

The fadeInOut/ fadeOutIn functions work well until I add the flashPlay function. Then I either can't get flashPlay to work or it does what it is doing now. Pulsing on mouseup.

See the Pen OJVVLOd?editors=0010 by bichant (@bichant) on CodePen

Link to comment
Share on other sites

8 hours ago, bichant said:

then hold its opacity on 'mouseup'.

So by "hold" you mean have an opacity of 0 (or whatever it faded to)? Please try and use numerical values as they're less abstract whenever possible.

 

Your entire demo is a bit confusing to me. What is the end goal with all of this? I feel like we're chasing red herrings whereas we could help you get a solution for your actual desires if you shared your goal with us.

Link to comment
Share on other sites

Thank you Zach.

 

What I am trying to do is simulate an RGB light controller. This controller changes the lights color and intensity through an ON- OFF-Momentary switch. The switch also lets you set a couple of different 'Modes'. One mode pulses the light in a single color the other rotates between all the different light colors fading one in and out before going to the next.

 

Everything is controlled through the switch. Push on the top of the switch and the lights come on. Push it again and the lights change color. This is the Color button in my example.

 

The bottom of the switch is a momentary switch. A momentary switch is like a doorbell. It causes something to happen when you hold it down.  If you hold down the bottom of the switch the lights dim. But if you click and release the bottom of the switch it activates the different modes. This is the Mode button in my example.

 

The trouble I am having, other than being new and not having a clue as to what I am doing, is to control 3 different events off of one button. From what I have read it can be done. Getting there is another thing.

 

Seriously, thank you guys for all of your help and patience!

Link to comment
Share on other sites

I don't need to go to extremes with this. I simply want to people to be able to try it before they buy it. There are more robust light controllers that I also want to do animations for down the road.

I really want to learn how to use GreenSock and javascript better. Carl's classes are excellent. I'm learning a lot. But I am still new to all this.

Link to comment
Share on other sites

I recommend creating a state machine diagram for your situation. That will help you figure out exactly what states you will need and be able to set up your code to work accordingly. Then give it a shot in code. Maybe even start with multiple buttons if that helps (once you have it all working you should be able to lower the amount of buttons using different listeners without too much trouble).

 

Once you've done that, if you're still having issues feel free to post back here and we can help out where you're having trouble. Sound good?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...