Skip to content
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

Font size when animated, does not interpolate between set frames. #35836

Closed
RichardR01 opened this issue Feb 1, 2020 · 3 comments
Closed

Font size when animated, does not interpolate between set frames. #35836

RichardR01 opened this issue Feb 1, 2020 · 3 comments
Labels

Comments

@RichardR01
Copy link

RichardR01 commented Feb 1, 2020

Godot version:
3.2 stable
OS/device including version:
Windows 10 v1909
Issue description:
Font size when animated, does not interpolate between set frames.
Steps to reproduce:
Create new scene as user interface. add a child node of type label. Resize the label if you want.
Set the text to whatever. I used "Testing" for this example.
Set the custom font to a new dynamic font. Use any ttf font file for the font.
In the font settings, set the size to 1. Add a child node to the label as an animation player.
In the animation player, create a new animation, name it anything.
Click on the label on the tree and click on the key symbol next to the font size in font settings.
It will ask you if you want to create a new key for it. Select Yes.
Set the animation position to 1. Back at the label, set the custom font size to 80. Click the key symbol to create a new keyframe.
In the animation editor move the current verticle bar or type in the animation position to a value less than 1.
You will notice the value of the font size stays the same, at 1, except for the last frame which the font size then becomes 80.
See test project for proof.
Minimal reproduction project:
TestProject.zip

@RichardR01
Copy link
Author

RichardR01 commented Feb 1, 2020

Update: I found out why it was doing this. It seems the animation player set the update mode to discreet on default. Setting it to continuous fixed the problem. So, if anything needs to be fixed here, is to set the update mode to continuous on default.
One more thing. The only time I set my animation player to discreet was on another project from a previous version of Godot. Could it be that it carried over and became the default setting?

@Calinou
Copy link
Member

Calinou commented Feb 2, 2020

I wouldn't recommend animating a font size for two reasons:

  • The font size must be an integer, which means the animation will look choppy. We could allow floating-point font sizes (for greater control on hiDPI displays), but the effective rendered size would still be rounded to the nearest integer.
  • The font will have to be re-rendered every time its size changes, leading to stuttering during gameplay.

Instead, look into using an higher base font size, downscaling the Control that hosts it under normal conditions and change its scale as needed. Make sure its scale doesn't exceed 1 to avoid visible pixelation/blurriness. You'll also want to enable Filter and perhaps Mipmaps on the DynamicFont in this case.

@Calinou
Copy link
Member

Calinou commented Feb 2, 2020

I'll close this as this isn't a bug with animating the font size per #35836 (comment). Please open another issue about the AnimationPlayer update mode if you manage to reproduce it. Make sure to give precise reproduction steps if you do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants