Overview
BrightTransitionEffectLib transitions between images by increasing brightness to white, then revealing the target as brightness decreases — wrapping the FireMonkey TBrightTransitionEffect component. Creates a dramatic "camera flash" or "white-out" effect.
| Property | Details |
|---|---|
| Library | BrightTransitionEffectLib |
| Prefix | brighttrans_ |
| Wraps | TBrightTransitionEffect |
| Functions | 13 |
| Type | Transition effect |
| Category | Count | Description |
|---|---|---|
| Creation / Destruction | 2 | Create and free effect |
| Target Image | 3 | Set/get/load target bitmap |
| Progress | 2 | Get/set transition progress |
| Effect Control | 2 | Enabled get/set |
| Error Handling | 4 | Error codes and messages |
⚡ Flash Effect: At progress 0.5 the image is fully white — the "flash point." The source fades to white in the first half, then the target emerges from white in the second half. Faster animation = snappy flash, slower = gradual fade-through-white.
Cross-Platform Support
| Platform | Support |
|---|---|
| Windows | ✅ Full support |
| Linux | ✅ Full support |
| Android | ✅ Full support |
Creation & Destruction
brighttrans#(parent#)
Creates a new bright transition effect attached to the specified visual control.
| Parameter | Type | Description |
|---|---|---|
parent# | Pointer | Target visual control |
| Returns | Pointer | Effect handle, or 0 on failure |
brighttrans_free(effect#)
Destroys the effect and releases associated resources.
Error Handling
| Function | Signature | Description |
|---|---|---|
brighttrans_error() | brighttrans_error@ | Returns last error code (0 = none) |
brighttrans_errormsg$() | brighttrans_errormsg$@ | Returns last error message |
brighttrans_strerror$(code) | brighttrans_strerror$@n | Converts error code to text |
brighttrans_clearerror() | brighttrans_clearerror@ | Clears the error state |
Target Image
| Function | Signature | Description |
|---|---|---|
brighttrans_target#(effect#, bitmap#) | brighttrans_target#@## | Sets target from bitmap pointer |
brighttrans_target#(effect#) | brighttrans_target#@# | Gets target bitmap pointer |
brighttrans_loadtarget#(effect#, url$) | brighttrans_loadtarget#@#$ | Loads target from URL or file |
⚠ Target Required: Always load a target image before animating progress.
Progress
| Function | Signature | Description |
|---|---|---|
brighttrans_progress#(effect#, value) | brighttrans_progress#@#n | Set progress (0.0–1.0) |
brighttrans_progress(effect#) | brighttrans_progress@# | Get current progress |
| Progress | Visual |
|---|---|
0.0 | Source image, normal brightness |
0.25 | Source fading to white |
0.5 | Fully white — flash point |
0.75 | Target emerging from white |
1.0 | Target image, normal brightness |
Effect Control
| Function | Signature | Description |
|---|---|---|
brighttrans_enabled#(effect#, value) | brighttrans_enabled#@#n | Enable (1) or disable (0) |
brighttrans_enabled(effect#) | brighttrans_enabled@# | Gets enabled state |
Complete Examples
Example 1: Flash Transition Animation
let frm# = Pointer#(0) let img# = Pointer#(0) let trans# = Pointer#(0) let tmr# = Pointer#(0) let btn# = Pointer#(0) let progress = 0 frm# = form#("Flash Transition", 400, 350) img# = image#(frm#) image_bounds#(img#, 100, 30, 200, 150) image_load#(img#, "https://picsum.photos/200/150?random=1") trans# = brighttrans#(img#) brighttrans_loadtarget#(trans#, "https://picsum.photos/200/150?random=2") tmr# = timer#() timer_interval#(tmr#, 25) timer_enabled#(tmr#, 0) timer_ontimer#(tmr#, "Animate") btn# = button#(frm#, "Flash!") button_bounds#(btn#, 150, 210, 100, 30) button_onclick#(btn#, "StartFlash") form_show(frm#) function StartFlash(sender#) progress = 0 timer_enabled#(tmr#, 1) button_enabled#(btn#, 0) endfunction function Animate(sender#) progress = progress + 0.03 brighttrans_progress#(trans#, progress) if progress >= 1 then timer_enabled#(tmr#, 0) button_enabled#(btn#, 1) endif endfunction
Example 2: Bi-directional Loop
let frm# = Pointer#(0) let img# = Pointer#(0) let trans# = Pointer#(0) let tmr# = Pointer#(0) let btn# = Pointer#(0) let progress = 0 let direction = 1 frm# = form#("Bright Loop", 400, 350) img# = image#(frm#) image_bounds#(img#, 100, 30, 200, 150) image_load#(img#, "https://picsum.photos/200/150?random=1") trans# = brighttrans#(img#) brighttrans_loadtarget#(trans#, "https://picsum.photos/200/150?random=2") tmr# = timer#() timer_interval#(tmr#, 30) timer_enabled#(tmr#, 0) timer_ontimer#(tmr#, "Animate") btn# = button#(frm#, "Start Loop") button_bounds#(btn#, 140, 210, 120, 30) button_onclick#(btn#, "StartLoop") form_show(frm#) function StartLoop(sender#) timer_enabled#(tmr#, 1) button_enabled#(btn#, 0) endfunction function Animate(sender#) progress = progress + (direction * 0.02) brighttrans_progress#(trans#, progress) if progress >= 1 then direction = -1 endif if progress <= 0 then direction = 1 timer_enabled#(tmr#, 0) button_enabled#(btn#, 1) endif endfunction
Quick Reference
| Function | Signature | Description |
|---|---|---|
| CREATION & DESTRUCTION | ||
brighttrans#(parent#) | brighttrans#@# | Create effect |
brighttrans_free(effect#) | brighttrans_free@# | Destroy effect |
| TARGET IMAGE | ||
brighttrans_target#(effect#, bitmap#) | brighttrans_target#@## | Set target bitmap |
brighttrans_target#(effect#) | brighttrans_target#@# | Get target bitmap |
brighttrans_loadtarget#(effect#, url$) | brighttrans_loadtarget#@#$ | Load target |
| PROGRESS | ||
brighttrans_progress#(effect#, value) | brighttrans_progress#@#n | Set progress (0–1) |
brighttrans_progress(effect#) | brighttrans_progress@# | Get progress |
| EFFECT CONTROL | ||
brighttrans_enabled#(effect#, value) | brighttrans_enabled#@#n | Enable/disable |
brighttrans_enabled(effect#) | brighttrans_enabled@# | Get enabled state |
| ERROR HANDLING | ||
brighttrans_error() | brighttrans_error@ | Last error code |
brighttrans_errormsg$() | brighttrans_errormsg$@ | Last error message |
brighttrans_strerror$(code) | brighttrans_strerror$@n | Code to text |
brighttrans_clearerror() | brighttrans_clearerror@ | Clear error state |
See Also
| Library | Description |
|---|---|
FadeTransitionEffectLib | Fade to black transition |
BlurTransitionEffectLib | Blur-based transition |
DissolveTransitionEffectLib | Dissolve transition |
