Refactoring transition and fadeTransition 47/262647/17
authorseungho <sbsh.baek@samsung.com>
Tue, 17 Aug 2021 07:02:30 +0000 (16:02 +0900)
committerseungho <sbsh.baek@samsung.com>
Fri, 27 Aug 2021 06:56:45 +0000 (15:56 +0900)
 - changes fade to fadeTransition
 - changes to use world transition and color for the all transition
   to make it indepenent of the parent Control and its transitions

Change-Id: I022cc7911445036e28e9c7e250caf021844d4166
Signed-off-by: seungho <sbsh.baek@samsung.com>
20 files changed:
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/utc-Dali-Fade.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-FadeTransition.cpp [new file with mode: 0755]
automated-tests/src/dali-toolkit/utc-Dali-Transition.cpp
dali-toolkit/dali-toolkit.h
dali-toolkit/internal/file.list
dali-toolkit/internal/transition/fade-impl.cpp [deleted file]
dali-toolkit/internal/transition/fade-impl.h [deleted file]
dali-toolkit/internal/transition/fade-transition-impl.cpp [new file with mode: 0644]
dali-toolkit/internal/transition/fade-transition-impl.h [new file with mode: 0644]
dali-toolkit/internal/transition/transition-base-impl.cpp
dali-toolkit/internal/transition/transition-base-impl.h
dali-toolkit/internal/transition/transition-impl.cpp
dali-toolkit/internal/transition/transition-set-impl.cpp
dali-toolkit/public-api/file.list
dali-toolkit/public-api/transition/fade-transition.cpp [new file with mode: 0644]
dali-toolkit/public-api/transition/fade-transition.h [new file with mode: 0644]
dali-toolkit/public-api/transition/fade.cpp [deleted file]
dali-toolkit/public-api/transition/fade.h [deleted file]
dali-toolkit/public-api/transition/transition-set.h

