ASPiK SDK
animations.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __animation__
6 #define __animation__
7 
8 #include "../vstguifwd.h"
9 #include "ianimationtarget.h"
10 #include "../crect.h"
11 
12 namespace VSTGUI {
13 namespace Animation {
14 
15 //-----------------------------------------------------------------------------
19 //-----------------------------------------------------------------------------
21 {
22 public:
23  AlphaValueAnimation (float endValue, bool forceEndValueOnFinish = false);
24 
25  void animationStart (CView* view, IdStringPtr name) override;
26  void animationTick (CView* view, IdStringPtr name, float pos) override;
27  void animationFinished (CView* view, IdStringPtr name, bool wasCanceled) override;
28 protected:
29  float startValue;
30  float endValue;
31  bool forceEndValueOnFinish;
32 };
33 
34 //-----------------------------------------------------------------------------
38 //-----------------------------------------------------------------------------
40 {
41 public:
42  ViewSizeAnimation (const CRect& newRect, bool forceEndValueOnFinish = false);
43 
44  void animationStart (CView* view, IdStringPtr name) override;
45  void animationTick (CView* view, IdStringPtr name, float pos) override;
46  void animationFinished (CView* view, IdStringPtr name, bool wasCanceled) override;
47 protected:
48  CRect startRect;
49  CRect newRect;
50  bool forceEndValueOnFinish;
51 };
52 
53 //-----------------------------------------------------------------------------
57 //-----------------------------------------------------------------------------
59 {
60 public:
61  enum AnimationStyle {
62  kAlphaValueFade = 0,
63  kPushInFromLeft,
64  kPushInFromRight,
65  kPushInFromTop,
66  kPushInFromBottom,
67  kPushInOutFromLeft,
68  kPushInOutFromRight
69  };
70 
72  ExchangeViewAnimation (CView* oldView, CView* newView, AnimationStyle style = kAlphaValueFade);
73  ~ExchangeViewAnimation () noexcept override;
74 
75  void animationStart (CView* view, IdStringPtr name) override;
76  void animationTick (CView* view, IdStringPtr name, float pos) override;
77  void animationFinished (CView* view, IdStringPtr name, bool wasCanceled) override;
78 protected:
79 
80  void init ();
81  void doAlphaFade (float pos);
82  void doPushInFromLeft (float pos);
83  void doPushInFromRight (float pos);
84  void doPushInFromTop (float pos);
85  void doPushInFromBottom (float pos);
86  void doPushInOutFromLeft (float pos);
87  void doPushInOutFromRight (float pos);
88 
89  void updateViewSize (CView* view, const CRect& rect);
90 
91  SharedPointer<CView> newView;
92  SharedPointer<CView> viewToRemove;
93  AnimationStyle style;
94  float newViewAlphaValueEnd;
95  float oldViewAlphaValueStart;
96  CRect destinationRect;
97 };
98 
99 //-----------------------------------------------------------------------------
103 //-----------------------------------------------------------------------------
105 {
106 public:
107  ControlValueAnimation (float endValue, bool forceEndValueOnFinish = false);
108 
109  void animationStart (CView* view, IdStringPtr name) override;
110  void animationTick (CView* view, IdStringPtr name, float pos) override;
111  void animationFinished (CView* view, IdStringPtr name, bool wasCanceled) override;
112 protected:
113  float startValue;
114  float endValue;
115  bool forceEndValueOnFinish;
116 };
117 
118 }} // namespaces
119 
120 #endif // __animation__
void animationTick(CView *view, IdStringPtr name, float pos) override
pos is a normalized value between zero and one
Definition: animations.cpp:272
void animationFinished(CView *view, IdStringPtr name, bool wasCanceled) override
animation ended
Definition: animations.cpp:44
void animationTick(CView *view, IdStringPtr name, float pos) override
pos is a normalized value between zero and one
Definition: animations.cpp:82
void animationStart(CView *view, IdStringPtr name) override
animation starts
Definition: animations.cpp:61
Rect structure.
Definition: crect.h:17
Definition: vstguibase.h:299
ExchangeViewAnimation(CView *oldView, CView *newView, AnimationStyle style=kAlphaValueFade)
Definition: animations.cpp:102
void animationStart(CView *view, IdStringPtr name) override
animation starts
Definition: animations.cpp:263
void animationFinished(CView *view, IdStringPtr name, bool wasCanceled) override
animation ended
Definition: animations.cpp:358
Definition: customcontrols.cpp:8
animates the view size of the view
Definition: animations.h:39
void animationTick(CView *view, IdStringPtr name, float pos) override
pos is a normalized value between zero and one
Definition: animations.cpp:37
animates the value of a CControl
Definition: animations.h:104
void animationStart(CView *view, IdStringPtr name) override
animation starts
Definition: animations.cpp:339
void animationStart(CView *view, IdStringPtr name) override
animation starts
Definition: animations.cpp:31
Definition: vstguibase.h:247
Base Class of all view objects.
Definition: cview.h:44
void animationFinished(CView *view, IdStringPtr name, bool wasCanceled) override
animation ended
Definition: animations.cpp:67
Animation target interface.
Definition: ianimationtarget.h:17
exchange a view by another view with an animation
Definition: animations.h:58
void animationTick(CView *view, IdStringPtr name, float pos) override
pos is a normalized value between zero and one
Definition: animations.cpp:347
void animationFinished(CView *view, IdStringPtr name, bool wasCanceled) override
animation ended
Definition: animations.cpp:315
animates the alpha value of the view
Definition: animations.h:20