You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I created a composition animation using a CompositionCustomVisualHandler like in ControlCatalog. I basically draw a rectangle with a gradient brush. When I use an X-offset in DrawRectangle the gradient always stays static in the the original / wrong position. Only when I use a push transform and then draw the rectangle without offset, the visualization is correct.
Desktop (please complete the following information):
OS: Windows 10
Version: 11.0.0-preview6
Additional context
Please find this portion of code in the sample app:
publicoverridevoidOnRender(ImmediateDrawingContextdrawingContext){if(_running){if(_lastServerTime.HasValue){_animationElapsed+=(CompositionNow.TotalMilliseconds-_lastServerTime.Value);_animationElapsed%=_animationLength;}_lastServerTime=CompositionNow.TotalMilliseconds;}doubleborderWidth=EffectiveSize.X;doubleborderHeight=EffectiveSize.Y;doubleindicatorWidth=256;doubleanimationStage=_animationElapsed/_animationLength;doubleoffsetX=(borderWidth+indicatorWidth)*animationStage-indicatorWidth;// Gradient brush only works using push transform// if used without push transform and Rect with// offset instead, the rendering is wrong. The gradient seems// to be stuck at the original position.using(drawingContext.PushPreTransform(Matrix.CreateTranslation(offsetX,0))){drawingContext.DrawRectangle(_brush,null,newRect(0,0,indicatorWidth,borderHeight));}// uncomment below to get the wrong rendering//drawingContext.DrawRectangle(_brush, null, new Rect(offsetX, 0, indicatorWidth, borderHeight));}
The text was updated successfully, but these errors were encountered:
Ok. I understand. So, in the upper sample, where I used 0 and 1 as relative coordinates for the brush, would push transform be the way to go or would you rather create the brush with absolute coordinates including the rect x-offset?
Describe the bug
I created a composition animation using a
CompositionCustomVisualHandler
like in ControlCatalog. I basically draw a rectangle with a gradient brush. When I use an X-offset inDrawRectangle
the gradient always stays static in the the original / wrong position. Only when I use a push transform and then draw the rectangle without offset, the visualization is correct.To Reproduce
Steps to reproduce the behavior:
Expected behavior
I would expect the gradient brush to "move" with the rectangle and render correctly in both ways of the sample app.
Videos
Correct:
https://user-images.githubusercontent.com/31031996/230961029-061456fd-c544-4fb8-9eac-81c7a7c2ff24.mp4
Incorrect:
https://user-images.githubusercontent.com/31031996/230960984-1b1b7309-70d0-4a97-979c-34b8deb4d9a3.mp4
Desktop (please complete the following information):
Additional context
Please find this portion of code in the sample app:
The text was updated successfully, but these errors were encountered: