diff --git a/Assets/Fungus/Camera/Scripts/CameraController.cs b/Assets/Fungus/Camera/Scripts/CameraController.cs index 7036acf5..ac72dbb6 100644 --- a/Assets/Fungus/Camera/Scripts/CameraController.cs +++ b/Assets/Fungus/Camera/Scripts/CameraController.cs @@ -131,19 +131,33 @@ namespace Fungus /** * Fade out, move camera to view and then fade back in. */ - public virtual void FadeToView(View view, float fadeDuration, Action fadeAction) + public virtual void FadeToView(View view, float fadeDuration, bool fadeOut, Action fadeAction) { swipePanActive = false; fadeAlpha = 0f; - + + float outDuration; + float inDuration; + + if (fadeOut) + { + outDuration = fadeDuration / 2f; + inDuration = fadeDuration / 2f; + } + else + { + outDuration = 0; + inDuration = fadeDuration; + } + // Fade out - Fade(1f, fadeDuration / 2f, delegate { + Fade(1f, outDuration, delegate { // Snap to new view PanToPosition(view.transform.position, view.transform.rotation, view.viewSize, 0f, null); // Fade in - Fade(0f, fadeDuration / 2f, delegate { + Fade(0f, inDuration, delegate { if (fadeAction != null) { fadeAction(); diff --git a/Assets/Fungus/Camera/Scripts/Commands/FadeToView.cs b/Assets/Fungus/Camera/Scripts/Commands/FadeToView.cs index 0f1bc73e..af043cde 100644 --- a/Assets/Fungus/Camera/Scripts/Commands/FadeToView.cs +++ b/Assets/Fungus/Camera/Scripts/Commands/FadeToView.cs @@ -13,6 +13,9 @@ namespace Fungus [Tooltip("Time for fade effect to complete")] public float duration = 1f; + [Tooltip("Fade from fully visible to opaque at start of fade")] + public bool fadeOut = true; + [Tooltip("View to transition to when Fade is complete")] public View targetView; @@ -49,7 +52,7 @@ namespace Fungus cameraController.screenFadeTexture = CameraController.CreateColorTexture(fadeColor, 32, 32); } - cameraController.FadeToView(targetView, duration, delegate { + cameraController.FadeToView(targetView, duration, fadeOut, delegate { if (waitUntilFinished) { cameraController.waiting = false;