-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Responsive font size #38
Comments
Hi, I just took the height of the window and thought about it
|
Unfortunately youre correct, because of how blotter is built you wont be able to make the font sizes responsive as attempted in either of the above examples. When a Blotter instance is initialized for a material and a text (or array of texts), the texts are drawn into a single "back buffer" image which is then collectively rendered on all draw calls. For example, if you gave a Blotter instance a material and 50 texts, all 50 texts would be rendered at once every frame, rather that 50 renders per frame. This has a performative advantage, but also means that Blotter has taken the opinion that continuously re-accounting for text size (as declared in the text's properties object at instantiation time) is disadvantageous. There is however a possible solution for you all: set the
Keep in mind that this is costly performance wise and you are advised not to do this on every window resize event. Rather, my advice would be to do this after specific window size breakpoints. This may not fit your specific needs. If you really need your blotter texts to resize smoothly, scaling along with some other element, another approach may be to simply hook into the Hope this helps. |
Hi @bradley ! Would you be able to elaborate a bit more on how the Current code in my script: `var text = new Blotter.Text("Brianna Hawkins", { text.needsUpdate = true; var material = new Blotter.LiquidDistortMaterial(); material.uniforms.uSpeed.value = .2; material.uniforms.uVolatility.value = .05; material.uniforms.uSeed.value = 1; var blotter = new Blotter(material, { var elem = document.getElementById("one"); scope.appendTo(elem); document.onmousemove = function distort(){ |
Well here's how i handle mine I calculating a new font and padding size based off the windows width on resize
|
I found a very easy solution for this if anyone interested.
|
Hey,
I am trying to make my blotter.js text responsive, using something like the below CSS,
that ordinarily works:
Because the
size
is declared in Javascript (currently set to 94), I haven't been able to apply the above.I'm hoping for something like this:
Please can you advise?
Thank you!
The text was updated successfully, but these errors were encountered: