mirror of
https://github.com/flame-engine/flame.git
synced 2025-10-28 23:46:52 +08:00
fix: Darkness increases with higher values (#3448)
Previously, .darken(.98) would darken the image by 98%, now it darkens by the inverse by 2%. This restores the original functionality.
This commit is contained in:
@ -26,7 +26,7 @@ void addImageStories(Dashbook dashbook) {
|
||||
'brightness',
|
||||
(context) => GameWidget(
|
||||
game: ImageBrightnessExample(
|
||||
brightness: context.numberProperty('brightness', 50),
|
||||
brightness: context.numberProperty('brightness', 80),
|
||||
),
|
||||
),
|
||||
codeLink: baseLink('image/brighten.dart'),
|
||||
@ -36,7 +36,7 @@ void addImageStories(Dashbook dashbook) {
|
||||
'darkness',
|
||||
(context) => GameWidget(
|
||||
game: ImageDarknessExample(
|
||||
darkness: context.numberProperty('darkness', 50),
|
||||
darkness: context.numberProperty('darkness', 80),
|
||||
),
|
||||
),
|
||||
codeLink: baseLink('image/darkness.dart'),
|
||||
|
||||
@ -17,7 +17,7 @@ extension ColorExtension on Color {
|
||||
final hsl = HSLColor.fromColor(this);
|
||||
return hsl
|
||||
.withLightness(
|
||||
clampDouble(hsl.lightness * amount, 0.0, 1.0),
|
||||
clampDouble(hsl.lightness * (1 - amount), 0.0, 1.0),
|
||||
)
|
||||
.toColor();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user