09-09-2020 07:09
09-09-2020 07:09
Hey, I tried to align a marquee text to the right if it is not scrolling.
<use id="progName" href="#marquee-text" font-size="32"
fill="fb-white" mode="1" value="50">
<set href="group/text" attributeName="text-buffer" to="" />
<set href="group/separator" attributeName="width" to="150" />
</use>
Could someone help me? 😄
09-13-2020 20:48 - edited 09-13-2020 20:50
09-13-2020 20:48 - edited 09-13-2020 20:50
You can add extra blank spaces in left and right and force marquee to scroll. See an example below.
Note: You don't even need to add JavaScript if you have static text, just add white spaces manually.
<!-- index.gui -->
<use id="progName" href="#marquee-text" font-size="32" fill="fb-white" mode="1" value="50">
<rect width="100%" height="100%" fill="black" opacity="0" />
<set href="group/text" attributeName="text-buffer"
to="............................................................." />
<set href="group/separator" attributeName="width" to="150" />
</use>
// index.js
let marquee = document.getElementById("progName");
let message = "Hello!";
let padding = Math.round((50 - message.length)/2);
marquee.text = " ".repeat(padding) + message + " ".repeat(padding);