| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | // Copyright (c) 2016-2018 Easy2D - Nomango
 | 
					
						
							|  |  |  |  | // 
 | 
					
						
							|  |  |  |  | // Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
					
						
							|  |  |  |  | // of this software and associated documentation files (the "Software"), to deal
 | 
					
						
							|  |  |  |  | // in the Software without restriction, including without limitation the rights
 | 
					
						
							|  |  |  |  | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
					
						
							|  |  |  |  | // copies of the Software, and to permit persons to whom the Software is
 | 
					
						
							|  |  |  |  | // furnished to do so, subject to the following conditions:
 | 
					
						
							|  |  |  |  | // 
 | 
					
						
							|  |  |  |  | // The above copyright notice and this permission notice shall be included in
 | 
					
						
							|  |  |  |  | // all copies or substantial portions of the Software.
 | 
					
						
							|  |  |  |  | // 
 | 
					
						
							|  |  |  |  | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
					
						
							|  |  |  |  | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
					
						
							|  |  |  |  | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
					
						
							|  |  |  |  | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
					
						
							|  |  |  |  | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
					
						
							|  |  |  |  | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
					
						
							|  |  |  |  | // THE SOFTWARE.
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | #pragma once
 | 
					
						
							|  |  |  |  | #include "Action.h"
 | 
					
						
							|  |  |  |  | #include "Geometry.h"  // ActionPath
 | 
					
						
							|  |  |  |  | #include "../base/logs.h"
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace easy2d | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2019-04-08 14:15:27 +08:00
										 |  |  |  | 	using EaseFunc = Closure<float(float)>; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6>
 | 
					
						
							|  |  |  |  | 	// See https://easings.net for more information
 | 
					
						
							|  |  |  |  | 	struct Ease | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc Linear;			// <20><><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc EaseIn;			// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc EaseOut;		// <20>ɿ<EFBFBD><C9BF><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc EaseInOut;		// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>ɿ<EFBFBD><C9BF><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc ExpoIn;			// <20><><EFBFBD><EFBFBD><EFBFBD>伫<EFBFBD><E4BCAB>
 | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc ExpoOut;		// <20>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc ExpoInOut;		// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc ElasticIn;		// <20><><EFBFBD><EFBFBD><EFBFBD>㸳<EFBFBD>赯<EFBFBD><E8B5AF>
 | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc ElasticOut;		// <20><><EFBFBD>յ㸳<D5B5>赯<EFBFBD><E8B5AF>
 | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc ElasticInOut;	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ㸳<D5B5>赯<EFBFBD><E8B5AF>
 | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc BounceIn;		// <20><><EFBFBD><EFBFBD><EFBFBD>㸳<EFBFBD>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc BounceOut;		// <20><><EFBFBD>յ㸳<D5B5>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc BounceInOut;	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ㸳<D5B5>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc BackIn; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc BackOut; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc BackInOut; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc QuadIn; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc QuadOut; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc QuadInOut; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc CubicIn; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc CubicOut; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc CubicInOut; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc QuartIn; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc QuartOut; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc QuartInOut; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc QuintIn; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc QuintOut; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc QuintInOut; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc SineIn; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc SineOut; | 
					
						
							|  |  |  |  | 		static E2D_API EaseFunc SineInOut; | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	inline EaseFunc MakeEaseIn(float rate) { return std::bind(math::EaseIn, std::placeholders::_1, rate); } | 
					
						
							|  |  |  |  | 	inline EaseFunc MakeEaseOut(float rate) { return std::bind(math::EaseOut, std::placeholders::_1, rate); } | 
					
						
							|  |  |  |  | 	inline EaseFunc MakeEaseInOut(float rate) { return std::bind(math::EaseInOut, std::placeholders::_1, rate); } | 
					
						
							|  |  |  |  | 	inline EaseFunc MakeEaseElasticIn(float period) { return std::bind(math::EaseElasticIn, std::placeholders::_1, period); } | 
					
						
							|  |  |  |  | 	inline EaseFunc MakeEaseElasticOut(float period) { return std::bind(math::EaseElasticOut, std::placeholders::_1, period); } | 
					
						
							|  |  |  |  | 	inline EaseFunc MakeEaseElasticInOut(float period) { return std::bind(math::EaseElasticInOut, std::placeholders::_1, period); } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD>䶯<EFBFBD><E4B6AF>
 | 
					
						
							|  |  |  |  | 	class E2D_API ActionTween | 
					
						
							|  |  |  |  | 		: public Action | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		ActionTween(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		ActionTween( | 
					
						
							|  |  |  |  | 			Duration duration, | 
					
						
							|  |  |  |  | 			EaseFunc func | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20>Զ<EFBFBD><D4B6>建<EFBFBD><E5BBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		void SetEaseFunc( | 
					
						
							|  |  |  |  | 			EaseFunc const& func | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		EaseFunc const& GetEaseFunc() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		Duration GetDuration() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		void SetDuration(Duration duration); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		void Update(NodePtr const& target, Duration dt) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		virtual void UpdateTween(NodePtr const& target, float percent) = 0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		Duration dur_; | 
					
						
							|  |  |  |  | 		EaseFunc ease_func_; | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD>λ<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>
 | 
					
						
							|  |  |  |  | 	class E2D_API ActionMoveBy | 
					
						
							|  |  |  |  | 		: public ActionTween | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		ActionMoveBy( | 
					
						
							|  |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			Point const& vector,	/* <20>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD> */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		ActionPtr Clone() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
 | 
					
						
							|  |  |  |  | 		ActionPtr Reverse() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		void Init(NodePtr const& target) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		void UpdateTween(NodePtr const& target, float percent) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		Point	start_pos_; | 
					
						
							|  |  |  |  | 		Point	prev_pos_; | 
					
						
							|  |  |  |  | 		Point	delta_pos_; | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// λ<>ƶ<EFBFBD><C6B6><EFBFBD>
 | 
					
						
							|  |  |  |  | 	class E2D_API ActionMoveTo | 
					
						
							|  |  |  |  | 		: public ActionMoveBy | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		ActionMoveTo( | 
					
						
							|  |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			Point const& pos,		/* Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		ActionPtr Clone() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
 | 
					
						
							|  |  |  |  | 		virtual ActionPtr Reverse() const override | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			E2D_ERROR_LOG(L"Reverse() not supported in ActionMoveTo"); | 
					
						
							|  |  |  |  | 			return nullptr; | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		void Init(NodePtr const& target) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		Point end_pos_; | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	class E2D_API ActionJumpBy | 
					
						
							|  |  |  |  | 		: public ActionTween | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		ActionJumpBy( | 
					
						
							|  |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			Point const& vec,		/* <20><>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD> */ | 
					
						
							|  |  |  |  | 			float height,			/* <20><>Ծ<EFBFBD>߶<EFBFBD> */ | 
					
						
							|  |  |  |  | 			int jumps = 1,			/* <20><>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD> */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		ActionPtr Clone() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
 | 
					
						
							|  |  |  |  | 		ActionPtr Reverse() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		void Init(NodePtr const& target) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		void UpdateTween(NodePtr const& target, float percent) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		Point	start_pos_; | 
					
						
							|  |  |  |  | 		Point	delta_pos_; | 
					
						
							|  |  |  |  | 		float	height_; | 
					
						
							|  |  |  |  | 		int		jumps_; | 
					
						
							|  |  |  |  | 		Point	prev_pos_; | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	class E2D_API ActionJumpTo | 
					
						
							|  |  |  |  | 		: public ActionJumpBy | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		ActionJumpTo( | 
					
						
							|  |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			Point const& pos,		/* Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */ | 
					
						
							|  |  |  |  | 			float height,			/* <20><>Ծ<EFBFBD>߶<EFBFBD> */ | 
					
						
							|  |  |  |  | 			int jumps = 1,			/* <20><>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD> */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		ActionPtr Clone() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
 | 
					
						
							|  |  |  |  | 		virtual ActionPtr Reverse() const override | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			E2D_ERROR_LOG(L"Reverse() not supported in ActionJumpTo"); | 
					
						
							|  |  |  |  | 			return nullptr; | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		void Init(NodePtr const& target) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		Point end_pos_; | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
 | 
					
						
							|  |  |  |  | 	class E2D_API ActionScaleBy | 
					
						
							|  |  |  |  | 		: public ActionTween | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		ActionScaleBy( | 
					
						
							|  |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			float scale,			/* <20><><EFBFBD>Ա仯ֵ */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		ActionScaleBy( | 
					
						
							|  |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			float scale_x,			/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա仯ֵ */ | 
					
						
							|  |  |  |  | 			float scale_y,			/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա仯ֵ */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		ActionPtr Clone() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
 | 
					
						
							|  |  |  |  | 		ActionPtr Reverse() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		void Init(NodePtr const& target) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		void UpdateTween(NodePtr const& target, float percent) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		float	start_scale_x_; | 
					
						
							|  |  |  |  | 		float	start_scale_y_; | 
					
						
							|  |  |  |  | 		float	delta_x_; | 
					
						
							|  |  |  |  | 		float	delta_y_; | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
 | 
					
						
							|  |  |  |  | 	class E2D_API ActionScaleTo | 
					
						
							|  |  |  |  | 		: public ActionScaleBy | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		ActionScaleTo( | 
					
						
							|  |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			float scale,			/* Ŀ<><C4BF>ֵ */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		ActionScaleTo( | 
					
						
							|  |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			float scale_x,			/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ֵ */ | 
					
						
							|  |  |  |  | 			float scale_y,			/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ֵ */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		ActionPtr Clone() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
 | 
					
						
							|  |  |  |  | 		virtual ActionPtr Reverse() const override | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			E2D_ERROR_LOG(L"Reverse() not supported in ActionScaleTo"); | 
					
						
							|  |  |  |  | 			return nullptr; | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		void Init(NodePtr const& target) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		float	end_scale_x_; | 
					
						
							|  |  |  |  | 		float	end_scale_y_; | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD>䶯<EFBFBD><E4B6AF>
 | 
					
						
							|  |  |  |  | 	class E2D_API ActionOpacityBy | 
					
						
							|  |  |  |  | 		: public ActionTween | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		ActionOpacityBy( | 
					
						
							|  |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			float opacity,			/* <20><><EFBFBD>Ա仯ֵ */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		ActionPtr Clone() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
 | 
					
						
							|  |  |  |  | 		ActionPtr Reverse() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		void Init(NodePtr const& target) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		void UpdateTween(NodePtr const& target, float percent) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		float start_val_; | 
					
						
							|  |  |  |  | 		float delta_val_; | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <><CDB8><EFBFBD>Ƚ<EFBFBD><C8BD>䶯<EFBFBD><E4B6AF>
 | 
					
						
							|  |  |  |  | 	class E2D_API ActionOpacityTo | 
					
						
							|  |  |  |  | 		: public ActionOpacityBy | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		ActionOpacityTo( | 
					
						
							|  |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			float opacity,			/* Ŀ<><C4BF>ֵ */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		ActionPtr Clone() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
 | 
					
						
							|  |  |  |  | 		virtual ActionPtr Reverse() const override | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			E2D_ERROR_LOG(L"Reverse() not supported in ActionOpacityTo"); | 
					
						
							|  |  |  |  | 			return nullptr; | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		void Init(NodePtr const& target) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		float end_val_; | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD>붯<EFBFBD><EBB6AF>
 | 
					
						
							|  |  |  |  | 	class E2D_API ActionFadeIn | 
					
						
							|  |  |  |  | 		: public ActionOpacityTo | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>붯<EFBFBD><EBB6AF>
 | 
					
						
							|  |  |  |  | 		explicit ActionFadeIn( | 
					
						
							|  |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	class E2D_API ActionFadeOut | 
					
						
							|  |  |  |  | 		: public ActionOpacityTo | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		explicit ActionFadeOut( | 
					
						
							| 
									
										
										
										
											2019-04-08 14:15:27 +08:00
										 |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 		); | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	class E2D_API ActionRotateBy | 
					
						
							|  |  |  |  | 		: public ActionTween | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		ActionRotateBy( | 
					
						
							|  |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			float rotation,			/* <20><><EFBFBD>Ա仯ֵ */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		ActionPtr Clone() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
 | 
					
						
							|  |  |  |  | 		ActionPtr Reverse() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		void Init(NodePtr const& target) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		void UpdateTween(NodePtr const& target, float percent) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		float start_val_; | 
					
						
							|  |  |  |  | 		float delta_val_; | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	class E2D_API ActionRotateTo | 
					
						
							|  |  |  |  | 		: public ActionRotateBy | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		ActionRotateTo( | 
					
						
							|  |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			float rotation,			/* Ŀ<><C4BF>ֵ */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		ActionPtr Clone() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
 | 
					
						
							|  |  |  |  | 		virtual ActionPtr Reverse() const override | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			E2D_ERROR_LOG(L"Reverse() not supported in ActionRotateTo"); | 
					
						
							|  |  |  |  | 			return nullptr; | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		void Init(NodePtr const& target) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		float end_val_; | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// ·<><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	class E2D_API ActionPath | 
					
						
							|  |  |  |  | 		: public ActionTween | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		ActionPath( | 
					
						
							|  |  |  |  | 			Duration duration,		/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */ | 
					
						
							|  |  |  |  | 			GeometryPtr const& geo,	/* <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> */ | 
					
						
							|  |  |  |  | 			bool rotating = false,	/* <20><>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><DFB7><EFBFBD><EFBFBD><EFBFBD>ת */ | 
					
						
							|  |  |  |  | 			float start = 0.f,		/* <20><><EFBFBD><EFBFBD> */ | 
					
						
							|  |  |  |  | 			float end = 1.f,		/* <20>յ<EFBFBD> */ | 
					
						
							|  |  |  |  | 			EaseFunc func = nullptr	/* <20>ٶȱ仯 */ | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		ActionPtr Clone() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
 | 
					
						
							|  |  |  |  | 		ActionPtr Reverse() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		void Init(NodePtr const& target) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		void UpdateTween(NodePtr const& target, float percent) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	protected: | 
					
						
							|  |  |  |  | 		bool		rotating_; | 
					
						
							|  |  |  |  | 		float		start_; | 
					
						
							|  |  |  |  | 		float		end_; | 
					
						
							|  |  |  |  | 		Point		start_pos_; | 
					
						
							|  |  |  |  | 		GeometryPtr	geo_; | 
					
						
							|  |  |  |  | 	}; | 
					
						
							|  |  |  |  | } |