Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
cyberpunk_text_effect.h
Go to the documentation of this file.
1#ifndef CYBERPUNK_TEXT_EFFECT_H
2#define CYBERPUNK_TEXT_EFFECT_H
3
4#include <QObject>
5#include <QTimer>
6
7class QLabel;
8
21class CyberpunkTextEffect final : public QObject {
22 Q_OBJECT
23
24public:
31 explicit CyberpunkTextEffect(QLabel *label, QWidget *parent = nullptr);
32
37 void StartAnimation();
38
39private slots:
46 void NextAnimationStep();
47
48private:
54 void AnimateScanning();
55
61 void AnimateTyping();
62
68 void AnimateGlitching();
69
71 QLabel *label_;
75 QTimer *timer_;
77 int phase_ = 0;
79 int char_index_ = 0;
82};
83
84#endif //CYBERPUNK_TEXT_EFFECT_H
void NextAnimationStep()
Slot called periodically by the timer to advance the animation. Executes the logic for the current an...
Definition cyberpunk_text_effect.cpp:85
void AnimateTyping()
Handles the "Typing" phase of the animation. Reveals the original text character by character,...
Definition cyberpunk_text_effect.cpp:45
CyberpunkTextEffect(QLabel *label, QWidget *parent=nullptr)
Constructs a CyberpunkTextEffect. Stores the target QLabel, hides it initially, and sets up the anima...
Definition cyberpunk_text_effect.cpp:7
void AnimateScanning()
Handles the "Scanning" phase of the animation. Displays a sweeping vertical bar "|" across the label'...
Definition cyberpunk_text_effect.cpp:23
void StartAnimation()
Starts the text reveal an animation sequence from the beginning. Resets the animation phase and chara...
Definition cyberpunk_text_effect.cpp:16
int char_index_
Index used during scanning and typing phases to track progress.
Definition cyberpunk_text_effect.h:79
int phase_
Current phase of the animation (0: Scan, 1: Type, 2: Glitch, 3: Done).
Definition cyberpunk_text_effect.h:77
QString original_text_
The original text content of the label.
Definition cyberpunk_text_effect.h:73
QTimer * timer_
Timer driving the animation steps.
Definition cyberpunk_text_effect.h:75
int glitch_count_
Counter used during the final glitching phase.
Definition cyberpunk_text_effect.h:81
QLabel * label_
Pointer to the QLabel widget being animated.
Definition cyberpunk_text_effect.h:71
void AnimateGlitching()
Handles the final "Glitching" phase of the animation. Briefly displays the full text with rapidly cha...
Definition cyberpunk_text_effect.cpp:64