Volume Knob
sawkastee
Member Posts: 184
I made a volume knob using the following rules:
3 self attributes (integer) startRotation, startAngle, newAngle.
Rule when touch is pressed:
-change attribute startRotation to self.rotation
-change attribute startAngle to vectorToAngle(mouse.position.x-self.position.x,mouse.position.y-self.position.y)
-constrain attribute newAngle to vectorToAngle(mouse.position.x-self.position.x,mouse.position.y-self.position.y)
-constrain attribute selfRotation to startRotation+(newAngle-startAngle)
I would like to limit the volume knob to a min & max rotation. As right now it can spin all the way around. How could I limit the min & max rotation of the volume knob?
3 self attributes (integer) startRotation, startAngle, newAngle.
Rule when touch is pressed:
-change attribute startRotation to self.rotation
-change attribute startAngle to vectorToAngle(mouse.position.x-self.position.x,mouse.position.y-self.position.y)
-constrain attribute newAngle to vectorToAngle(mouse.position.x-self.position.x,mouse.position.y-self.position.y)
-constrain attribute selfRotation to startRotation+(newAngle-startAngle)
I would like to limit the volume knob to a min & max rotation. As right now it can spin all the way around. How could I limit the min & max rotation of the volume knob?
Comments
Hope it helps!
Called: "Using min and max in one Constrain?"