/home/docs/checkouts/readthedocs.org/user_builds/mathvizanimator/checkouts/latest/libs/mva_gui/include/animations/real_property_animation.h Source File

MathVizAnimator: /home/docs/checkouts/readthedocs.org/user_builds/mathvizanimator/checkouts/latest/libs/mva_gui/include/animations/real_property_animation.h Source File
MathVizAnimator  0.0.1
real_property_animation.h
1 /* mathvizanimator
2  * Copyright (C) 2023 codingwithmagga
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef LIBS_MVA_GUI_INCLUDE_ANIMATIONS_REAL_PROPERTY_ANIMATION_H_
19 #define LIBS_MVA_GUI_INCLUDE_ANIMATIONS_REAL_PROPERTY_ANIMATION_H_
20 
21 #include <QList>
22 
23 #include "property_animation.h"
24 
26  Q_OBJECT
27 
28  Q_PROPERTY(QList<qreal> start_property_values READ startPropertyValues WRITE setStartPropertyValues NOTIFY
29  startPropertyValuesChanged)
30  Q_PROPERTY(QList<qreal> end_property_values READ endPropertyValues WRITE setEndPropertyValues NOTIFY
31  endPropertyValuesChanged)
32 
33  public:
34  explicit RealPropertyAnimation(const QStringList& properties, QObject* parent = Q_NULLPTR);
35  explicit RealPropertyAnimation(const QString& property, QObject* parent = Q_NULLPTR);
36 
37  void applyAnimation(AbstractItem* item, const qreal time) const override;
38 
39  QList<qreal> startPropertyValues() const;
40  void setStartPropertyValues(QList<qreal> new_start_property_values);
41 
42  QList<qreal> endPropertyValues() const;
43  void setEndPropertyValues(QList<qreal> new_end_property_values);
44 
45  signals:
46  void startPropertyValuesChanged();
47  void endPropertyValuesChanged();
48 
49  private:
50  qreal linearApprox(const qreal start_value, const qreal end_value, const qreal time) const;
51  bool qFuzzyListCompare(const QList<qreal>& first_list, const QList<qreal>& second_list);
52 
53  QList<qreal> m_start_property_values { 0.0 };
54  QList<qreal> m_end_property_values { 1.0 };
55 };
56 
57 #endif // LIBS_MVA_GUI_INCLUDE_ANIMATIONS_REAL_PROPERTY_ANIMATION_H_
An abstract class representing a visible item like a circle or a rectangle.
Definition: abstractitem.h:56
Definition: property_animation.h:23
Definition: real_property_animation.h:25