SmoothProgressBar¶
- SmoothProgressBar()¶
SMOOTHPROGRESSBAR Browser-driven smooth progress bar for MATLAB apps
- Usage:
pb = SmoothProgressBar(parent) % set N later via pb.N pb = SmoothProgressBar(parent, N) pb = SmoothProgressBar(parent, ‘N’, N) pb = SmoothProgressBar(parent, 10, ‘Color’, ‘#e53935’, ‘BarHeight’, 0.7)
- Inputs:
parent : graphics container - UI container (uigridlayout, uifigure, uipanel, …) – required N : double - total number of iterations / work units (optional, positive scalar)
- Name-Value Pairs:
‘N’ : double - total iterations (default: []) ‘Colormap’ : char - colormap for the fill gradient (default: ‘turbo’) ‘ShowTimeRemaining’ : logical - show time-remaining in label (default: false) ‘ShowPercentage’ : logical - show percentage in label (default: false) ‘TimerPeriod’ : double - CSS transition hint in seconds (default: 0.25) (plus all CSSUIProgressBar / CSSBase styling properties)
- Outputs:
pb : SmoothProgressBar handle
- Notes:
Extends CSSUIProgressBar with continuous-time animation. All frame work (progress interpolation, colormap lookup, label formatting, time-remaining estimation) runs inside the uihtml Chromium instance via requestAnimationFrame at native 60 fps. MATLAB only sends discrete lifecycle events — no MATLAB-side animation timer, no per-tick colormap allocation, no per-tick IPC round-trip.
During the first iteration (before timing data is available) the bar pulses via a requestAnimationFrame opacity animation running in the browser compositor, independent of MATLAB’s event loop.
Key methods: start(), updateIteration(k), complete(), reset().
- Example:
fig = uifigure(‘Position’,[100 100 600 80]); gl = uigridlayout(fig,[1 1]); pb = SmoothProgressBar(gl, 10); pb.ShowPercentage = true; pb.ShowTimeRemaining = true;
See also: CSSUIProgressBar, CSSBase, CSSProgressBarDemo
∿∿∿ Prerau Laboratory MATLAB Codebase · sleepEEG.org ∿∿∿
pb.start(); for k = 1:10
pause(2 + rand); pb.updateIteration(k);
end
DYNAM-O Toolbox | Prerau Laboratory¶