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

Add set_custom_interpolator() to PropertyTweener #82306

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Sep 25, 2023

Closes godotengine/godot-proposals#7807
Probably solves godotengine/godot-proposals#1251

godot.windows.editor.dev.x86_64_VsCyflxhek.mp4

(see the example in the docs)

@KoBeWi KoBeWi added this to the 4.x milestone Sep 25, 2023
@KoBeWi KoBeWi requested review from a team as code owners September 25, 2023 13:59
@KoBeWi KoBeWi force-pushed the tween_literally_anything branch 2 times, most recently from 79d0d5c to dcc7b33 Compare September 25, 2023 16:18
@WagnerGFX
Copy link

Would it not be better to call the method set_custom_trans()?
For the everyday user with no knowledge of the engine's inner works, this method will just be the same as a set_trans(), but injecting a custom transition calculation.

I would also suggest a few changes to the description to avoid confusing the user with the terms "easing" and "transition".

  • "Allows interpolating the value with a custom transitioning function..."
  • "...subject to the tweener's easing."

I also suggest adding a warning inside set_trans() for when a custom method has already been set, to warn the user that doing such a thing is unnecessary, and they should choose only one of the methods.

One final suggestion is to rename the callable custom_method to custom_trans_method for extra code clarity.

@KoBeWi
Copy link
Member Author

KoBeWi commented Oct 10, 2023

Would it not be better to call the method set_custom_trans()?

Not sure. set_custom_method() and set_trans() can be used independently and they work together correctly. The v passed to the callback can be itself interpolated. It's probably not very useful and the results are difficult to control, but it's possible.

@WagnerGFX
Copy link

set_custom_method() and set_trans() can be used independently and they work together correctly. The v passed to the callback can be itself interpolated.

I see... I didn't notice that part as I was following the proposal text that said they would cancel each other out.
In this case, the method could currently be considered a third interpolation type that mix with transition and ease.

How about set_interpolator() or set_custom_interpolator()?
And changing the inner callable variable to interpolator_method?

Interpolator is generic, but more descriptive and also doesn't collide with transition or ease.

@KoBeWi
Copy link
Member Author

KoBeWi commented Oct 12, 2023

Renamed.

@KoBeWi KoBeWi changed the title Add set_custom_method() to PropertyTweener Add set_custom_interpolator() to PropertyTweener Oct 12, 2023
@akien-mga akien-mga modified the milestones: 4.x, 4.3 Feb 16, 2024
@akien-mga akien-mga merged commit e45cc17 into godotengine:master Feb 16, 2024
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@KoBeWi KoBeWi deleted the tween_literally_anything branch February 16, 2024 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make it easier to tween properties with custom easings
5 participants