-
Notifications
You must be signed in to change notification settings - Fork 73
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
Setting Opacity transforms on layer. #121
Conversation
@@ -759,6 +789,8 @@ sealed class ShapeContentContext | |||
{ | |||
readonly LottieToWinCompTranslator _owner; | |||
|
|||
static readonly Animatable<double> s_defaultOpacityPercent = new Animatable<double>(100, null); |
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.
Reorder - statics fields before non-static.
Naming - "default" isn't telling the reader anything useful here. And the fact that we use it for Opacity isn't significant - we could use it for other things. s_100Percent would do nicely. And add a comment in the constructor explaining that we assuming 100% opacity until told otherwise. #Resolved
@@ -880,12 +913,12 @@ internal void SetTransform(Transform transform) | |||
|
|||
Animatable<double> ComposeOpacityPercents(Animatable<double> a, Animatable<double> b) | |||
{ | |||
if (a == null) | |||
if (a == null || a == s_defaultOpacityPercent) |
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.
object.ReferenceEquals(a, s_defaultOpacityPercent). The goal is to short-circuit the check if someone passed in our special default value object, not to actually compare the value (which might be expensive). #Closed
rectangle.FillBrush = CreateAnimatedColorBrush(context, layer.Color, context.TrimAnimatable(layer.Transform.OpacityPercent)); | ||
// If the layer has masks then the opacity is set on a Visual in the chain returned | ||
// for the layer from TryCreateContainerVisualTransformChain. | ||
// If there is no masks then the opacity needs to be animated on the brush. |
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.
"If that layer has no masks, opacity is implemented via the alpha channel on the brush." #Closed
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.
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.
🕐
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.
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.
No description provided.