Example #1
0
            /// <summary>
            /// Make a smooth transition between two windows using Lerp.
            /// </summary>
            /// <param name="WFade">Window to fade.</param>
            /// <param name="WShow">Window to reveal.</param>
            /// <param name="Delay">Delay in ms.</param>
            /// <param name="shouldClose ">Close if true, Hide if false.</param>
            public static void Switch(System.Windows.Window WFade, System.Windows.Window WShow, int Delay = 1, bool shouldClose = true)
            {
                __shouldClose = shouldClose;

                SWITCH_LerpFade = new Core.Lerp(1, 0, 0.01f, 0.05f, 1);
                SWITCH_LerpShow = new Core.Lerp(0, 1, 0.01f, 0.05f, 1);

                SWITCH_LerpFade.delay = Delay;
                SWITCH_LerpShow.delay = Delay;

                _WFade = WFade;
                _WShow = WShow;

                _WShow.Hide();
                _WFade.Show();


                SWITCH_LerpShow.LStart += LerpShow_LerpStart;
                SWITCH_LerpShow.LTick  += LerpShow_LerpTick;
                SWITCH_LerpShow.LDone  += LerpShow_LerpDone;

                SWITCH_LerpFade.LStart += LerpFade_LerpStart;
                SWITCH_LerpFade.LTick  += LerpFade_LerpTick;
                SWITCH_LerpFade.LDone  += LerpFade_LerpDone;

                SWITCH_LerpFade.Start();
                SWITCH_LerpShow.Start();
            }
Example #2
0
File: Lerp3D.cs Project: nirex0/NDC
        /// <summary>
        /// Lerp between two 3D Vectors.
        /// </summary>
        /// <param name="from">First Vector.</param>
        /// <param name="to">Second Vector.</param>
        /// <param name="alpha">Alpha value.</param>
        /// <param name="delay">Delay between each tick.</param>
        public Lerp3D(Vector3D from, Vector3D to, float alpha, int delay)
        {
            lerp0.first  = from.X;
            lerp0.second = to.X;
            lerp0.delay  = delay;
            lerp0.alpha  = alpha;

            lerp1.first  = from.Y;
            lerp1.second = to.Y;
            lerp1.delay  = delay;
            lerp1.alpha  = alpha;


            lerp2.first  = from.Z;
            lerp2.second = to.Z;
            lerp2.delay  = delay;
            lerp2.alpha  = alpha;

            lerp0.Start();
            lerp1.Start();
            lerp2.Start();

            lerp0.LTick += lerp0_LerpTick;
            lerp1.LTick += lerp1_LerpTick;
            lerp2.LTick += lerp2_LerpTick;

            lerp0.LDone += lerp0_LerpDone;
            lerp1.LDone += lerp1_LerpDone;
            lerp2.LDone += lerp2_LerpDone;
        }
Example #3
0
            /// <summary>
            /// Smoothly reveals a window.
            /// </summary>
            /// <param name="WReveal">Window to reveal.</param>
            /// <param name="delay">Delay in ms.</param>
            public static void Reveal(System.Windows.Window WReveal, int delay = 1)
            {
                SINGLE_LerpShow         = new Core.Lerp(0, 1, 0.01f, 0.05f, 1);
                SINGLE_LerpShow.LStart += SINGLE_LerpShow_LerpStart;
                SINGLE_LerpShow.LTick  += SINGLE_LerpShow_LerpTick;
                SINGLE_LerpShow.LDone  += SINGLE_LerpShow_LerpDone;

                HWND         = WReveal;
                HWND.Opacity = 0;
                HWND.Show();
                SINGLE_LerpShow.delay = delay;
                SINGLE_LerpShow.Start();
            }
Example #4
0
            /// <summary>
            /// Smoothly hides/closes a window.
            /// </summary>
            /// <param name="WHide">Window to Hide/Close.</param>
            /// <param name="delay">Delay in ms.</param>
            /// <param name="shouldClose">Close if true, Hide if false.</param>
            public static void Hide(System.Windows.Window WHide, int delay = 1, bool shouldClose = false)
            {
                _shouldClose            = shouldClose;
                SINGLE_LerpFade         = new Core.Lerp(1, 0, 0.01f, 0.05f, 1);
                SINGLE_LerpFade.LStart += SINGLE_LerpFade_LerpStart;
                SINGLE_LerpFade.LTick  += SINGLE_LerpFade_LerpTick;
                SINGLE_LerpFade.LDone  += SINGLE_LerpFade_LerpDone;

                HWND         = WHide;
                HWND.Opacity = 1;
                HWND.Show();
                SINGLE_LerpFade.delay = delay;
                SINGLE_LerpFade.Start();
            }
Example #5
0
        /// <summary>
        /// Lerp between two 2D Vectors.
        /// </summary>
        /// <param name="from">First Vector.</param>
        /// <param name="to">Second Vector.</param>
        /// <param name="alpha">Alpha value.</param>
        /// <param name="delay">Delay between each tick.</param>
        /// <param name="closeness">Minimum closeness of the two vectors.</param>
        public Lerp2D(Vector2D from, Vector2D to, float alpha, int delay, float closeness)
        {
            lerp0.first     = from.X;
            lerp0.second    = to.X;
            lerp0.delay     = delay;
            lerp0.alpha     = alpha;
            lerp0.closeness = closeness;

            lerp1.first     = from.Y;
            lerp1.second    = to.Y;
            lerp1.delay     = delay;
            lerp1.alpha     = alpha;
            lerp1.closeness = closeness;

            lerp0.Start();
            lerp1.Start();

            lerp0.LTick += lerp0_LerpTick;
            lerp1.LTick += lerp1_LerpTick;

            lerp0.LDone += lerp0_LerpDone;
            lerp1.LDone += lerp1_LerpDone;
        }