File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -431,7 +431,7 @@ static CompositionColorBrush TranslateBoundSolidColor(
431431
432432 if ( ! offset . IsAnimated && ! value . IsAnimated )
433433 {
434- return ConvertTo . Vector2 ( value . InitialValue ) + offset . OffsetValue ! ;
434+ return ConvertTo . Vector2 ( value . InitialValue ) + offset . OffsetValue ;
435435 }
436436
437437 // Animate source property first.
@@ -443,8 +443,8 @@ static CompositionColorBrush TranslateBoundSolidColor(
443443
444444 // Create expression that offsets source property by origin offset.
445445 WinCompData . Expressions . Vector2 expression = offset . IsAnimated ?
446- ExpressionFactory . OriginOffsetExressionAdded ( sourcePropertyName , offset . OffsetExpression ! ) :
447- ExpressionFactory . OriginOffsetValueAdded ( sourcePropertyName , ( Sn . Vector2 ) offset . OffsetValue ! ) ;
446+ ExpressionFactory . OriginOffsetExressionAdded ( sourcePropertyName , offset . OffsetExpression ) :
447+ ExpressionFactory . OriginOffsetValueAdded ( sourcePropertyName , offset . OffsetValue ) ;
448448
449449 var expressionAnimation = context . ObjectFactory . CreateExpressionAnimation ( expression ) ;
450450 expressionAnimation . SetReferenceParameter ( "my" , obj ) ;
Original file line number Diff line number Diff line change @@ -26,24 +26,28 @@ public class OriginOffsetContainer
2626 public RectangleOrRoundedRectangleGeometry Geometry { get ; }
2727
2828 // Use expression if size is animated
29- public WinCompData . Expressions . Vector2 ? OffsetExpression { get ; }
29+ public WinCompData . Expressions . Vector2 OffsetExpression { get ; }
3030
3131 // Use constant value if size is static
32- public Sn . Vector2 ? OffsetValue { get ; }
32+ public Sn . Vector2 OffsetValue { get ; }
3333
34- public bool IsAnimated => OffsetValue is null ;
34+ // IsAnimated = true means that we have to use OffsetExpression.
35+ // IsAnimated = false means that we can use OffsetValue instead of OffsetExpression to optimize the code.
36+ public bool IsAnimated { get ; }
3537
3638 public OriginOffsetContainer ( RectangleOrRoundedRectangleGeometry geometry , WinCompData . Expressions . Vector2 expression )
3739 {
40+ IsAnimated = true ;
3841 Geometry = geometry ;
3942 OffsetExpression = expression ;
40- OffsetValue = null ;
43+ OffsetValue = new Sn . Vector2 ( 0 , 0 ) ;
4144 }
4245
4346 public OriginOffsetContainer ( RectangleOrRoundedRectangleGeometry geometry , Sn . Vector2 value )
4447 {
48+ IsAnimated = false ;
4549 Geometry = geometry ;
46- OffsetExpression = null ;
50+ OffsetExpression = new WinCompData . Expressions . Vector2 . Constructed ( value . X , value . Y ) ;
4751 OffsetValue = value ;
4852 }
4953 }
You can’t perform that action at this time.
0 commit comments