void CreateBlurLayer() { var sprite = _rootVisual.Compositor.CreateSpriteVisual().LinkSize(this); sprite.Brush = CompositionFactory.CreateBlurEffectBrush(_rootVisual.Compositor, 5f); ShadowHost.GetContainerVisual().Children.InsertAtTop(sprite); }
void PlantGrassSeed() { // 1. Create main grass blade var shape = CreateGrassBlade(_grassShape); // 2. Set relative positions var percent = _rand.Next(0, 10000) / 10000d; shape.StartAnimation(_grassOffset.SetParameter("percent", percent)); // 3. Start animating ApplyWind(shape); // 4. Add to visual tree BladesHost.GetContainerVisual().Children.InsertAtTop(shape); // 5. Create the shadow for the blade var shadow = CreateGrassBlade(_shadowShape); shadow.RotationAxis = Vector3.UnitZ; shadow.Scale = shape.Scale; shadow.StartAnimation(_shadowOffset.SetParameter("Caster", shape)); shadow.StartAnimation(_shadowRotation.SetParameter("Caster", shape)); // 6. Add shadow to tree. ShadowHost.GetContainerVisual().Children.InsertAtTop(shadow); }