예제 #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            m_renderContext.AddView(m_view2D = new View());
            m_renderContext.AddView(m_view3D = new View());

            m_topLeft = new RectangleGeometry(250f, 250f, new Color32(1f, 1f, 1f, .5f))
            {
                Origin = new Vector3(125f, 125f, 0f),
            };

            m_cuboid = new Cuboid(Color32.Lime, 1f, 1f, 1f)
            {
                Origin = new Vector3(0.5f)
            };
            m_view2D.AddDrawable(m_topLeft);
            m_view3D.AddDrawable(m_cuboid);
            m_renderContext.Animator.Start(
                x => m_topLeft.Rotation = Quaternion.FromAxisAngle(new Vector3(0f, 0f, 1f), (float)(x * Math.PI * 2d)),
                TimeSpan.FromSeconds(2.5d), LoopMode.Restart, EasingFunctions.Linear);
            m_renderContext.Animator.Start(x => m_topLeft.Origin = (float)x * new Vector3(m_topLeft.Width, m_topLeft.Height, 0f),
                                           TimeSpan.FromSeconds(3.33d), LoopMode.Reverse, EasingFunctions.QuadraticInOut);
            LoadTestTexture();
        }