32 #include <boost/bind.hpp>
50 static void local_swap(
double& a,
double& b )
57 #ifndef CLAW_TWEENER_DEFINE_BOOST_THROW_EXCEPTION
59 #ifndef WORKAROUND_BOOST_THROW_EXCEPTION
60 #define WORKAROUND_BOOST_THROW_EXCEPTION
62 #include "boost/throw_exception.hpp"
82 #endif // WORKAROUND_BOOST_THROW_EXCEPTION
83 #endif // ifdef CLAW_TWEENER_DEFINE_BOOST_THROW_EXCEPTION
107 : m_init(init), m_end(end), m_date(0), m_duration(duration),
108 m_callback(callback), m_easing(e)
123 : m_init(val), m_end(end), m_date(0), m_duration(duration), m_easing(e)
125 m_callback = boost::bind( &local_swap, boost::ref(val), _1 );
191 bool claw::tween::single_tweener::do_is_finished()
const
193 return m_date >= m_duration;
201 double claw::tween::single_tweener::do_update(
double dt )
203 const double t( std::min(m_duration - m_date, dt) );
204 const double result = dt - t;
207 const double coeff = m_easing( m_date / m_duration );
208 const double val = m_init + coeff * (m_end - m_init);