index b3c04d40798bda2da48c34fac01542d752bc2eda..3d008339518fa00b8fe9541f2d2791b29d8beafb 100755 (executable)
@@ -19,7 +19,7 @@ SET(TC_SOURCES
   utc-Dali-ConfirmationPopup.cpp
   utc-Dali-CubeTransitionEffect.cpp
   utc-Dali-EffectsView.cpp
-  utc-Dali-Fade.cpp
+  utc-Dali-FadeTransition.cpp
   utc-Dali-FlexContainer.cpp
   utc-Dali-FlexNode.cpp
   utc-Dali-GaussianBlurView.cpp
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Fade.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Fade.cpp
deleted file mode 100755 (executable)
index 8fc8fba..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <iostream>
-#include <stdlib.h>
-#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali/devel-api/actors/actor-devel.h>
-#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
-#include <dali-toolkit/public-api/transition/transition-set.h>
-#include <dali-toolkit/public-api/transition/transition-base.h>
-#include <dali-toolkit/public-api/transition/fade.h>
-
-using namespace Dali;
-using namespace Dali::Toolkit;
-
-// Functor to test whether a Finish signal is emitted
-struct TransitionFinishCheck
-{
-  TransitionFinishCheck(bool& signalReceived)
-  : mSignalReceived(signalReceived)
-  {
-  }
-
-  void operator()(TransitionSet& transitionSet)
-  {
-    mSignalReceived = true;
-  }
-
-  void Reset()
-  {
-    mSignalReceived = false;
-  }
-
-  void CheckSignalReceived()
-  {
-    if(!mSignalReceived)
-    {
-      tet_printf("Expected Finish signal was not received\n");
-      tet_result(TET_FAIL);
-    }
-    else
-    {
-      tet_result(TET_PASS);
-    }
-  }
-
-  void CheckSignalNotReceived()
-  {
-    if(mSignalReceived)
-    {
-      tet_printf("Unexpected Finish signal was received\n");
-      tet_result(TET_FAIL);
-    }
-    else
-    {
-      tet_result(TET_PASS);
-    }
-  }
-
-  bool& mSignalReceived; // owned by individual tests
-};
-
-int UtcDaliFadeSetGetProperty(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline("UtcDaliFadeSetGetProperty");
-
-  Control control = Control::New();
-
-  Fade fade = Fade::New(control, 0.5, TimePeriod(-0.5f, -0.5f));
-
-  TimePeriod timePeriod = fade.GetTimePeriod();
-  DALI_TEST_EQUALS(0.0f, timePeriod.delaySeconds, TEST_LOCATION);
-  DALI_TEST_EQUALS(0.0f, timePeriod.durationSeconds, TEST_LOCATION);
-
-  END_TEST;
-}
-
-int UtcDaliFadeWithOffScene(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline("UtcDaliFadeWithOffScene");
-
-  Control control = Control::New();
-  control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
-  control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
-  control.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
-  control.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
-  control.SetProperty(Actor::Property::OPACITY, 1.0f);
-  Property::Map controlProperty;
-  controlProperty.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
-  controlProperty.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
-  control.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty);
-
-  application.SendNotification();
-  application.Render(20);
-
-  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
-
-  Fade fade = Fade::New(control, 0.5, TimePeriod(0.5f));
-  fade.SetAppearingTransition(false); // set fade out
-  TransitionSet transitionSet = TransitionSet::New();
-  transitionSet.AddTransition(fade);
-  transitionSet.Play();
-
-  bool signalReceived(false);
-  TransitionFinishCheck finishCheck(signalReceived);
-  transitionSet.FinishedSignal().Connect(&application, finishCheck);
-
-  application.SendNotification();
-  application.Render(400);
-
-  // We didn't expect the animation to finish yet
-  application.SendNotification();
-  finishCheck.CheckSignalNotReceived();
-
-  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
-  
-  application.SendNotification();
-  application.Render(200);
-
-  // We did expect the animation to finish
-  application.SendNotification();
-  finishCheck.CheckSignalReceived();
-
-  application.SendNotification();
-  application.Render(20);
-
-  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
-
-  END_TEST;
-}
-
-int UtcDaliFadeOut(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline("UtcDaliFadeOut");
-
-  Control control = Control::New();
-  control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
-  control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
-  control.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
-  control.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
-  control.SetProperty(Actor::Property::OPACITY, 1.0f);
-  Property::Map controlProperty;
-  controlProperty.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
-  controlProperty.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
-  control.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty);
-
-  application.GetScene().Add(control);
-
-  application.SendNotification();
-  application.Render(20);
-
-  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
-
-  Fade fade = Fade::New(control, 0.5, TimePeriod(0.5f));
-  fade.SetAppearingTransition(false); // set fade out
-  TransitionSet transitionSet = TransitionSet::New();
-  transitionSet.AddTransition(fade);
-  transitionSet.Play();
-
-  bool signalReceived(false);
-  TransitionFinishCheck finishCheck(signalReceived);
-  transitionSet.FinishedSignal().Connect(&application, finishCheck);
-
-  application.SendNotification();
-  application.Render(400);
-
-  // We didn't expect the animation to finish yet
-  application.SendNotification();
-  finishCheck.CheckSignalNotReceived();
-
-  float currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
-  DALI_TEST_CHECK(currentOpacity <= 0.7 && currentOpacity >= 0.5);
-  
-  application.SendNotification();
-  application.Render(200);
-
-  // We did expect the animation to finish
-  application.SendNotification();
-  finishCheck.CheckSignalReceived();
-
-  application.SendNotification();
-  application.Render(20);
-
-  // Property is reset after animation.
-  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
-
-  END_TEST;
-}
-
-int UtcDaliFadeIn(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline("UtcDaliFadeIn");
-
-  Control control = Control::New();
-  control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
-  control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
-  control.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
-  control.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
-  control.SetProperty(Actor::Property::OPACITY, 1.0f);
-  Property::Map controlProperty;
-  controlProperty.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
-  controlProperty.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
-  control.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty);
-
-  application.GetScene().Add(control);
-
-  application.SendNotification();
-  application.Render(20);
-
-  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
-
-  Fade fade = Fade::New(control, 0.5, TimePeriod(0.5f));
-  fade.SetAppearingTransition(true); // set fade in
-  TransitionSet transitionSet = TransitionSet::New();
-  transitionSet.AddTransition(fade);
-  transitionSet.Play();
-
-  bool signalReceived(false);
-  TransitionFinishCheck finishCheck(signalReceived);
-  transitionSet.FinishedSignal().Connect(&application, finishCheck);
-
-  application.SendNotification();
-  application.Render(400);
-
-  // We didn't expect the animation to finish yet
-  application.SendNotification();
-  finishCheck.CheckSignalNotReceived();
-
-  float currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
-  DALI_TEST_CHECK(currentOpacity <= 1.0 && currentOpacity >= 0.8);
-  
-  application.SendNotification();
-  application.Render(200);
-
-  // We did expect the animation to finish
-  application.SendNotification();
-  finishCheck.CheckSignalReceived();
-
-  application.SendNotification();
-  application.Render(20);
-
-  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
-
-  END_TEST;
-}
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-FadeTransition.cpp b/automated-tests/src/dali-toolkit/utc-Dali-FadeTransition.cpp
new file mode 100755 (executable)
index 0000000..f708a31
--- /dev/null
@@ -0,0 +1,333 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/devel-api/actors/actor-devel.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/public-api/transition/transition-set.h>
+#include <dali-toolkit/public-api/transition/transition-base.h>
+#include <dali-toolkit/public-api/transition/fade-transition.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+// Functor to test whether a Finish signal is emitted
+struct TransitionFinishCheck
+{
+  TransitionFinishCheck(bool& signalReceived)
+  : mSignalReceived(signalReceived)
+  {
+  }
+
+  void operator()(TransitionSet& transitionSet)
+  {
+    mSignalReceived = true;
+  }
+
+  void Reset()
+  {
+    mSignalReceived = false;
+  }
+
+  void CheckSignalReceived()
+  {
+    if(!mSignalReceived)
+    {
+      tet_printf("Expected Finish signal was not received\n");
+      tet_result(TET_FAIL);
+    }
+    else
+    {
+      tet_result(TET_PASS);
+    }
+  }
+
+  void CheckSignalNotReceived()
+  {
+    if(mSignalReceived)
+    {
+      tet_printf("Unexpected Finish signal was received\n");
+      tet_result(TET_FAIL);
+    }
+    else
+    {
+      tet_result(TET_PASS);
+    }
+  }
+
+  bool& mSignalReceived; // owned by individual tests
+};
+
+int UtcDaliFadeTransitionSetGetProperty(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliFadeTransitionSetGetProperty");
+
+  Control control = Control::New();
+
+  FadeTransition fade = FadeTransition::New(control, 0.5, TimePeriod(-0.5f, -0.5f));
+
+  TimePeriod timePeriod = fade.GetTimePeriod();
+  DALI_TEST_EQUALS(0.0f, timePeriod.delaySeconds, TEST_LOCATION);
+  DALI_TEST_EQUALS(0.0f, timePeriod.durationSeconds, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliFadeTransitionWithOffScene(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliFadeTransitionWithOffScene");
+
+  Control control = Control::New();
+  control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+  control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  control.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
+  control.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
+  control.SetProperty(Actor::Property::OPACITY, 1.0f);
+  Property::Map controlProperty;
+  controlProperty.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
+  controlProperty.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+  control.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty);
+
+  application.SendNotification();
+  application.Render(20);
+
+  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+  FadeTransition fade = FadeTransition::New(control, 0.5, TimePeriod(0.5f));
+  fade.SetAppearingTransition(false); // set fade out
+  TransitionSet transitionSet = TransitionSet::New();
+  transitionSet.AddTransition(fade);
+  transitionSet.Play();
+
+  bool signalReceived(false);
+  TransitionFinishCheck finishCheck(signalReceived);
+  transitionSet.FinishedSignal().Connect(&application, finishCheck);
+
+  application.SendNotification();
+  application.Render(400);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+
+  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+  
+  application.SendNotification();
+  application.Render(200);
+
+  // We did expect the animation to finish
+  application.SendNotification();
+  finishCheck.CheckSignalReceived();
+
+  application.SendNotification();
+  application.Render(20);
+
+  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliFadeTransitionDisappearing(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliFadeTransitionOut");
+
+  Control control = Control::New();
+  control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+  control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  control.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
+  control.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
+  control.SetProperty(Actor::Property::OPACITY, 1.0f);
+  Property::Map controlProperty;
+  controlProperty.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
+  controlProperty.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+  control.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty);
+
+  application.GetScene().Add(control);
+
+  application.SendNotification();
+  application.Render(20);
+
+  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+  FadeTransition fade = FadeTransition::New(control, 0.5, TimePeriod(0.5f));
+  fade.SetAppearingTransition(false); // set fade out
+  TransitionSet transitionSet = TransitionSet::New();
+  transitionSet.AddTransition(fade);
+  transitionSet.Play();
+
+  bool signalReceived(false);
+  TransitionFinishCheck finishCheck(signalReceived);
+  transitionSet.FinishedSignal().Connect(&application, finishCheck);
+
+  application.SendNotification();
+  application.Render(400);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+
+  float currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
+  DALI_TEST_CHECK(currentOpacity <= 0.7 && currentOpacity >= 0.5);
+  
+  application.SendNotification();
+  application.Render(200);
+
+  // We did expect the animation to finish
+  application.SendNotification();
+  finishCheck.CheckSignalReceived();
+
+  application.SendNotification();
+  application.Render(20);
+
+  // Property is reset after animation.
+  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliFadeTransitionAppearing(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliFadeTransitionIn");
+
+  Control control = Control::New();
+  control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+  control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  control.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
+  control.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
+  control.SetProperty(Actor::Property::OPACITY, 1.0f);
+  Property::Map controlProperty;
+  controlProperty.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
+  controlProperty.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+  control.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty);
+
+  application.GetScene().Add(control);
+
+  application.SendNotification();
+  application.Render(20);
+
+  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+  FadeTransition fade = FadeTransition::New(control, 0.5, TimePeriod(0.5f));
+  fade.SetAppearingTransition(true); // set fade in
+  TransitionSet transitionSet = TransitionSet::New();
+  transitionSet.AddTransition(fade);
+  transitionSet.Play();
+
+  bool signalReceived(false);
+  TransitionFinishCheck finishCheck(signalReceived);
+  transitionSet.FinishedSignal().Connect(&application, finishCheck);
+
+  application.SendNotification();
+  application.Render(400);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+
+  float currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
+  DALI_TEST_CHECK(currentOpacity <= 1.0 && currentOpacity >= 0.8);
+  
+  application.SendNotification();
+  application.Render(200);
+
+  // We did expect the animation to finish
+  application.SendNotification();
+  finishCheck.CheckSignalReceived();
+
+  application.SendNotification();
+  application.Render(20);
+
+  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+  END_TEST;
+}
+
+
+int UtcDaliFadeTransitionAppearingWithDelay(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliFadeTransitionIn");
+
+  Control control = Control::New();
+  control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+  control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  control.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
+  control.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
+  control.SetProperty(Actor::Property::OPACITY, 1.0f);
+  Property::Map controlProperty;
+  controlProperty.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
+  controlProperty.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+  control.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty);
+
+  application.GetScene().Add(control);
+
+  application.SendNotification();
+  application.Render(20);
+
+  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+  FadeTransition fade = FadeTransition::New(control, 0.5, TimePeriod(0.5f, 0.5f));
+  fade.SetAppearingTransition(true); // set fade in
+  TransitionSet transitionSet = TransitionSet::New();
+  transitionSet.AddTransition(fade);
+  transitionSet.Play();
+
+  bool signalReceived(false);
+  TransitionFinishCheck finishCheck(signalReceived);
+  transitionSet.FinishedSignal().Connect(&application, finishCheck);
+
+  application.SendNotification();
+  application.Render(400);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+
+  float currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
+  DALI_TEST_CHECK(currentOpacity <= 0.01f);
+
+  application.SendNotification();
+  application.Render(500);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+
+  currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
+  DALI_TEST_CHECK(currentOpacity <= 1.0 && currentOpacity >= 0.8);
+
+  application.SendNotification();
+  application.Render(200);
+
+  // We did expect the animation to finish
+  application.SendNotification();
+  finishCheck.CheckSignalReceived();
+
+  application.SendNotification();
+  application.Render(20);
+
+  DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+  END_TEST;
+}
index 955e15e639818facd3b24a3b5300190595a6d83e..7e36d2c0aae39be44c5cf62489a649edc20b95b3 100755 (executable)
@@ -580,7 +580,6 @@ int UtcDaliTransitionBetweenImageViewPairWithDelay(void)
 
   DALI_TEST_EQUALS(startWorldPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
 
-
   application.SendNotification();
   application.Render(400);
 
index 4fc84931467eda0ad9cbb2e17067e5a25e0dbf82..10d4ac886b25d3fa9ef6e8aea67595f6e7fef863 100644 (file)
@@ -60,7 +60,7 @@
 
 #include <dali-toolkit/public-api/text/text-enumerations.h>
 
-#include <dali-toolkit/public-api/transition/fade.h>
+#include <dali-toolkit/public-api/transition/fade-transition.h>
 #include <dali-toolkit/public-api/transition/transition.h>
 #include <dali-toolkit/public-api/transition/transition-set.h>
 
index 33b594a3a64b526af69691b9d8302d95d28ff552..d2176dbe1833c1937a7e69b835386f2258041879 100644 (file)
@@ -182,7 +182,7 @@ SET( toolkit_src_files
    ${toolkit_src_dir}/text/rendering/text-backend-impl.cpp
    ${toolkit_src_dir}/text/rendering/text-typesetter.cpp
    ${toolkit_src_dir}/text/rendering/view-model.cpp
-   ${toolkit_src_dir}/transition/fade-impl.cpp
+   ${toolkit_src_dir}/transition/fade-transition-impl.cpp
    ${toolkit_src_dir}/transition/transition-base-impl.cpp
    ${toolkit_src_dir}/transition/transition-impl.cpp
    ${toolkit_src_dir}/transition/transition-lifecycle-controller.cpp
diff --git a/dali-toolkit/internal/transition/fade-impl.cpp b/dali-toolkit/internal/transition/fade-impl.cpp
deleted file mode 100644 (file)
index 33bee66..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali-toolkit/internal/transition/fade-impl.h>
-
-// EXTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali/devel-api/actors/actor-devel.h>
-#include <dali/integration-api/debug.h>
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/object/type-registry.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-namespace Internal
-{
-namespace
-{
-const Dali::AlphaFunction DEFAULT_ALPHA_FUNCTION(Dali::AlphaFunction::DEFAULT);
-
-} // anonymous namespace
-
-FadePtr Fade::New(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod)
-{
-  float delaySeconds = timePeriod.delaySeconds;
-  if(delaySeconds < 0.0f)
-  {
-    DALI_LOG_WARNING("delay should be greater than 0.0f.\n");
-    delaySeconds = 0.0f;
-  }
-
-  float durationSeconds = timePeriod.durationSeconds;
-  if(durationSeconds < 0.0f)
-  {
-    DALI_LOG_WARNING("duration should be greater than 0.0f.\n");
-    durationSeconds = 0.0f;
-  }
-
-  FadePtr fade = new Fade(control, Dali::Clamp(opacity, 0.0f, 1.0f), TimePeriod(delaySeconds, durationSeconds));
-
-  // Second-phase construction
-  fade->Initialize();
-
-  return fade;
-}
-
-Fade::Fade(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod)
-: TransitionBase(),
-  mTargetControl(control),
-  mOpacity(opacity)
-{
-  SetTarget(control);
-  SetTimePeriod(timePeriod);
-}
-
-Fade::~Fade()
-{
-}
-
-void Fade::OnPlay()
-{
-  Dali::Toolkit::Control targetControl = mTargetControl.GetHandle();
-  if(!targetControl || !targetControl[Dali::Actor::Property::CONNECTED_TO_SCENE])
-  {
-    DALI_LOG_ERROR("The Control is not added on the window\n");
-    return;
-  }
-
-  Property::Map initialPropertyMap;
-  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 * targetOpacity);
-    finishPropertyMap.Insert(Dali::Actor::Property::OPACITY, targetOpacity);
-  }
-  else
-  {
-    initialPropertyMap.Insert(Dali::Actor::Property::OPACITY, targetOpacity);
-    startPropertyMap.Insert(Dali::Actor::Property::OPACITY, targetOpacity);
-    finishPropertyMap.Insert(Dali::Actor::Property::OPACITY, mOpacity * targetOpacity);
-  }
-
-  SetInitialPropertyMap(initialPropertyMap);
-  SetStartPropertyMap(startPropertyMap);
-  SetFinishPropertyMap(finishPropertyMap);
-}
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/dali-toolkit/internal/transition/fade-impl.h b/dali-toolkit/internal/transition/fade-impl.h
deleted file mode 100644 (file)
index 0ac5c73..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-#ifndef DALI_TOOLKIT_INTERNAL_FADE_H
-#define DALI_TOOLKIT_INTERNAL_FADE_H
-
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/transition/transition-base-impl.h>
-#include <dali-toolkit/public-api/controls/control.h>
-#include <dali-toolkit/public-api/transition/fade.h>
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/object/weak-handle.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-namespace Internal
-{
-using FadePtr = IntrusivePtr<Fade>;
-
-class Fade : public TransitionBase
-{
-public:
-  /**
-   * @brief Create a new Fade object.
-   * @param[in] control A control of this transition.
-   * @param[in] opacity opacity value the control Opacity property will be changed from/to.
-   * @param[in] timePeriod The duration of the animation.
-   * @return A smart-pointer to the newly allocated Fade.
-   */
-  static FadePtr New(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod);
-
-protected:
-  /**
-   * @copydoc Dali::Toolkit::Fade::OnPlay()
-   */
-  void OnPlay() override;
-
-protected:
-  /**
-   * @brief Construct a new Fade.
-   */
-  Fade(Dali::Toolkit::Control control,
-       float                  opacity,
-       TimePeriod             timePeriod);
-
-  /**
-   * @brief A reference counted object may only be deleted by calling Unreference()
-   */
-  ~Fade() override;
-
-private:
-  // Undefined
-  Fade(const Fade&);
-
-  // Undefined
-  Fade& operator=(const Fade& rhs);
-
-private:
-  WeakHandle<Dali::Toolkit::Control> mTargetControl;
-  float mOpacity;
-};
-
-} // namespace Internal
-
-// Helpers for public-api forwarding methods
-
-inline Internal::Fade& GetImplementation(Dali::Toolkit::Fade& fade)
-{
-  DALI_ASSERT_ALWAYS(fade && "Fade handle is empty");
-
-  BaseObject& handle = fade.GetBaseObject();
-
-  return static_cast<Internal::Fade&>(handle);
-}
-
-inline const Internal::Fade& GetImplementation(const Dali::Toolkit::Fade& fade)
-{
-  DALI_ASSERT_ALWAYS(fade && "Fade handle is empty");
-
-  const BaseObject& handle = fade.GetBaseObject();
-
-  return static_cast<const Internal::Fade&>(handle);
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_INTERNAL_FADE_H
diff --git a/dali-toolkit/internal/transition/fade-transition-impl.cpp b/dali-toolkit/internal/transition/fade-transition-impl.cpp
new file mode 100644 (file)
index 0000000..17c0b2c
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/internal/transition/fade-transition-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/type-registry.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+
+FadeTransitionPtr FadeTransition::New(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod)
+{
+  float delaySeconds = timePeriod.delaySeconds;
+  if(delaySeconds < 0.0f)
+  {
+    DALI_LOG_WARNING("delay should be greater than 0.0f.\n");
+    delaySeconds = 0.0f;
+  }
+
+  float durationSeconds = timePeriod.durationSeconds;
+  if(durationSeconds < 0.0f)
+  {
+    DALI_LOG_WARNING("duration should be greater than 0.0f.\n");
+    durationSeconds = 0.0f;
+  }
+
+  FadeTransitionPtr fadeTransition = new FadeTransition(control, Dali::Clamp(opacity, 0.0f, 1.0f), TimePeriod(delaySeconds, durationSeconds));
+
+  // Second-phase construction
+  fadeTransition->Initialize();
+
+  return fadeTransition;
+}
+
+FadeTransition::FadeTransition(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod)
+: TransitionBase(),
+  mTargetControl(control),
+  mOpacity(opacity)
+{
+  SetTarget(control);
+  SetTimePeriod(timePeriod);
+}
+
+FadeTransition::~FadeTransition()
+{
+}
+
+void FadeTransition::OnPlay()
+{
+  Dali::Toolkit::Control targetControl = mTargetControl.GetHandle();
+  if(!targetControl || !targetControl[Dali::Actor::Property::CONNECTED_TO_SCENE])
+  {
+    DALI_LOG_ERROR("The Control is not added on the window\n");
+    return;
+  }
+
+  Property::Map startPropertyMap;
+  Property::Map finishPropertyMap;
+
+  float targetOpacity = targetControl[Dali::Actor::Property::OPACITY];
+  if(IsAppearingTransition())
+  {
+    startPropertyMap.Insert(Dali::Actor::Property::OPACITY, mOpacity * targetOpacity);
+    finishPropertyMap.Insert(Dali::Actor::Property::OPACITY, targetOpacity);
+  }
+  else
+  {
+    startPropertyMap.Insert(Dali::Actor::Property::OPACITY, targetOpacity);
+    finishPropertyMap.Insert(Dali::Actor::Property::OPACITY, mOpacity * targetOpacity);
+  }
+
+  SetStartPropertyMap(startPropertyMap);
+  SetFinishPropertyMap(finishPropertyMap);
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/dali-toolkit/internal/transition/fade-transition-impl.h b/dali-toolkit/internal/transition/fade-transition-impl.h
new file mode 100644 (file)
index 0000000..c2040b0
--- /dev/null
@@ -0,0 +1,106 @@
+#ifndef DALI_TOOLKIT_INTERNAL_FADE_TRANSITION_H
+#define DALI_TOOLKIT_INTERNAL_FADE_TRANSITION_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/transition/transition-base-impl.h>
+#include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/transition/fade-transition.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/weak-handle.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+using FadeTransitionPtr = IntrusivePtr<FadeTransition>;
+
+class FadeTransition : public TransitionBase
+{
+public:
+  /**
+   * @brief Create a new FadeTransition object.
+   * @param[in] control A control of this transition.
+   * @param[in] opacity opacity value the control Opacity property will be changed from/to.
+   * @param[in] timePeriod The duration of the animation.
+   * @return A smart-pointer to the newly allocated FadeTransition.
+   */
+  static FadeTransitionPtr New(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod);
+
+protected:
+  /**
+   * @copydoc Dali::Toolkit::FadeTransition::OnPlay()
+   */
+  void OnPlay() override;
+
+protected:
+  /**
+   * @brief Construct a new FadeTransition.
+   */
+  FadeTransition(Dali::Toolkit::Control control,
+                 float                  opacity,
+                 TimePeriod             timePeriod);
+
+  /**
+   * @brief A reference counted object may only be deleted by calling Unreference()
+   */
+  ~FadeTransition() override;
+
+private:
+  // Undefined
+  FadeTransition(const FadeTransition&);
+
+  // Undefined
+  FadeTransition& operator=(const FadeTransition& rhs);
+
+private:
+  WeakHandle<Dali::Toolkit::Control> mTargetControl;
+  float                              mOpacity;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::FadeTransition& GetImplementation(Dali::Toolkit::FadeTransition& fade)
+{
+  DALI_ASSERT_ALWAYS(fade && "FadeTransition handle is empty");
+
+  BaseObject& handle = fade.GetBaseObject();
+
+  return static_cast<Internal::FadeTransition&>(handle);
+}
+
+inline const Internal::FadeTransition& GetImplementation(const Dali::Toolkit::FadeTransition& fade)
+{
+  DALI_ASSERT_ALWAYS(fade && "FadeTransition handle is empty");
+
+  const BaseObject& handle = fade.GetBaseObject();
+
+  return static_cast<const Internal::FadeTransition&>(handle);
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_INTERNAL_FADE_TRANSITION_H
index ca34d7740b9c30e4e8e38a921b8ab03ec96bfe88..f8aed47c8024f4e51e240dcec9412815e1e46fc6 100644 (file)
@@ -36,8 +36,20 @@ namespace Internal
 {
 namespace
 {
+static constexpr float OPACITY_TRANSPARENT = 0.0f;
+
 const Dali::AlphaFunction DEFAULT_ALPHA_FUNCTION(Dali::AlphaFunction::DEFAULT);
 
+const Property::Map PROPERTY_MAP_INDEPENDENT_CONTROL{
+  {Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER},
+  {Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER},
+  {Dali::Actor::Property::POSITION_USES_ANCHOR_POINT, true},
+  {Dali::Actor::Property::INHERIT_POSITION, false},
+  {Dali::Actor::Property::INHERIT_ORIENTATION, false},
+  {Dali::Actor::Property::INHERIT_SCALE, false},
+  {Dali::Actor::Property::COLOR_MODE, Dali::ColorMode::USE_OWN_COLOR},
+};
+
 Property::Map GetOriginalProperties(Dali::Toolkit::Control control)
 {
   Property::Map propertyMap;
@@ -105,7 +117,8 @@ TransitionBase::TransitionBase()
   mTimePeriod(TimePeriod(0.0f)),
   mTransitionWithChild(false),
   mMoveTargetChildren(false),
-  mIsAppearingTransition(true)
+  mIsAppearingTransition(true),
+  mIsPairTransition(false)
 {
 }
 
@@ -168,6 +181,20 @@ void TransitionBase::Play()
     return;
   }
 
+  // Set world transform and color to the target control to make it independent of the parent control and its transition.
+  // The properties will be returned at the TransitionFinished() method.
+  Matrix     targetWorldTransform = GetWorldTransform(mTarget);
+  Vector3    targetPosition, targetScale;
+  Quaternion targetOrientation;
+  targetWorldTransform.GetTransformComponents(targetPosition, targetOrientation, targetScale);
+  Vector4 targetColor = GetWorldColor(mTarget);
+
+  mTarget.SetProperties(PROPERTY_MAP_INDEPENDENT_CONTROL);
+  mTarget[Dali::Actor::Property::POSITION]    = targetPosition;
+  mTarget[Dali::Actor::Property::SCALE]       = targetScale;
+  mTarget[Dali::Actor::Property::ORIENTATION] = targetOrientation;
+  mTarget[Dali::Actor::Property::COLOR]       = targetColor;
+
   OnPlay();
 
   SetAnimation();
@@ -181,31 +208,40 @@ void TransitionBase::SetAnimation()
     return;
   }
 
+  // If this transition is not a transition from a Control to another Control
+  // and a transition effect to appear with delay,
+  // the mTarget should not be shown until delay seconds.
+  if(!IsPairTransition() && mIsAppearingTransition && mAnimation && mTimePeriod.delaySeconds > Dali::Math::MACHINE_EPSILON_10)
+  {
+    Dali::KeyFrames initialKeyframes = Dali::KeyFrames::New();
+    initialKeyframes.Add(0.0f, OPACITY_TRANSPARENT);
+    initialKeyframes.Add(1.0f, OPACITY_TRANSPARENT);
+    mAnimation.AnimateBetween(Property(mTarget, Dali::Actor::Property::OPACITY), initialKeyframes, TimePeriod(mTimePeriod.delaySeconds));
+  }
+
   for(uint32_t i = 0; i < mStartPropertyMap.Count(); ++i)
   {
-    Property::Value* initialValuePointer = mInitialPropertyMap.Find(mStartPropertyMap.GetKeyAt(i).indexKey);
     Property::Value* finishValue = mFinishPropertyMap.Find(mStartPropertyMap.GetKeyAt(i).indexKey);
     if(finishValue)
     {
-      Property::Value initialValue = mStartPropertyMap.GetValue(i);
-      if(initialValuePointer)
-      {
-        initialValue = *initialValuePointer;
-      }
-      AnimateBetween(mTarget, mStartPropertyMap.GetKeyAt(i).indexKey, initialValue, mStartPropertyMap.GetValue(i), *finishValue);
+      AnimateBetween(mTarget, mStartPropertyMap.GetKeyAt(i).indexKey, mStartPropertyMap.GetValue(i), *finishValue);
     }
   }
 }
 
-void TransitionBase::AnimateBetween(Dali::Toolkit::Control target, Property::Index index, Property::Value initialValue, Property::Value sourceValue, Property::Value destinationValue)
+void TransitionBase::AnimateBetween(Dali::Toolkit::Control target, Property::Index index, Property::Value sourceValue, Property::Value destinationValue)
 {
   if(mAnimation)
   {
-    if(mTimePeriod.delaySeconds>0.0f)
+    // To make each property keep start value during delay time.
+    // When this transition is not Pair transition, it is not required.
+    // (For appearing transition, the mTarget control will not be shown during delay time,
+    //  For disapplearing transition, the property of mTarget control keeps current value during delay time)
+    if(IsPairTransition() && mTimePeriod.delaySeconds > Dali::Math::MACHINE_EPSILON_10)
     {
       Dali::KeyFrames initialKeyframes = Dali::KeyFrames::New();
-      initialKeyframes.Add(0.0f, initialValue);
-      initialKeyframes.Add(1.0f, initialValue);
+      initialKeyframes.Add(0.0f, sourceValue);
+      initialKeyframes.Add(1.0f, sourceValue);
       mAnimation.AnimateBetween(Property(target, index), initialKeyframes, TimePeriod(mTimePeriod.delaySeconds));
     }
     Dali::KeyFrames keyframes = Dali::KeyFrames::New();
index b3289ec4d0b97e37e8d964011259de98c1eae69c..409eb608a6259f302decfe02163997e84dc5f22e 100644 (file)
@@ -102,14 +102,7 @@ public:
   }
 
 protected:
-  /**
-   * @brief Set property map which will be used as a initial properties.
-   * @param[in] propertyMap propertyMap that will be used as a start value of transition.
-   */
-  void SetInitialPropertyMap(const Property::Map& propertyMap)
-  {
-    mInitialPropertyMap = propertyMap;
-  }
+
   /**
    * @brief Set property map which will be used as a animation start properties.
    * @param[in] propertyMap propertyMap that will be used as a start value of transition.
@@ -173,6 +166,23 @@ protected:
     return mIsAppearingTransition;
   }
 
+  /**
+   * @brief Set whether this transition is a transition from a Control to another Control or effect to appearing or disappearing.
+   * @param[in] pairTransition True if this transition is appearing transition.
+   */
+  void SetPairTransition(bool pairTransition)
+  {
+    mIsPairTransition = pairTransition;
+  }
+
+  /**
+   * @brief Returns whether this transition is a transition from a Control to another Control or effect to appearing or disappearing.
+   */
+  bool IsPairTransition() const
+  {
+    return mIsPairTransition;
+  }
+
 protected:
   /**
    * Construct a new TransitionBase.
@@ -206,11 +216,10 @@ private:
    * @brief Adds a property on an animation between sourceValue and destimationValue.
    * @param[in] target target control to be animated.
    * @param[in] index property index for animation.
-   * @param[in] initialValue initial value of animation.
    * @param[in] sourceValue source value of animation.
    * @param[in] destinationValue destination value of animation.
    */
-  void AnimateBetween(Dali::Toolkit::Control target, Property::Index index, Property::Value initialValue, Property::Value sourceValue, Property::Value destinationValue);
+  void AnimateBetween(Dali::Toolkit::Control target, Property::Index index, Property::Value sourceValue, Property::Value destinationValue);
 
   /**
    * @brief Copy target to make clone for the child Actors
@@ -243,7 +252,6 @@ private:
   Dali::Actor                  mCopiedActor;         ///< Copied View that will replace mTarget during transition
   Dali::Animation              mAnimation;           ///< Property animations for the transition of mTarget
   AlphaFunction                mAlphaFunction;       ///< Alpha function that will applied for the property animation
-  Property::Map                mInitialPropertyMap;  ///< Initial properties to be animated. (world transform)
   Property::Map                mStartPropertyMap;    ///< Start properties to be animated. (world transform)
   Property::Map                mFinishPropertyMap;   ///< Finish properties to be animated. (world transform)
   Property::Map                mOriginalPropertyMap; ///< Original properties of mTarget to be used to restore after the transition is finished.
@@ -252,6 +260,7 @@ private:
                                                      ///< If this is false, the child Actors are moved to the child of mCopiedActor that will have original properties of target Actor during Transition.
   bool mMoveTargetChildren;                          ///< Flag, if mTransitionWithChild is false and mTarget has children than True.
   bool mIsAppearingTransition;                       ///< True, if this transition is appearing transition.
+  bool mIsPairTransition;                            ///< True, if this transition is started from a Control to another Control.
 };
 
 } // namespace Internal
index a465433aec95bed2ac35fca37b37d02fce404906..2cbd14d6df16e80bc2d5a504663f74a3af64dfb1 100644 (file)
@@ -71,6 +71,7 @@ Transition::Transition(Dali::Toolkit::Control source, Dali::Toolkit::Control des
 {
   SetTarget(destination);
   SetTimePeriod(timePeriod);
+  SetPairTransition(true);
 }
 
 Transition::~Transition()
@@ -94,25 +95,15 @@ void Transition::OnPlay()
   Quaternion sourceOrientation;
   sourceWorldTransform.GetTransformComponents(sourcePosition, sourceOrientation, sourceScale);
 
-  Matrix     destinationWorldTransform = GetWorldTransform(destinationControl);
-  Vector3    destinationPosition, destinationScale;
-  Quaternion destinationOrientation;
-  destinationWorldTransform.GetTransformComponents(destinationPosition, destinationOrientation, destinationScale);
+  Vector3    destinationPosition    = destinationControl[Dali::Actor::Property::POSITION];
+  Vector3    destinationScale       = destinationControl[Dali::Actor::Property::SCALE];
+  Quaternion destinationOrientation = destinationControl[Dali::Actor::Property::ORIENTATION];
+  Vector4    targetColor            = destinationControl[Dali::Actor::Property::COLOR];
+  Vector3    targetSize             = destinationControl[Dali::Actor::Property::SIZE];
 
-  Vector3       targetSize  = destinationControl[Dali::Actor::Property::SIZE];
-  Vector4       targetColor = GetWorldColor(destinationControl);
   Property::Map startPropertyMap;
   Property::Map finishPropertyMap;
 
-  // Use world transform if this transition requires animation of transform.
-  destinationControl[Dali::Actor::Property::ANCHOR_POINT]               = AnchorPoint::CENTER;
-  destinationControl[Dali::Actor::Property::PARENT_ORIGIN]              = ParentOrigin::CENTER;
-  destinationControl[Dali::Actor::Property::POSITION_USES_ANCHOR_POINT] = true;
-  destinationControl[Dali::Actor::Property::INHERIT_POSITION]           = false;
-  destinationControl[Dali::Actor::Property::INHERIT_ORIENTATION]        = false;
-  destinationControl[Dali::Actor::Property::INHERIT_SCALE]              = false;
-  destinationControl[Dali::Actor::Property::COLOR_MODE]                 = Dali::ColorMode::USE_OWN_COLOR;
-
   // Set animation of Transform
   startPropertyMap.Insert(Dali::Actor::Property::POSITION, sourcePosition);
   finishPropertyMap.Insert(Dali::Actor::Property::POSITION, destinationPosition);
index ad7ca6273a6015b9c7eba564e312a695c27824d3..fd019b6ad32946c24785325f1b8db5a24e7e72f7 100644 (file)
@@ -128,9 +128,12 @@ void TransitionSet::TransitionStart()
 
 void TransitionSet::TransitionFinished(Dali::Animation& source)
 {
-  for(auto&& transition : mTransitions)
+  // Call TransitionFinished() in reverse order.
+  // This let the first copied original properties will be return again at the final.
+  std::vector<TransitionBasePtr>::reverse_iterator riter;
+  for(riter = mTransitions.rbegin(); riter != mTransitions.rend(); riter++)
   {
-    transition->TransitionFinished();
+    (*riter)->TransitionFinished();
   }
 
   EmitFinishedSignal();
index 212dba78ec6650fb77bc9f26a4ba00553392e97d..71cbc3ad4b1e8c73684cb1d20c02ec862309665b 100644 (file)
@@ -32,7 +32,7 @@ SET( public_api_src_files
   ${public_api_src_dir}/image-loader/async-image-loader.cpp
   ${public_api_src_dir}/image-loader/sync-image-loader.cpp
   ${public_api_src_dir}/styling/style-manager.cpp
-  ${public_api_src_dir}/transition/fade.cpp
+  ${public_api_src_dir}/transition/fade-transition.cpp
   ${public_api_src_dir}/transition/transition-base.cpp
   ${public_api_src_dir}/transition/transition-set.cpp
   ${public_api_src_dir}/transition/transition.cpp
@@ -151,7 +151,7 @@ SET( public_api_visuals_header_files
 )
 
 SET( public_api_transition_header_files
-  ${public_api_src_dir}/transition/fade.h
+  ${public_api_src_dir}/transition/fade-transition.h
   ${public_api_src_dir}/transition/transition-base.h
   ${public_api_src_dir}/transition/transition-set.h
   ${public_api_src_dir}/transition/transition.h
diff --git a/dali-toolkit/public-api/transition/fade-transition.cpp b/dali-toolkit/public-api/transition/fade-transition.cpp
new file mode 100644 (file)
index 0000000..9d08185
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/public-api/transition/fade-transition.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/transition/fade-transition-impl.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+FadeTransition::FadeTransition() = default;
+
+FadeTransition::FadeTransition(Internal::FadeTransition* fadeTransition)
+: TransitionBase(fadeTransition)
+{
+}
+
+FadeTransition FadeTransition::New(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod)
+{
+  Internal::FadeTransitionPtr internal = Dali::Toolkit::Internal::FadeTransition::New(control, opacity, timePeriod);
+
+  return FadeTransition(internal.Get());
+}
+
+FadeTransition FadeTransition::DownCast(BaseHandle handle)
+{
+  return FadeTransition(dynamic_cast<Dali::Toolkit::Internal::FadeTransition*>(handle.GetObjectPtr()));
+}
+
+FadeTransition::~FadeTransition() = default;
+
+FadeTransition::FadeTransition(const FadeTransition& handle) = default;
+
+FadeTransition& FadeTransition::operator=(const FadeTransition& rhs) = default;
+
+FadeTransition::FadeTransition(FadeTransition&& rhs) = default;
+
+FadeTransition& FadeTransition::operator=(FadeTransition&& rhs) = default;
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/dali-toolkit/public-api/transition/fade-transition.h b/dali-toolkit/public-api/transition/fade-transition.h
new file mode 100644 (file)
index 0000000..3f5542a
--- /dev/null
@@ -0,0 +1,119 @@
+#ifndef DALI_TOOLKIT_FADE_TRANSITION_H
+#define DALI_TOOLKIT_FADE_TRANSITION_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/transition/transition-base.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal DALI_INTERNAL
+{
+class FadeTransition;
+}
+
+/**
+ * @brief Fade provides smoothly appearing/disappearing effects for target Control.
+ */
+class DALI_TOOLKIT_API FadeTransition : public TransitionBase
+{
+public:
+  /**
+   * @brief Creates an uninitialized FadeTransition; this can be initialized with FadeTransition::New().
+   *
+   * Calling member functions with an uninitialized FadeTransition handle is not allowed.
+   */
+  FadeTransition();
+
+  /**
+   * @brief Creates an initialized FadeTransition.
+   *
+   * @param[in] control A control of this transition.
+   * @param[in] opacity opacity value the control Opacity property will be changed from/to. Opacity must be between [0, 1].
+   * @param[in] timePeriod The duration of the animation.
+   * @return A handle to a newly allocated Dali resource
+   */
+  static FadeTransition New(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod);
+
+  /**
+   * @brief Downcasts a handle to FadeTransition handle.
+   *
+   * If handle points to an FadeTransition object, the downcast produces valid handle.
+   * If not, the returned handle is left uninitialized.
+   *
+   * @param[in] handle Handle to an object
+   * @return Handle to an FadeTransition object or an uninitialized handle
+   */
+  static FadeTransition DownCast(BaseHandle handle);
+
+  /**
+   * @brief Destructor.
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   */
+  ~FadeTransition();
+
+  /**
+   * @brief This copy constructor is required for (smart) pointer semantics.
+   *
+   * @param[in] handle A reference to the copied handle
+   */
+  FadeTransition(const FadeTransition& handle);
+
+  /**
+   * @brief This assignment operator is required for (smart) pointer semantics.
+   *
+   * @param[in] rhs A reference to the copied handle
+   * @return A reference to this
+   */
+  FadeTransition& operator=(const FadeTransition& rhs);
+
+  /**
+   * @brief Move constructor.
+   *
+   * @param[in] rhs A reference to the moved handle
+   */
+  FadeTransition(FadeTransition&& rhs);
+
+  /**
+   * @brief Move assignment operator.
+   *
+   * @param[in] rhs A reference to the moved handle
+   * @return A reference to this handle
+   */
+  FadeTransition& operator=(FadeTransition&& rhs);
+
+public: // Not intended for use by Application developers
+  /// @cond internal
+  /**
+   * @brief This constructor is used by FadeTransition::New() methods.
+   * @param[in] fadeTransition A pointer to a newly allocated Dali resource
+   */
+  explicit DALI_INTERNAL FadeTransition(Internal::FadeTransition* fadeTransition);
+  /// @endcond
+};
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_FADE_TRANSITION_H
diff --git a/dali-toolkit/public-api/transition/fade.cpp b/dali-toolkit/public-api/transition/fade.cpp
deleted file mode 100644 (file)
index b5e54dc..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali-toolkit/public-api/transition/fade.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/transition/fade-impl.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-Fade::Fade() = default;
-
-Fade::Fade(Internal::Fade* fade)
-: TransitionBase(fade)
-{
-}
-
-Fade Fade::New(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod)
-{
-  Internal::FadePtr internal = Dali::Toolkit::Internal::Fade::New(control, opacity, timePeriod);
-
-  return Fade(internal.Get());
-}
-
-Fade Fade::DownCast(BaseHandle handle)
-{
-  return Fade(dynamic_cast<Dali::Toolkit::Internal::Fade*>(handle.GetObjectPtr()));
-}
-
-Fade::~Fade() = default;
-
-Fade::Fade(const Fade& handle) = default;
-
-Fade& Fade::operator=(const Fade& rhs) = default;
-
-Fade::Fade(Fade&& rhs) = default;
-
-Fade& Fade::operator=(Fade&& rhs) = default;
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/dali-toolkit/public-api/transition/fade.h b/dali-toolkit/public-api/transition/fade.h
deleted file mode 100644 (file)
index dbafb7b..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-#ifndef DALI_TOOLKIT_FADE_H
-#define DALI_TOOLKIT_FADE_H
-
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control.h>
-#include <dali-toolkit/public-api/transition/transition-base.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-namespace Internal DALI_INTERNAL
-{
-class Fade;
-}
-
-/**
- * @brief Fade provides smoothly appearing/disappearing effects for target Control.
- */
-class DALI_TOOLKIT_API Fade : public TransitionBase
-{
-public:
-  /**
-   * @brief Creates an uninitialized Fade; this can be initialized with Fade::New().
-   *
-   * Calling member functions with an uninitialized Fade handle is not allowed.
-   */
-  Fade();
-
-  /**
-   * @brief Creates an initialized Fade.
-   *
-   * @param[in] control A control of this transition.
-   * @param[in] opacity opacity value the control Opacity property will be changed from/to. Opacity must be between [0, 1].
-   * @param[in] timePeriod The duration of the animation.
-   * @return A handle to a newly allocated Dali resource
-   */
-  static Fade New(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod);
-
-  /**
-   * @brief Downcasts a handle to Fade handle.
-   *
-   * If handle points to an Fade object, the downcast produces valid handle.
-   * If not, the returned handle is left uninitialized.
-   *
-   * @param[in] handle Handle to an object
-   * @return Handle to an Fade object or an uninitialized handle
-   */
-  static Fade DownCast(BaseHandle handle);
-
-  /**
-   * @brief Destructor.
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~Fade();
-
-  /**
-   * @brief This copy constructor is required for (smart) pointer semantics.
-   *
-   * @param[in] handle A reference to the copied handle
-   */
-  Fade(const Fade& handle);
-
-  /**
-   * @brief This assignment operator is required for (smart) pointer semantics.
-   *
-   * @param[in] rhs A reference to the copied handle
-   * @return A reference to this
-   */
-  Fade& operator=(const Fade& rhs);
-
-  /**
-   * @brief Move constructor.
-   *
-   * @param[in] rhs A reference to the moved handle
-   */
-  Fade(Fade&& rhs);
-
-  /**
-   * @brief Move assignment operator.
-   *
-   * @param[in] rhs A reference to the moved handle
-   * @return A reference to this handle
-   */
-  Fade& operator=(Fade&& rhs);
-
-public: // Not intended for use by Application developers
-  /// @cond internal
-  /**
-   * @brief This constructor is used by Fade::New() methods.
-   * @param[in] fade A pointer to a newly allocated Dali resource
-   */
-  explicit DALI_INTERNAL Fade(Internal::Fade* fade);
-  /// @endcond
-};
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_FADE_H
index 8df1ea532f0ce2efb03533d83060757141ffc1b0..b690d451ecea9d208ab24dd073280a77c8643725 100644 (file)
@@ -37,11 +37,13 @@ class TransitionSet;
 
 /**
  * @brief
- *
  * TransitionSet is used to control lifetime of multiple Transitions.
  * Transition could be played with multiple other transitions for a scene change.
  * For the case, it is more useful to manage a group of transitions with same lifetime and a finished signal.
  * TransitionSet provides a single Play call and Finished callback for the multiple traisitions those added on it.
+ *
+ * @note
+ * Do not add transitions for a View by dividing them into multiple TransitionSets.
  */
 class DALI_TOOLKIT_API TransitionSet : public BaseHandle
 {