Code: Select all
@VERSION 8,0
@DISPLAY { Title = "Test", Width=800, Height=600, Mode="Windowed" }
EnableLayers()
EscapeQuit(True)
Function p_HideShow(hLayer,sLayer)
Local hide = HideLayerFX(hLayer, { Async = True, type = #WATER1 })
Local show = ShowLayerFX(sLayer, { Async = True, type = #WATER1 })
Local num = GetAttribute(#ASYNCDRAW, hide, #ATTRNUMFRAMES)
For Local k = 1 To num
AsyncDrawFrame(hide,k)
AsyncDrawFrame(show,k)
Next
AsyncDrawFrame(hide,num)
AsyncDrawFrame(show,num)
FinishAsyncDraw(hide)
FinishAsyncDraw(show)
; should also not be necessary but does not help or harm either:
;SetLayerStyle(sLayer,{hidden=False})
EndFunction
;4 pictures taken from one of the Hollywood Examples
Local photo1$ = "Hollywood\Examples\Hollywood\AsyncFX\pics\01.jpg"
Local photo2$ = "Hollywood\Examples\Hollywood\AsyncFX\pics\02.jpg"
Local photo3$ = "Hollywood\Examples\Hollywood\AsyncFX\pics\03.jpg"
Local photo4$ = "Hollywood\Examples\Hollywood\AsyncFX\pics\04.jpg"
LoadBrush(1, photo1$ , { Transparency = #BLACK })
InsertLayer(1, #BRUSH, 1, #CENTER, #CENTER, True)
SetLayerName(1, "Photo1")
LoadBrush(2, photo2$ , { Transparency = #BLACK })
InsertLayer(2, #BRUSH, 2, #CENTER, #CENTER, True)
SetLayerName(2, "Photo2")
p_HideShow("Photo1","Photo2")
;should not be necessary but doesn't help or harm either:
;SwapLayers("Photo1","photo2")
FreeBrush(1)
LoadBrush(1, photo3$ , { Transparency = #BLACK })
SetLayerStyle("Photo1", { ID = 1, hidden=True, x=#CENTER, y=#CENTER })
; FIRST BUTTON CLICK should hide photo2$ and show photo3$
WaitLeftMouse
p_HideShow("Photo2","Photo1")
;SwapLayers("Photo1","photo2")
FreeBrush(2)
LoadBrush(2, photo4$ , { Transparency = #BLACK })
SetLayerStyle("Photo1", { ID = 2, hidden=True, x=#CENTER, y=#CENTER })
; SECOND BUTTON CLICK should hide photo3$ and show photo4$
WaitLeftMouse
p_HideShow("Photo1","Photo2")
;SwapLayers("Photo1","photo2")
Repeat
WaitEvent
Forever
1. after FIRST BUTTON CLICK, the window is black, i.e. no photo is shown.
2. after SECOND BUTTON CLICK, the window shortly shows the transition from photo3$ to photo4$ (I think -- its too fast to be sure) but in the end photo2$ is shown again.
I also tried with using for photo3$ and photo4$ the new BRUSH IDs 3 and 4 instead of re-using 1 and 2. This did not change anything.
Do I misunderstand `SetLayerStyle()` method on #BRUSH as said in the docu:
https://www.hollywood-mal.com/docs/html ... Style.html
To me, it reads that my code above should work as expected and show 4 photos one after another.#BRUSH, #BRUSHPART and #BGPICPART layers recognize the following elements:
ID
This table element can be used to assign a new brush/bgpic to the specified layer. The old brush/bgpic will then be replaced with the new one specified by ID. This is useful for example for a slideshow in which a layer shall display a new picture every n seconds.
I tested it currently with Hollywood 10 on Windows 11.
What's my mistake? Or is it a bug
Thanks,
nexus