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 FlxTween.flicker #3086

Merged
merged 6 commits into from
Mar 15, 2024
Merged

add FlxTween.flicker #3086

merged 6 commits into from
Mar 15, 2024

Conversation

Geokureli
Copy link
Member

@Geokureli Geokureli commented Mar 15, 2024

FlxTween based flicker tool. FlxFlicker isn't being deprecated but I don't recommend using it unless someone has a good reason

additions and features:

  • Add flicker, isFlickering and stopFlickering instance methods to FlxTweenManager and static methods to FlxTween
  • Allows for custom ratio: rather than 50-50 split of on/off, can do 80-20 or whatever
  • Allows custom tweenFunction, meaning you can alter the parameters over time, and more

To do: add unit test

@Geokureli Geokureli added this to the 5.7.0 milestone Mar 15, 2024
* The default tween function of flicker tweens
* @param tween The tween handling the flickering
*/
public static function defaultTweenFunction(tween:FlickerTween)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the functions here have explicit returns types on the signature. What is the flixel guideline for return types in function signatures?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no rule on this, I kinda prefer not having it, in more cases, especially here where tweenFunction is well defined

*/
public static function defaultTweenFunction(tween:FlickerTween)
{
return (tween.time / tween.period) % 1 > tween.ratio;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was curious how you approached handling the ratio. This is pleasantly simple 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at first I had > 0.5 then i wondered what other values would look like

@Geokureli Geokureli merged commit 5ede2bd into HaxeFlixel:dev Mar 15, 2024
12 of 16 checks passed
@Geokureli Geokureli deleted the flicker-tween branch March 15, 2024 19:12
@Geokureli Geokureli mentioned this pull request Mar 18, 2024
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.

2 participants