slice()function to create a simple progress bar. The output of the progress bar is determined by the Percent number property.
●●●●●●●●●●as the input string. There are 10
●symbols. We start at index
0, and then define the ending index using the Percent property.
prop("Percent")by 10, since a percent value like 40% actually equates to
0.4. Since there are 10
●characters in our input string, we need an ending index between 0 and 10.
slice()does nearly the same thing with the string:
○○○○○○○○○○, which represents the “empty” part of the progress bar.
(1 - prop("Percent")) * 10in order to get the remaining percentage. E.G. if Percent is set to 40% (which would create an end index of
4), we want to set this ending index to