Tweeny  3.2.0
A Tweening library for modern C++
tweenpoint.h
1 /*
2  This file is part of the Tweeny library.
3 
4  Copyright (c) 2016-2021 Leonardo Guilherme Lucena de Freitas
5  Copyright (c) 2016 Guilherme R. Costa
6 
7  Permission is hereby granted, free of charge, to any person obtaining a copy of
8  this software and associated documentation files (the "Software"), to deal in
9  the Software without restriction, including without limitation the rights to
10  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11  the Software, and to permit persons to whom the Software is furnished to do so,
12  subject to the following conditions:
13 
14  The above copyright notice and this permission notice shall be included in all
15  copies or substantial portions of the Software.
16 
17  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24 
25 /*
26  * This file provides the declarations for a tween point utility class. A tweenpoint holds the tween values,
27  * easings and durations.
28  */
29 
30 
31 #ifndef TWEENY_TWEENPOINT_H
32 #define TWEENY_TWEENPOINT_H
33 
34 
35 #include <tuple>
36 #include <array>
37 
38 #include "tweentraits.h"
39 
40 namespace tweeny {
41  namespace detail {
42  /*
43  * The tweenpoint class aids in the management of a tweening point by the tween class.
44  * This class is private.
45  */
46  template<typename... Ts>
47  struct tweenpoint {
48  typedef detail::tweentraits<Ts...> traits;
49 
50  typename traits::valuesType values;
51  typename traits::durationsArrayType durations;
52  typename traits::easingCollection easings;
53  typename traits::callbackType onEnterCallbacks;
54  uint32_t stacked;
55 
56  /* Constructs a tweenpoint from a set of values, filling their durations and easings */
57  tweenpoint(Ts... vs);
58 
59  /* Set the duration for all the values in this point */
60  template<typename D> void during(D milis);
61 
62  /* Sets the duration for each value in this point */
63  template<typename... Ds> void during(Ds... vs);
64 
65  /* Sets the easing functions of each value */
66  template<typename... Fs> void via(Fs... fs);
67 
68  /* Sets the same easing function for all values */
69  template<typename F> void via(F f);
70 
71  /* Returns the highest value in duration array */
72  uint16_t duration() const;
73 
74  /* Returns the value of that specific value */
75  uint16_t duration(size_t i) const;
76  };
77  }
78 }
79 
80 #include "tweenpoint.tcc"
81 
82 #endif //TWEENY_TWEENPOINT_H
The tweeny namespace contains all symbols and names for the Tweeny library.
Definition: MANUAL.dox:1