コード例 #1
0
        private void InitializeCompositionVariables()
        {
            var bounds          = ApplicationView.GetForCurrentView().VisibleBounds;
            var maxWindowWidth  = bounds.Width.ToFloat();
            var maxWindowHeight = bounds.Height.ToFloat();
            var maxWindowRadius = Math.Max(maxWindowWidth, maxWindowHeight);

            // Setup sky visual's size, position, opacity, etc.
            _skyVisual             = Sky.ContainerVisual();
            _skyVisual.Size        = new Vector2(maxWindowRadius * SkyVisualAreaRatio);
            _skyVisual.Offset      = new Vector3(-SkyVisualRadius + maxWindowWidth / 2.0f, -SkyVisualRadius + maxWindowHeight / 2.0f, 0.0f);
            _skyVisual.CenterPoint = new Vector3(SkyVisualRadius, SkyVisualRadius, 0.0f);
            _skyVisual.Opacity     = 0;

            _compositor = _skyVisual.Compositor;
            _reading    = _compositor.CreatePropertySet();
            _reading.InsertVector3("Offset", new Vector3(0.0f, 0.0f, 0.0f));
            _imageLoader         = ImageLoaderFactory.CreateImageLoader(_compositor);
            _circleBrush         = _compositor.CreateSurfaceBrush();
            _circleBrush.Surface = _imageLoader.LoadImageFromUri(new Uri(StarUriString));

            if (_inclinometer != null)
            {
                SetupSkyVisualOffsetExpressionAnimation();
            }
        }