# Is it possible to have an infinite rotary slider?

**URL:** <https://forum.juce.com/t/is-it-possible-to-have-an-infinite-rotary-slider/39910>\
**Category:** General JUCE discussion\
**Created:** [June 6, 2020, 4:51pm UTC](https://forum.juce.com/t/is-it-possible-to-have-an-infinite-rotary-slider/39910 "2020-06-06T16:51:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![psyzza](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@psyzza](https://forum.juce.com/u/psyzza)\
**Post date:** [June 6, 2020, 4:51pm UTC](https://forum.juce.com/t/is-it-possible-to-have-an-infinite-rotary-slider/39910/1 "2020-06-06T16:51:51Z")

</div>

I was wondering if it’s possible to have a rotary slider that can increase to infinity but doesn’t go below zero. (If you keep increasing the value it’ll keep looping while the value increases.)

---

<div class="post-metadata">

**Author:** ![splintersilk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/splintersilk/32/14724_2.png) [@splintersilk](https://forum.juce.com/u/splintersilk)\
**Post date:** [October 20, 2021, 5:58am UTC](https://forum.juce.com/t/is-it-possible-to-have-an-infinite-rotary-slider/39910/2 "2021-10-20T05:58:27Z")

</div>

Did you ever get an answer to this @psyzza ?

---

<div class="post-metadata">

**Author:** ![psyzza](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@psyzza](https://forum.juce.com/u/psyzza)\
**Post date:** [October 28, 2021, 9:41pm UTC](https://forum.juce.com/t/is-it-possible-to-have-an-infinite-rotary-slider/39910/3 "2021-10-28T21:41:17Z")

</div>

Nope, not sure if it’s possible.

---

<div class="post-metadata">

**Author:** ![jakemumu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jakemumu/32/13038_2.png) [@jakemumu](https://forum.juce.com/u/jakemumu)\
**Post date:** [October 28, 2021, 11:25pm UTC](https://forum.juce.com/t/is-it-possible-to-have-an-infinite-rotary-slider/39910/4 "2021-10-28T23:25:17Z")

</div>

if you don’t want the value to wrap you’d just make the range very large and rotate at an interval to give the appearance of “infinite” no?

the range is 0 - 1000, the rotation is circular and rotates back around when hitting intervals of 1

unfortunately, infinite doesn’t work in computers, so you just give it the appearance

---

<div class="post-metadata">

**Author:** ![Marcusonic](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@Marcusonic](https://forum.juce.com/u/Marcusonic)\
**Post date:** [October 29, 2021, 10:52pm UTC](https://forum.juce.com/t/is-it-possible-to-have-an-infinite-rotary-slider/39910/5 "2021-10-29T22:52:38Z")

</div>

forcing the rotary to return to the minimum when it reaches the maximum (and vice versa) and keep a lap counter positive o negative. Also modify the control so that the start and end angle are 180º to produce the illusion of continuity.

So multiplying the lap counter by the range and adding the actual value of the rotary, the “infinite” position is obtained.

---

<div class="post-metadata">

**Author:** ![splintersilk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/splintersilk/32/14724_2.png) [@splintersilk](https://forum.juce.com/u/splintersilk)\
**Post date:** [October 30, 2021, 10:29pm UTC](https://forum.juce.com/t/is-it-possible-to-have-an-infinite-rotary-slider/39910/6 "2021-10-30T22:29:04Z")

</div>

Thanks for the interesting suggestions, @Marcusonic and @jakemumu

---

<div class="post-metadata">

**Author:** ![Marcusonic](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@Marcusonic](https://forum.juce.com/u/Marcusonic)\
**Post date:** [November 10, 2021, 10:57am UTC](https://forum.juce.com/t/is-it-possible-to-have-an-infinite-rotary-slider/39910/7 "2021-11-10T10:57:25Z")

</div>

I have seen that there is a function for set the rotary without limit, setting the value of stopToEnd to false

setRotaryParameters(0, juce::MathConstants::twoPi, false);

I think that if the Slider class implemented a counter and storing the previous value/counter, juce would have an infinite rotary. The programmer would only have to add a function that receives the increase or decrease in each call.

---

<div class="post-metadata">

**Author:** ![deorst](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/deorst/32/19377_2.png) [@deorst](https://forum.juce.com/u/deorst)\
**Post date:** [September 9, 2024, 11:44am UTC](https://forum.juce.com/t/is-it-possible-to-have-an-infinite-rotary-slider/39910/8 "2024-09-09T11:44:31Z")

</div>

I have managed to build on top of `juce::Slider` component.  
No change in the JUCE source code needed.

The range here is 40…400 but it’s customizable - can be anything.  
 ![ScreenRecording2024-09-09at1.51.36PM-ezgif.com-optimize](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/9/c/9ca4828df258fc295a6a02057ec5d82f8698d404.gif)

If anyone needs it please feel free to clone and use in your projects:

> **[GitHub - deorst/InfiniteRotarySlider: InfiniteRotarySlider UI component for usage in...](https://github.com/deorst/InfiniteRotarySlider)**
>
> InfiniteRotarySlider UI component for usage in JUCE framework

Any feedback is welcome
