-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimpletimeline.h
64 lines (56 loc) · 2 KB
/
simpletimeline.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef SIMPLETIMELINE_H
#define SIMPLETIMELINE_H
#include <QObject>
#include <QtQuick/QQuickPaintedItem>
#include <QPropertyAnimation>
#include <QParallelAnimationGroup>
#include <QSequentialAnimationGroup>
#include <vector>
#include "MyAnimationGroup.h"
class SimpleTimeline : public QObject
{
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(double recordstate READ getrecordstate WRITE setrecordstate NOTIFY recordstateChanged FINAL)
Q_PROPERTY(float xnum READ getxnum WRITE setxnum NOTIFY xnumChanged FINAL)
signals:
void begin();
public slots:
//串操作
void createAnimate(QString name);
void deleteAnimate(QString name);
//帧操作
void addFrame(QObject *target, const QByteArray &propertyName, QString name, const QVariant &value, int type, qreal time);
void deleteFrame(QString name, qreal time);
void updateFrame(QString name, const QVariant &value, int type,qreal oldtime, qreal newtime);
void addFrameButton(QObject *target, const QByteArray &propertyName, QString name, const QVariant &value, int type, qreal time);
QVariant preview(QString name, qreal time);
void start();
void stop();
public:
explicit SimpleTimeline(QObject *parent = nullptr);
~SimpleTimeline(); // 在析构函数中释放动态分配的内存
void setrecordstate(int state);
int getrecordstate();
float getxnum();
void setxnum(float x);
private slots:
void onAnimationFinished() {
// Optionally perform cleanup or take additional actions when all animations finish
// For example, you can emit a signal to notify the main application
emit animationFinished();
}
signals:
void animationFinished();
void recordstateChanged(int state);
void xnumChanged();
private:
QParallelAnimationGroup parGroup;
// std::map<QString, QSequentialAnimationGroup*> seqGroup;
std::vector<MyAnimationGroup> seqGroup;
std::vector<QPropertyAnimation*> animation;
int recordstate;
float xnum;
float ynum;
};
#endif // SIMPLETIMELINE_H