-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Transform property for Brush class #6344
Add Transform property for Brush class #6344
Conversation
src/Avalonia.Visuals/Animation/Animators/GradientBrushAnimator.cs
Outdated
Show resolved
Hide resolved
Another usage example is animations <Border Width="350" Height="350" Child="{x:Null}">
<Border.Styles>
<Style Selector="Border">
<Style.Animations>
<Animation Duration="0:0:5" IterationCount="Infinite" PlaybackDirection="Normal">
<KeyFrame Cue="0%">
<Setter Property="Background">
<RadialGradientBrush Center="50%,50%" Radius="1.0">
<RadialGradientBrush.Transform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform X="-500" Y="0" />
</TransformGroup>
</RadialGradientBrush.Transform>
<GradientStop Offset="0" Color="Red"/>
<GradientStop Offset="1" Color="Blue"/>
</RadialGradientBrush>
</Setter>
</KeyFrame>
<KeyFrame Cue="50%">
<Setter Property="Background">
<RadialGradientBrush Center="50%,50%" Radius="0.1">
<RadialGradientBrush.Transform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform X="0" Y="0" />
</TransformGroup>
</RadialGradientBrush.Transform>
<GradientStop Offset="0" Color="Red"/>
<GradientStop Offset="1" Color="Blue"/>
</RadialGradientBrush>
</Setter>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Background">
<RadialGradientBrush Center="50%,50%" Radius="1.0">
<RadialGradientBrush.Transform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform X="500" Y="0" />
</TransformGroup>
</RadialGradientBrush.Transform>
<GradientStop Offset="0" Color="Red"/>
<GradientStop Offset="1" Color="Blue"/>
</RadialGradientBrush>
</Setter>
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
</Border.Styles>
</Border> xlvxIg1CtX.mp4 |
src/Avalonia.Visuals/Animation/Animators/GradientBrushAnimator.cs
Outdated
Show resolved
Hide resolved
What's the status on this? I've not been involved in reviewing it; have the questions been resolved? |
@grokys Did not address the questions yet, also implementation needs more testing. |
It would be great to have this feature added. Do we know when it might be ready? I would like to use the VisualBrush to draw lines rather than just tiling a background |
@wieslawsoltes we can leave animation problem for a future, and merge main feature first |
I agree with @maxkatz6, base feature looks fine but animation/transition needs more work that can be done later. One cannot simply interpolate raw matrix values since that does not work for rotations. It works for translation, scale and skew only. Also CSS spec is generally suggesting to do a decomposed matrix interpolation instead since then standard transforms will generally interpolate correctly. https://www.w3.org/TR/css-transforms-1/#interpolation-of-2d-matrices edit: we already have implementations for that used in transform operations based transform. |
Closing due to inactivity and merge conflicts |
You can test this PR using the following package version. |
Removed transform animation and fixed merge conflicts. |
You can test this PR using the following package version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What does the pull request do?
What is the current behavior?
What is the updated/expected behavior with this PR?
How was the solution implemented (if it's not obvious)?
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues
Fixes: #6343
Fixes: #5768