30 #ifndef TWEENY_TWEEN_H
31 #define TWEENY_TWEEN_H
37 #include "tweentraits.h"
38 #include "tweenpoint.h"
47 template<
typename T,
typename... Ts>
57 static tween<T, Ts...>
from(T t, Ts... vs);
83 tween<T, Ts...> &
to(T t, Ts... vs);
109 template<
typename... Fs>
tween<T, Ts...> &
via(Fs... fs);
123 template<
typename... Fs>
tween<T, Ts...> &
via(
int index, Fs... fs);
142 template<
typename... Ds>
tween<T, Ts...> &
during(Ds... ds);
164 const typename detail::tweentraits<T, Ts...>::valuesType &
step(int32_t dt,
bool suppressCallbacks =
false);
176 const typename detail::tweentraits<T, Ts...>::valuesType &
step(uint32_t dt,
bool suppressCallbacks =
false);
197 const typename detail::tweentraits<T, Ts...>::valuesType &
step(
float dp,
bool suppressCallbacks =
false);
208 const typename detail::tweentraits<T, Ts...>::valuesType &
seek(
float p,
bool suppressCallbacks =
false);
220 const typename detail::tweentraits<T, Ts...>::valuesType &
seek(int32_t d,
bool suppressCallbacks =
false);
232 const typename detail::tweentraits<T, Ts...>::valuesType &
seek(uint32_t d,
bool suppressCallbacks =
false);
265 tween<T, Ts...> &
onStep(
typename detail::tweentraits<T, Ts...>::callbackType callback);
297 tween<T, Ts...> &
onStep(
typename detail::tweentraits<T, Ts...>::noValuesCallbackType callback);
329 tween<T, Ts...> &
onStep(
typename detail::tweentraits<T, Ts...>::noTweenCallbackType callback);
358 tween<T, Ts...> &
onSeek(
typename detail::tweentraits<T, Ts...>::callbackType callback);
387 tween<T, Ts...> &
onSeek(
typename detail::tweentraits<T, Ts...>::noTweenCallbackType callback);
416 tween<T, Ts...> &
onSeek(
typename detail::tweentraits<T, Ts...>::noValuesCallbackType callback);
432 const typename detail::tweentraits<T, Ts...>::valuesType &
peek()
const;
441 const typename detail::tweentraits<T, Ts...>::valuesType
peek(
float progress)
const;
451 const typename detail::tweentraits<T, Ts...>::valuesType
peek(uint32_t time)
const;
496 const typename detail::tweentraits<T, Ts...>::valuesType &
jump(int32_t
point,
bool suppressCallbacks =
false);
503 uint16_t
point()
const;
506 using traits = detail::tweentraits<T, Ts...>;
510 uint16_t currentPoint = 0;
511 float currentProgress = 0;
512 std::vector<detail::tweenpoint<T, Ts...>> points;
513 typename traits::valuesType current;
514 std::vector<typename traits::callbackType> onStepCallbacks;
515 std::vector<typename traits::callbackType> onSeekCallbacks;
516 int8_t currentDirection = 1;
520 tween(T t, Ts... vs);
521 template<
size_t I>
void interpolate(
float prog,
unsigned point,
typename traits::valuesType & values, detail::int2type<I>)
const;
522 void interpolate(
float prog,
unsigned point,
typename traits::valuesType & values, detail::int2type<0>)
const;
523 void render(
float p);
524 void dispatch(std::vector<typename traits::callbackType> & cbVector);
525 uint16_t pointAt(
float progress)
const;
547 template<
typename... Fs>
tween<T> &
via(
int index, Fs... fs);
549 const T &
step(int32_t dt,
bool suppressCallbacks =
false);
550 const T &
step(uint32_t dt,
bool suppressCallbacks =
false);
551 const T &
step(
float dp,
bool suppressCallbacks =
false);
552 const T &
seek(
float p,
bool suppressCallbacks =
false);
553 const T &
seek(int32_t d,
bool suppressCallbacks =
false);
554 const T &
seek(uint32_t d,
bool suppressCallbacks =
false);
555 tween<T> &
onStep(
typename detail::tweentraits<T>::callbackType callback);
556 tween<T> &
onStep(
typename detail::tweentraits<T>::noValuesCallbackType callback);
557 tween<T> &
onStep(
typename detail::tweentraits<T>::noTweenCallbackType callback);
558 tween<T> &
onSeek(
typename detail::tweentraits<T>::callbackType callback);
559 tween<T> &
onSeek(
typename detail::tweentraits<T>::noValuesCallbackType callback);
560 tween<T> &
onSeek(
typename detail::tweentraits<T>::noTweenCallbackType callback);
561 const T &
peek()
const;
563 T
peek(uint32_t time)
const;
569 const T &
jump(int32_t
point,
bool suppressCallbacks =
false);
570 uint16_t
point()
const;
573 using traits = detail::tweentraits<T>;
577 uint16_t currentPoint = 0;
578 float currentProgress = 0;
579 std::vector<detail::tweenpoint<T>> points;
581 std::vector<typename traits::callbackType> onStepCallbacks;
582 std::vector<typename traits::callbackType> onSeekCallbacks;
583 int8_t currentDirection = 1;
588 void interpolate(
float prog,
unsigned point, T & value)
const;
589 void render(
float p);
590 void dispatch(std::vector<typename traits::callbackType> & cbVector);
591 uint16_t pointAt(
float progress)
const;
596 #include "tweenone.tcc"
598 #endif //TWEENY_TWEEN_H