コード例 #1
0
		void inertionalMoveFunction(const IntCoord& _startRect, const IntCoord& _destRect, IntCoord& _result, float _current_time)
		{
#ifndef M_PI
			const float M_PI = 3.141593f;
#endif
			float k = sin(M_PI * _current_time - M_PI / 2.0f);
			if (k < 0) k = (-pow(-k, 0.7f) + 1) / 2;
			else k = (pow(k, 0.7f) + 1) / 2;
			linearMoveFunction(_startRect, _destRect, _result, k);
		}
コード例 #2
0
		void inertionalMoveFunction(const IntCoord & _startRect, const IntCoord & _destRect, IntCoord & _result, float _current_time)
		{
#ifndef M_PI
			const float M_PI = 3.141593;
#endif
			double k = sin(M_PI * _current_time - M_PI/2);
			if (k<0) k = (-pow((-k), (double)0.7) + 1)/2;
			else k = (pow((k), (double)0.7) + 1)/2;
			linearMoveFunction(_startRect, _destRect, _result, (float)k);
		}