| 
									
										
										
										
											2018-05-08 20:03:29 +08:00
										 |  |  | #include "..\e2daction.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-10 14:03:54 +08:00
										 |  |  | e2d::OpacityBy::OpacityBy(double duration, double opacity) | 
					
						
							|  |  |  | 	: ActionGradual(duration) | 
					
						
							| 
									
										
										
										
											2018-05-08 20:03:29 +08:00
										 |  |  | { | 
					
						
							|  |  |  | 	_deltaVal = opacity; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-17 12:22:52 +08:00
										 |  |  | e2d::OpacityBy * e2d::OpacityBy::create(double duration, double opacity) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return Create<OpacityBy>(duration, opacity); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-08 20:03:29 +08:00
										 |  |  | void e2d::OpacityBy::_init() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	ActionGradual::_init(); | 
					
						
							| 
									
										
										
										
											2018-05-10 00:58:43 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-08 20:03:29 +08:00
										 |  |  | 	if (_target) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		_startVal = _target->getOpacity(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void e2d::OpacityBy::_update() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	ActionGradual::_update(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-10 00:58:43 +08:00
										 |  |  | 	if (_target) | 
					
						
							| 
									
										
										
										
											2018-05-08 20:03:29 +08:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-05-10 00:58:43 +08:00
										 |  |  | 		_target->setOpacity(_startVal + _deltaVal * _delta); | 
					
						
							| 
									
										
										
										
											2018-05-08 20:03:29 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | e2d::OpacityBy * e2d::OpacityBy::clone() const | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-17 12:22:52 +08:00
										 |  |  | 	return Create<OpacityBy>(_duration, _deltaVal); | 
					
						
							| 
									
										
										
										
											2018-05-08 20:03:29 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | e2d::OpacityBy * e2d::OpacityBy::reverse() const | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-17 12:22:52 +08:00
										 |  |  | 	return Create<OpacityBy>(_duration, -_deltaVal); | 
					
						
							| 
									
										
										
										
											2018-05-08 20:03:29 +08:00
										 |  |  | } |