C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 20s
JS/TS / lint (pull_request) Successful in 22s
Python / static (pull_request) Successful in 57s
Rust / fmt (pull_request) Successful in 1m2s
C++ / build (pull_request) Successful in 2m10s
Rust / build (pull_request) Successful in 1m50s
Rust / clippy (pull_request) Successful in 1m25s
Python / verify (pull_request) Successful in 2m58s
C++ / clang-tidy (pull_request) Successful in 7m8s
48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
#include "anim.hpp"
|
|
#include "tokens.hpp"
|
|
#include <qpoint.h>
|
|
|
|
namespace ZShell::config {
|
|
|
|
QEasingCurve AnimEasing::buildCurve(const QList<qreal>& points) {
|
|
QEasingCurve curve(QEasingCurve::BezierSpline);
|
|
for (int i = 0; i + 5 < points.size(); i += 6) {
|
|
QPointF c1(points[i], points[i + 1]);
|
|
QPointF c2(points[i + 2], points[i + 3]);
|
|
QPointF end(points[i + 4], points[i + 5]);
|
|
curve.addCubicBezierSegment(c1, c2, end);
|
|
}
|
|
return curve;
|
|
}
|
|
|
|
void AnimEasing::bindCurves(AnimCurves* curves) {
|
|
m_curves = curves;
|
|
connect(
|
|
curves,
|
|
&AnimCurves::propertiesChanged,
|
|
this,
|
|
&AnimEasing::rebuildCurves);
|
|
rebuildCurves();
|
|
}
|
|
|
|
void AnimEasing::rebuildCurves() {
|
|
if (!m_curves) return;
|
|
m_emphasized = buildCurve(m_curves->emphasized());
|
|
m_emphasizedAccel = buildCurve(m_curves->emphasizedAccel());
|
|
m_emphasizedDecel = buildCurve(m_curves->emphasizedDecel());
|
|
m_standard = buildCurve(m_curves->standard());
|
|
m_standardAccel = buildCurve(m_curves->standardAccel());
|
|
m_standardDecel = buildCurve(m_curves->standardDecel());
|
|
m_expressiveFastSpatial = buildCurve(m_curves->expressiveFastSpatial());
|
|
m_expressiveDefaultSpatial =
|
|
buildCurve(m_curves->expressiveDefaultSpatial());
|
|
m_expressiveSlowSpatial = buildCurve(m_curves->expressiveSlowSpatial());
|
|
m_expressiveFastEffects = buildCurve(m_curves->expressiveFastEffects());
|
|
m_expressiveDefaultEffects =
|
|
buildCurve(m_curves->expressiveDefaultEffects());
|
|
m_expressiveSlowEffects = buildCurve(m_curves->expressiveSlowEffects());
|
|
emit curvesChanged();
|
|
}
|
|
|
|
} // namespace ZShell::config
|