|
|
Home » Developing U++ » U++ Developers corner » styling of widgets ( animation / look and feel)
Re: styling of widgets ( animation / look and feel) [message #59803 is a reply to message #59802] |
Thu, 20 April 2023 13:06   |
dodobar
Messages: 22 Registered: April 2023 Location: Germany
|
Promising Member |
|
|
Some Generic Curve processing
BaseAnimation& BaseAnimation::EasingCurve(EasingCurve curve) {
easing_curve_ = curve;
return *this;
}
//allow for a user style curve
BaseAnimation& BaseAnimation::CustomCurve(const Vector<Pointf>& curve_points) {
easing_curve_ = CUSTOM;
custom_curve_points_ = curve_points;
return *this;
}
double BaseAnimation::ApplyEasingCurve(double progress) {
switch (easing_curve_) {
case EASE_IN_QUAD:
return progress * progress;
case EASE_OUT_QUAD:
return progress * (2 - progress);
case EASE_IN_OUT_QUAD:
return progress < 0.5 ? 2 * progress * progress : -1 + (4 - 2 * progress) * progress;
case EASE_IN_CUBIC:
return progress * progress * progress;
case EASE_OUT_CUBIC:
return (--progress) * progress * progress + 1;
case EASE_IN_OUT_CUBIC:
return progress < 0.5 ? 4 * progress * progress * progress : (progress - 1) * (2 * progress - 2) * (2 * progress - 2) + 1;
case CUSTOM:
if (custom_curve_points_.IsEmpty()) {
return progress;
}
int index = 0;
while (index + 1 < custom_curve_points_.GetCount() && progress > custom_curve_points_[index + 1].x) {
++index;
}
if (index + 1 < custom_curve_points_.GetCount()) {
Pointf p1 = custom_curve_points_[index];
Pointf p2 = custom_curve_points_[index + 1];
double ratio = (progress - p1.x) / (p2.x - p1.x);
return p1.y + ratio * (p2.y - p1.y);
} else {
return custom_curve_points_.Top().y;
}
case LINEAR:
default:
return progress;
}
}
[Updated on: Thu, 20 April 2023 13:17] Report message to a moderator
|
|
|
 |
|
styling of widgets ( animation / look and feel)
By: dodobar on Sun, 16 April 2023 20:54
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: Novo on Mon, 17 April 2023 15:53
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: mirek on Tue, 18 April 2023 09:17
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: dodobar on Thu, 20 April 2023 00:37
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: mirek on Thu, 20 April 2023 08:58
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: dodobar on Thu, 20 April 2023 13:00
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: dodobar on Thu, 20 April 2023 13:06
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: mirek on Thu, 20 April 2023 14:22
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: dodobar on Thu, 20 April 2023 19:17
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: mirek on Thu, 20 April 2023 21:51
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: dodobar on Thu, 20 April 2023 22:36
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: dodobar on Thu, 20 April 2023 23:55
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: mirek on Fri, 21 April 2023 07:56
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: dodobar on Fri, 21 April 2023 11:40
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: mirek on Sat, 22 April 2023 14:44
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: dodobar on Sun, 23 April 2023 16:27
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: mirek on Mon, 24 April 2023 09:23
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: dodobar on Mon, 09 September 2024 09:10
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: mirek on Mon, 09 September 2024 10:03
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: dodobar on Sun, 22 September 2024 09:28
|
 |
|
Re: styling of widgets ( animation / look and feel)
By: mirek on Sun, 22 September 2024 09:38
|
Goto Forum:
Current Time: Mon Jul 14 15:00:26 CEST 2025
Total time taken to generate the page: 0.03843 seconds
|
|
|