Repository navigation
Gradient fill for rectangle(rounded rectangle) shape fixed - #450
Conversation
|
Ok, so I moved OriginOffset to ShapeLayerContainer, now it looks kind of better in Brushes.cs, Shapes.cs. But now we have this weird line (Rectangles.cs:333) In reply to: 860911730 |
|
In TranslateAndApplyShapeContextWithTrimOffset in Shapes.cs before you call "Brushes.TranslateAndApplyStroke(context, context.Stroke, shape, context.Opacity);" Do you need to call do the clearing out of OriginOffset here instead? It looks like TranslateAndApplyStroke can hit the linear gradient code but I assume it does not need the offset stuff factored in. If you do put the clearing here then also put a comment about how the offset is only needed for shape fills. In reply to: 860911730 |
Agree, done In reply to: 860968161 |
Because of the difference in how gradient fill for rectangles works in WinComp API and Lottie, previously it was displayed incorrectly.
WinComp API uses top left corner of rectangle as point [0, 0] while Lottie uses middle-middle instead. To account for this difference we need to add (Rectangle.Size/2) to Start and End points of gradients. We can't add a constant value since Rectangle.Size can also be animated, and if it is animated, we need to use expression animation.
In this change, I added InternalOffset class for rectangle shapes, which propagates information about offset to the gradients and then this offset is applied to Start and End points.
Examples below show how it works now:
Lottie-windows old
Lottie web viewer (https://lottiefiles.com/preview)
Lottie-windows with this PR