public TestSceneBufferedContainer() { Remove(TestContainer); BufferedContainer buffer; Add(buffer = new BufferedContainer { RelativeSizeAxes = Axes.Both, Children = new[] { TestContainer } }); AddSliderStep("blur", 0f, 20f, 0f, blur => { buffer.BlurTo(new Vector2(blur)); }); AddSliderStep("fbo scale (x)", 0.01f, 4f, 1f, scale => { buffer.FrameBufferScale = new Vector2(scale, buffer.FrameBufferScale.Y); }); AddSliderStep("fbo scale (y)", 0.01f, 4f, 1f, scale => { buffer.FrameBufferScale = new Vector2(buffer.FrameBufferScale.X, scale); }); }
/// <summary> /// Smoothly adjusts <see cref="IBufferedContainer.BlurSigma"/> over time. /// </summary> /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> public void BlurTo(Vector2 newBlurSigma, double duration = 0, Easing easing = Easing.None) { if (bufferedContainer == null && newBlurSigma != Vector2.Zero) { RemoveInternal(Sprite); AddInternal(bufferedContainer = new BufferedContainer { CacheDrawnFrameBuffer = true, RelativeSizeAxes = Axes.Both, Child = Sprite }); } bufferedContainer?.BlurTo(newBlurSigma, duration, easing); }
/// <summary> /// Smoothly adjusts <see cref="IBufferedContainer.BlurSigma"/> over time. /// </summary> /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> public void BlurTo(Vector2 newBlurSigma, double duration = 0, Easing easing = Easing.None) { if (bufferedContainer == null && newBlurSigma != Vector2.Zero) { RemoveInternal(Sprite); AddInternal(bufferedContainer = new BufferedContainer { RelativeSizeAxes = Axes.Both, CacheDrawnFrameBuffer = true, RedrawOnScale = false, Child = Sprite }); } if (bufferedContainer != null) bufferedContainer.FrameBufferScale = newBlurSigma == Vector2.Zero ? Vector2.One : new Vector2(blur_scale); bufferedContainer?.BlurTo(newBlurSigma * blur_scale, duration, easing); }
protected override void LoadComplete() { base.LoadComplete(); buffer.BlurTo(new Vector2(20), 1000).Then().BlurTo(Vector2.Zero, 1000).Loop(); }