Skip to content

Commit 820a51e

Browse files
authored
Document fade scrollbar speed units and examples (#4711)
1 parent d2a08b9 commit 820a51e

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

CodenameOne/src/com/codename1/ui/plaf/LookAndFeel.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,19 @@ public int getFadeScrollBarSpeed() {
14901490

14911491
/// #### Parameters
14921492
///
1493-
/// - `fadeScrollBarSpeed`: the fadeScrollBarSpeed to set
1493+
/// - `fadeScrollBarSpeed`: per-frame opacity decrement used for fading the scrollbar.
1494+
/// Larger values fade out faster.
1495+
///
1496+
/// #### Notes
1497+
///
1498+
/// - This value is **not milliseconds**.
1499+
/// - Approximate fade duration in milliseconds:
1500+
/// `durationMs ~= (255 / fadeScrollBarSpeed) * (1000 / Display.getInstance().getFrameRate())`
1501+
/// - At 60 FPS, common values are:
1502+
/// - `5` -> about `850ms`
1503+
/// - `3` -> about `1400ms`
1504+
/// - `2` -> about `2100ms`
1505+
/// - `1` -> about `4250ms`
14941506
public void setFadeScrollBarSpeed(int fadeScrollBarSpeed) {
14951507
this.fadeScrollBarSpeed = fadeScrollBarSpeed;
14961508
}

docs/developer-guide/Advanced-Theming.asciidoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ SoftKey, Touch, Bar, Title, Right, Native
238238
|fadeScrollBarBool
239239
|Boolean indicating if the scrollbar should fade when there is inactivity
240240

241+
|setFadeScrollBarSpeed(int) _(API)_
242+
|Sets the per-frame opacity decrement for scrollbar fading (not milliseconds). Approximate fade duration is `durationMs ~= (255 / speed) * (1000 / frameRate)`. At 60 FPS: speed `5` ~= `850ms`, `3` ~= `1400ms`, `2` ~= `2100ms`, `1` ~= `4250ms`
243+
241244
|fadeScrollEdgeBool
242245
|Places a fade effect at the edges of the screen to indicate that it's possible to scroll until we reach the edge (common on Android)
243246

0 commit comments

Comments
 (0)