effects/scale: Tune animation params

Use standard easing curves in animations. OutCubic for the intro
animation and the InCubic for the outro animation.

Hidden opacity options were removed because I don't think they are
needed anymore. I made the starting opacity 0.4 to make the animation
look closer to what it would have been with an ease-out curve without
realizing it.
This commit is contained in:
Vlad Zahorodnii 2021-12-10 16:47:04 +02:00
parent acea685b04
commit 1f798485b9
2 changed files with 9 additions and 21 deletions

View file

@ -30,13 +30,11 @@ class ScaleEffect {
}
loadConfig() {
const defaultDuration = 160;
const defaultDuration = 200;
const duration = effect.readConfig("Duration", defaultDuration) || defaultDuration;
this.duration = animationTime(duration);
this.inScale = effect.readConfig("InScale", 0.96);
this.inOpacity = effect.readConfig("InOpacity", 0.4);
this.outScale = effect.readConfig("OutScale", 0.96);
this.outOpacity = effect.readConfig("OutOpacity", 0.0);
this.inScale = effect.readConfig("InScale", 0.8);
this.outScale = effect.readConfig("OutScale", 0.8);
}
static isScaleWindow(window) {
@ -104,7 +102,7 @@ class ScaleEffect {
this.setupForcedRoles(window);
window.scaleInAnimation = animate({
window: window,
curve: QEasingCurve.InOutSine,
curve: QEasingCurve.OutCubic,
duration: this.duration,
animations: [
{
@ -113,7 +111,7 @@ class ScaleEffect {
},
{
type: Effect.Opacity,
from: this.inOpacity
from: 0
}
]
});
@ -139,7 +137,7 @@ class ScaleEffect {
this.setupForcedRoles(window);
window.scaleOutAnimation = animate({
window: window,
curve: QEasingCurve.InOutSine,
curve: QEasingCurve.InCubic,
duration: this.duration,
animations: [
{
@ -148,7 +146,7 @@ class ScaleEffect {
},
{
type: Effect.Opacity,
to: this.outOpacity
to: 0
}
]
});

View file

@ -9,20 +9,10 @@
<default>0</default>
</entry>
<entry name="InScale" type="Double">
<default>0.96</default>
</entry>
<entry name="InOpacity" type="Double">
<default>0.4</default>
<min>0.0</min>
<max>1.0</max>
<default>0.8</default>
</entry>
<entry name="OutScale" type="Double">
<default>0.96</default>
</entry>
<entry name="OutOpacity" type="Double">
<default>0.0</default>
<min>0.0</min>
<max>1.0</max>
<default>0.8</default>
</entry>
</group>
</kcfg>