Fix to use world color for the Fade Transition. 32/260532/2
authorseungho <sbsh.baek@samsung.com>
Mon, 28 Jun 2021 09:45:22 +0000 (18:45 +0900)
committerSeungho Baek <sbsh.baek@samsung.com>
Tue, 29 Jun 2021 05:51:56 +0000 (14:51 +0900)
 - In the current Fade transition implementation, set mOpacity and current property of target control
   for the transition animation.
 - It could create wrong value, for example,
   for the fade out transition the input mOpacity could be larger than
   the value of target opacity.

Change-Id: I7a55fdb7775a4a9f183360c0eddfb3ca88076287
Signed-off-by: seungho <sbsh.baek@samsung.com>
dali-toolkit/internal/transition/fade-impl.cpp

index 30edc3e..33bee66 100644 (file)
@@ -87,17 +87,20 @@ void Fade::OnPlay()
   Property::Map startPropertyMap;
   Property::Map finishPropertyMap;
 
+  float targetOpacity                              = GetWorldColor(targetControl).a;
+  targetControl[Dali::Actor::Property::COLOR_MODE] = Dali::ColorMode::USE_OWN_COLOR;
+
   if(IsAppearingTransition())
   {
     initialPropertyMap.Insert(Dali::Actor::Property::OPACITY, 0.0f);
-    startPropertyMap.Insert(Dali::Actor::Property::OPACITY, mOpacity);
-    finishPropertyMap.Insert(Dali::Actor::Property::OPACITY, targetControl[Dali::Actor::Property::OPACITY]);
+    startPropertyMap.Insert(Dali::Actor::Property::OPACITY, mOpacity * targetOpacity);
+    finishPropertyMap.Insert(Dali::Actor::Property::OPACITY, targetOpacity);
   }
   else
   {
-    initialPropertyMap.Insert(Dali::Actor::Property::OPACITY, targetControl[Dali::Actor::Property::OPACITY]);
-    startPropertyMap.Insert(Dali::Actor::Property::OPACITY, targetControl[Dali::Actor::Property::OPACITY]);
-    finishPropertyMap.Insert(Dali::Actor::Property::OPACITY, mOpacity);
+    initialPropertyMap.Insert(Dali::Actor::Property::OPACITY, targetOpacity);
+    startPropertyMap.Insert(Dali::Actor::Property::OPACITY, targetOpacity);
+    finishPropertyMap.Insert(Dali::Actor::Property::OPACITY, mOpacity * targetOpacity);
   }
 
   SetInitialPropertyMap(initialPropertyMap);