WavySlider - Sine wave slider

WavySlider
Sine wave slider

Customizable:

  • Left color (progress), Right color and Thumb.
  • Wave length and Height.
  • Speed.

GIF_20250108_031407_300


Functions

InitializeSlider

Initializes the slider within an Horizontal or Vertical Arrangement.


SetSliderRange

Sets the range (min, max) and increment step of the slider.

Increment values ​​can be integers or floats.

  • min: 0
    max: 100

Increments can be any int number, if it's 3, it will jump like this:
0, 3, 6, 9, 12 ...
Same with float values, if it's 0.4:
0, 0.4, 0.8, 1.2 ...


SetSliderColors

Sets the colors of the slider, only AI2 and RGB colors.


SetWaveProperties

Sets the amplitude (wave height) and wavelength of the progress, values ​​in integers.


SetWaveSpeed

Sets the speed of the wave, values ​​in integers.


GetSliderMinValue

Gets the minimum value.


GetSliderMaxValue

Gets the maximum value.


SetSliderThumbPosition

Sets the position of the thumb.


Events

SliderValueChanged

Fired when the slider value changes.


SliderStopTracking

Fired when the slider stops being tracked.


component_event (28)

SliderMaxValue

Fired when the slider reaches its maximum value.


Update

  • Fixed a bug with the value obtained from the thumb position when using decimals.
  • Added a function to get the value of the current thumb position.

GetThumbPosition

Get the current thumb position.


aia project:
WavySlider.aia (17.1 KB)

Extension:
Version 1.0.1 - Jan 8, 2025
joejsanz.joedevwavyslider.aix (13.3 KB)

Created with Fast. v2.2.0
fast-cli

minSdk: 21, maxSdk: 34, JDK: 11


Thanks.

5 Likes

As with the Slider component, are 100 values ​​distributed over the respective interval? If so, shouldn't it then be "float min: 0.0, max: 10" if increment = 0.1?

Not necessarily, if you put a range of 100, of course it will.

By putting 0.01, you increase the decimals, you can use any number.

This is what I have to calculate:

data.minValue = min;
data.maxValue = max;
data.increment = increment;
data.seekBar.setMax((int) ((max - min) / increment));

And in the value change event the formula is used:

double value = data.minValue + progress * data.increment;

1 Like

... but

1 Like

I've seen the error and it's not just in that number.
I've left the computer for now, but I'll fix it tomorrow when I have access.

What happens if we give min- 0, max- 10 and increment- 0.3?

It will increase from 0.3 to 0.6. 0.9... until reaching 9.9.
The same if you put the -, it will reach -9.9.

1 Like

Update