You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using method video.add_text and speed > 0 (and in particular when cycle=false) x is used only as initial value but then an internal x is used to scroll text from right to the left. But when the text goes out and we, for instance, want to change it (to show a different info text) then the internal x stays out of the screen and there is no way to bring it back to the right
The text was updated successfully, but these errors were encountered:
For this one, let's first discuss this here. I fear that if I add this the code will become clumsy and moreover, we will never be able to cover all possible cases of needs with video.add_text.
However, I have good news: you can achieve what you want in Liquidsoap, by programming your own advanced x parameter. The x function is called at every frame, you can then simply return the value of a reference, updated in a way which suits your needs. You can draw inspiration from the implementation of video.add_text itself: https://github.com/savonet/liquidsoap/blob/main/src/libs/video.liq#L301
Typically for a scrolling you would do something like:
Just to be sure (because I am little weak on ls scripting language). Do you mean ? :
fps = video.frame.rate()
r = ref(0)
speed = 100 # scrolling speed
def x()
r := !r + speed / fps
!r
end
Yes this solves all the possible cases together wtih #2621
The only little thing is that in this way (in particular when) cycling on the opposite way ( r := !r - speed / fps), it's not easy to detect when text goes out of the screen because you have to compute string.length(text) * pixel_by_char
Using method
video.add_text
and speed > 0 (and in particular whencycle=false
)x
is used only as initial value but then an internal x is used to scroll text from right to the left. But when the text goes out and we, for instance, want to change it (to show a different info text) then the internal x stays out of the screen and there is no way to bring it back to the rightThe text was updated successfully, but these errors were encountered: