tnfe / FFCreator

A fast video processing library based on node.js (一个基于node.js的高速视频制作库)
http://tnfe.github.io/FFCreator/
MIT License
2.86k stars 407 forks source link

How do I get the display width of text #449

Open dladeira opened 1 month ago

dladeira commented 1 month ago

Hey, I'm creating a text component like this

const portText = new FFText({
    text: `Bedrock port: ${server.port}`,
    fontSize: 72,
    color: "#ffffff",
    duration: finalDuration - outroDuration,
});
portText.setFont(`./public/fonts/${body.font}`);
portText.addEffect("fadeIn", 0.01, finalDuration - outroDuration);
portText.addEffect("fadeOut", 0.01, finalDuration);
scene.addChild(portText);

And I'm trying to get it's display width by serverLogo.getWH()[0], although this is returning null. Is there a way I can know how wide it is going to be? Thanks in advance

drawcall commented 3 weeks ago

Oh, maybe there is no good way to get it