Skip to content
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

Merged
merged 8 commits into from
May 22, 2019
Merged

Setting Opacity transforms on layer. #121

merged 8 commits into from
May 22, 2019

Conversation

plaiMS
Copy link
Contributor

@plaiMS plaiMS commented May 20, 2019

No description provided.

@@ -759,6 +789,8 @@ sealed class ShapeContentContext
{
readonly LottieToWinCompTranslator _owner;

static readonly Animatable<double> s_defaultOpacityPercent = new Animatable<double>(100, null);
Copy link
Contributor

@simeoncran simeoncran May 21, 2019

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)
Copy link
Contributor

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.
Copy link
Contributor

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

Copy link
Contributor

@simeoncran simeoncran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Copy link
Contributor

@simeoncran simeoncran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

simeoncran
simeoncran previously approved these changes May 21, 2019
Copy link
Contributor

@simeoncran simeoncran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Copy link
Contributor

@simeoncran simeoncran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@plaiMS plaiMS merged commit f8b21d4 into master May 22, 2019
@delete-merged-branch delete-merged-branch bot deleted the OpacityOnLayer branch May 22, 2019 04:21
@michael-hawker michael-hawker added this to the 6.0 milestone Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants