this code is drawing level bar based on this variable and animated it with timer but i got problem i am trying to set Percentsvariable to a random numbers start from 0 to 100 percent is real variable that set the level like that

so i cannot set it to redraw the animated bar from 0 to 100 any idea how to tweak this ?

the goal is to set the bar from 0 - 50 - 100 and chanfe those number via timer to get the same result of this image but using numbers from 0 to 100 instead of using 0.025 to animated

As I can see you need to convert range of 0..100(integer) into 0..1 (float). So do conversion as:
Percents := Percents + PercInt/100;
where you can put PercInt to 50 (percent). Do you have problem to generate random numbers?

0

dolphin KingAuthor Commented:

i have sound component that have level measure property like following

procedure TFORM1.SoundLevel(Sender: TObject; Level: Integer);begin// this Level Value have maximum value that equals to 100//so i needed to make the percents equals to that value to allow the tree redraw the animated level bar with the same value of the sound level end;

currently by default the percent set randomly like so

global var Percents: Real;//initiate percentPercents := 0.2;if Percents > 1 then begin Percents := 0.5; end else begin Percents := Percents + 0.025; end;vstmca.Invalidate;

what i am trying to achieve to make percent equals to the sound level value the problem is that percent not completely set to actual integer that Percents is a decimal, not a percentage value, so 100% is 1.

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Percents := Percents + PercInt/100;

where you can put PercInt to 50 (percent). Do you have problem to generate random numbers?