Last active
July 27, 2017 00:14
-
-
Save benjaminbojko/72a24102400cc09c812024ad443f9740 to your computer and use it in GitHub Desktop.
Cinder Animation Operators
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "cinder/Tween.h" | |
//================================================== | |
// Anim<T> + T | |
// | |
template<typename T> | |
inline T operator + (const ci::Anim<T> & tween, const T & value) { | |
return tween.value() + value; | |
} | |
template<typename T> | |
inline T operator - (const ci::Anim<T> & tween, const T & value) { | |
return tween.value() - value; | |
} | |
template<typename T> | |
inline T operator * (const ci::Anim<T> & tween, const T & value) { | |
return tween.value() * value; | |
} | |
template<typename T> | |
inline T operator / (const ci::Anim<T> & tween, const T & value) { | |
return tween.value() / value; | |
} | |
template<typename T> | |
inline T operator - (const ci::Anim<T> & tween) { | |
return -tween.value(); | |
} | |
//================================================== | |
// T + Anim<T> | |
// | |
template<typename T> | |
inline T operator + (const T & value, const ci::Anim<T> & tween) { | |
return value + tween.value(); | |
} | |
template<typename T> | |
inline T operator - (const T & value, const ci::Anim<T> & tween) { | |
return value - tween.value(); | |
} | |
template<typename T> | |
inline T operator * (const T & value, const ci::Anim<T> & tween) { | |
return value * tween.value(); | |
} | |
template<typename T> | |
inline T operator / (const T & value, const ci::Anim<T> & tween) { | |
return value / tween.value(); | |
} | |
//================================================== | |
// U + Anim<T> | |
// | |
template<typename T, typename U> | |
inline T operator + (const U & value, const ci::Anim<T> & tween) { | |
return value + tween.value(); | |
} | |
template<typename T, typename U> | |
inline T operator - (const U & value, const ci::Anim<T> & tween) { | |
return value - tween.value(); | |
} | |
template<typename T, typename U> | |
inline T operator * (const U & value, const ci::Anim<T> & tween) { | |
return value * tween.value(); | |
} | |
template<typename T, typename U> | |
inline T operator / (const U & value, const ci::Anim<T> & tween) { | |
return value / tween.value(); | |
} | |
//================================================== | |
// Anim<T> + U | |
// | |
template<typename T, typename U> | |
inline T operator + (const ci::Anim<T> & tween, const U & value) { | |
return tween.value() + value; | |
} | |
template<typename T, typename U> | |
inline T operator - (const ci::Anim<T> & tween, const U & value) { | |
return tween.value() - value; | |
} | |
template<typename T, typename U> | |
inline T operator * (const ci::Anim<T> & tween, const U & value) { | |
return tween.value() * value; | |
} | |
template<typename T, typename U> | |
inline T operator / (const ci::Anim<T> & tween, const U & value) { | |
return tween.value() / value; | |
} | |
//================================================== | |
// Anim<T> + Anim<T> | |
// | |
template<typename T> | |
inline T operator + (const ci::Anim<T> & lhs, const ci::Anim<T> & rhs) { | |
return lhs.value() + rhs.value(); | |
} | |
template<typename T> | |
inline T operator - (const ci::Anim<T> & lhs, const ci::Anim<T> & rhs) { | |
return lhs.value() - rhs.value(); | |
} | |
template<typename T> | |
inline T operator * (const ci::Anim<T> & lhs, const ci::Anim<T> & rhs) { | |
return lhs.value() * rhs.value(); | |
} | |
template<typename T> | |
inline T operator / (const ci::Anim<T> & lhs, const ci::Anim<T> & rhs) { | |
return lhs.value() / rhs.value(); | |
} | |
//================================================== | |
// ==, != | |
// | |
template<typename T> | |
inline bool operator == (const ci::Anim<T> & tween, const T & value) { | |
return tween.value() == value; | |
} | |
template<typename T> | |
inline bool operator == (const T & value, const ci::Anim<T> & tween) { | |
return value == tween.value(); | |
} | |
template<typename T> | |
inline bool operator != (const ci::Anim<T> & tween, const T & value) { | |
return tween.value() != value; | |
} | |
template<typename T> | |
inline bool operator != (const T & value, const ci::Anim<T> & tween) { | |
return value != tween.value(); | |
} | |
//================================================== | |
// >, <, <=, >= | |
// | |
template<typename T> | |
inline bool operator > (const ci::Anim<T> & tween, const T & value) { | |
return tween.value() > value; | |
} | |
template<typename T> | |
inline bool operator > (const T & value, const ci::Anim<T> & tween) { | |
return value > tween.value(); | |
} | |
template<typename T> | |
inline bool operator < (const ci::Anim<T> & tween, const T & value) { | |
return tween.value() < value; | |
} | |
template<typename T> | |
inline bool operator < (const T & value, const ci::Anim<T> & tween) { | |
return value < tween.value(); | |
} | |
template<typename T> | |
inline bool operator >= (const ci::Anim<T> & tween, const T & value) { | |
return tween.value() >= value; | |
} | |
template<typename T> | |
inline bool operator >= (const T & value, const ci::Anim<T> & tween) { | |
return value >= tween.value(); | |
} | |
template<typename T> | |
inline bool operator <= (const ci::Anim<T> & tween, const T & value) { | |
return tween.value() <= value; | |
} | |
template<typename T> | |
inline bool operator <= (const T & value, const ci::Anim<T> & tween) { | |
return value <= tween.value(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment