J
jamiethehutt
I'm trying to make a percentage progress bar for an XMMS web interface,
I want to take the total track time and the elapsed time and then make
a length for the bar from the percentage completed.
something like:
totalbarsize = 180
timeelapsed = 10
totaltime = 30
percomplete = 0.0
barlength = 0.0
percomplete = timeelapsed / totaltime
barlength = totalbarsize*percomplete
puts barlength
Now that should give me a barlength of 60 pixels but it gives 0
instead. Anyone know what I'm doing wrong?
Thanks!
(I'll forget that I need barlength as an integer rather than a float
for now )
I want to take the total track time and the elapsed time and then make
a length for the bar from the percentage completed.
something like:
totalbarsize = 180
timeelapsed = 10
totaltime = 30
percomplete = 0.0
barlength = 0.0
percomplete = timeelapsed / totaltime
barlength = totalbarsize*percomplete
puts barlength
Now that should give me a barlength of 60 pixels but it gives 0
instead. Anyone know what I'm doing wrong?
Thanks!
(I'll forget that I need barlength as an integer rather than a float
for now )