Select one of the symbols to view example projects that use it.
 
Outline
#include <gui/common/ZoomAnimationBox.hpp>
ZoomAnimationBox::ZoomAnimationBox()
ZoomAnimationBox::~ZoomAnimationBox()
ZoomAnimationBox::startZoomAnimation(int16_t, int16_t, uint16_t, touchgfx::EasingEquation, EasingEquation)
ZoomAnimationBox::handleTickEvent()
ZoomAnimationBox::setCurrentState(States)
Files
loading...
CodeScopeSTM32 Libraries and SamplesTouchGFXGui/gui/src/common/ZoomAnimationBox.cpp
 
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * This file is part of the TouchGFX 4.10.0 distribution. * * @attention * * Copyright (c) 2018 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ #include <gui/common/ZoomAnimationBox.hpp> ZoomAnimationBox::ZoomAnimationBox() : Box(), currentState(NO_ANIMATION), animationCounter(0), animationEndedAction(0) { }{ ... } ZoomAnimationBox::~ZoomAnimationBox() { }{ ... } void ZoomAnimationBox::startZoomAnimation(int16_t endWidth, int16_t endHeight, uint16_t duration, touchgfx::EasingEquation widthProgressionEquation /*= &touchgfx::EasingEquations::linearEaseNone*/, EasingEquation heightProgressionEquation /*= &touchgfx::EasingEquations::linearEaseNone*/) { touchgfx::Application::getInstance()->registerTimerWidget(this); zoomAnimationStartX = getX(); zoomAnimationStartY = getY(); zoomAnimationStartWidth = getWidth(); zoomAnimationStartHeight = getHeight(); zoomAnimationEndWidth = endWidth; zoomAnimationEndHeight = endHeight; animationDuration = duration; zoomAnimationWidthEquation = widthProgressionEquation; zoomAnimationHeightEquation = heightProgressionEquation; zoomAnimationDeltaX = (zoomAnimationStartWidth - zoomAnimationEndWidth) / 2; zoomAnimationDeltaY = (zoomAnimationStartHeight - zoomAnimationEndHeight) / 2; setCurrentState(ANIMATE_ZOOM); }{ ... } void ZoomAnimationBox::handleTickEvent() { if (currentState == ANIMATE_ZOOM) { if (animationCounter <= animationDuration) { int16_t deltaWidth = zoomAnimationWidthEquation(animationCounter, 0, zoomAnimationEndWidth - zoomAnimationStartWidth, animationDuration); int16_t deltaHeight = zoomAnimationHeightEquation(animationCounter, 0, zoomAnimationEndHeight - zoomAnimationStartHeight, animationDuration); invalidate(); int16_t newWidth = zoomAnimationStartWidth + deltaWidth; if (newWidth < 0) { newWidth = 0; }if (newWidth < 0) { ... } int16_t newHeight = zoomAnimationStartHeight + deltaHeight; if (newHeight < 0) { newHeight = 0; }if (newHeight < 0) { ... } setWidth(newWidth); setHeight(newHeight); moveTo(zoomAnimationStartX - (deltaWidth/2), zoomAnimationStartY - (deltaHeight/2)); invalidate(); animationCounter++; }if (animationCounter <= animationDuration) { ... } else { touchgfx::Application::getInstance()->unregisterTimerWidget(this); setCurrentState(NO_ANIMATION); if (animationEndedAction && animationEndedAction->isValid()) { animationEndedAction->execute(*this); }if (animationEndedAction && animationEndedAction->isValid()) { ... } }else { ... } }if (currentState == ANIMATE_ZOOM) { ... } }{ ... } void ZoomAnimationBox::setCurrentState(States state) { currentState = state; animationCounter = 0; }{ ... }