Skip to content

Custom Unknown Progress Animations

shideneyu edited this page Dec 2, 2014 · 3 revisions

Following up on unknown progress, you may wish to update the unknown progress animation to suit your specific needs. This can be easily done by passing in the :unknown_progress_animation_steps option.

This item should be an array of strings that represent each step of the animation. The specific step used for a given progress is determined by the current progress of the bar. For example:

progressbar = ProgressBar.create(:total => nil, :unknown_progress_animation_steps => ['==>', '>==', '=>='])

Would use element 0 ('==>') for a progress of 1, 4, 7, 10, etc. It would use element 3 for a progress of 3, 6, 9, 12, etc.

You can have an array of as many elements as you'd like and they will be used in the same manner. For example if you have an array of 50 animation steps, element 0 would only be used for every 50th progress (eg: 1, 51, 101, etc).

Whatever element is chosen is repeated along the entire 'incomplete' portion of the bar.