/// <summary> /// Implements the * operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static QuaternionNode operator *(QuaternionNode left, QuaternionNode right) { return(ExpressionFunctions.Function <QuaternionNode>(ExpressionNodeType.Multiply, left, right)); }
/// <summary> /// Implements the != operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static BooleanNode operator !=(Matrix3x2Node left, Matrix3x2Node right) { return(ExpressionFunctions.Function <BooleanNode>(ExpressionNodeType.NotEquals, left, right)); }
/// <summary> /// Implements the - operator. /// </summary> /// <param name="value">The value.</param> /// <returns>The result of the operator.</returns> public static Matrix3x2Node operator -(Matrix3x2Node value) { return(ExpressionFunctions.Function <Matrix3x2Node>(ExpressionNodeType.Negate, value)); }
// Generate a new lookup function based on one lookup function private EvaluatorLookup CustomizedEvaluatorLookup(EvaluatorLookup baseLookup) => (string name) => { var standardFunction = baseLookup(name); if (standardFunction != null) { return(standardFunction); } if (name.StartsWith("lg.")) { name = name.Substring(3); } var templateName = ParseTemplateName(name).pureTemplateName; if (this.TemplateMap.ContainsKey(templateName)) { return(new ExpressionEvaluator(templateName, ExpressionFunctions.Apply(this.TemplateEvaluator(name)), ReturnType.Object, this.ValidTemplateReference)); } const string template = "template"; if (name.Equals(template)) { return(new ExpressionEvaluator(template, ExpressionFunctions.Apply(this.TemplateFunction()), ReturnType.Object, this.ValidateTemplateFunction)); } const string fromFile = "fromFile"; if (name.Equals(fromFile)) { return(new ExpressionEvaluator(fromFile, ExpressionFunctions.Apply(this.FromFile()), ReturnType.String, ExpressionFunctions.ValidateUnaryString)); } const string activityAttachment = "ActivityAttachment"; if (name.Equals(activityAttachment)) { return(new ExpressionEvaluator( activityAttachment, ExpressionFunctions.Apply(this.ActivityAttachment()), ReturnType.Object, (expr) => ExpressionFunctions.ValidateOrder(expr, null, ReturnType.Object, ReturnType.String))); } const string isTemplate = "isTemplate"; if (name.Equals(isTemplate)) { return(new ExpressionEvaluator(isTemplate, ExpressionFunctions.Apply(this.IsTemplate()), ReturnType.Boolean, ExpressionFunctions.ValidateUnaryString)); } const string expandText = "expandText"; if (name.Equals(expandText)) { return(new ExpressionEvaluator(expandText, ExpressionFunctions.Apply(this.ExpandText()), ReturnType.Object, ExpressionFunctions.ValidateUnaryString)); } return(null); };
private void MainInformationPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar; formattableTitleBar.ButtonBackgroundColor = Colors.Transparent; formattableTitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar; coreTitleBar.ExtendViewIntoTitleBar = true; // Update the ZIndex of the header container so that the header is above the items when scrolling Canvas.SetZIndex(Header, 1); // Get the PropertySet that contains the scroll values from the ScrollViewer _scrollerPropertySet = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(scrollViewer); _compositor = _scrollerPropertySet.Compositor; // Create a PropertySet that has values to be referenced in the ExpressionAnimations below _props = _compositor.CreatePropertySet(); _props.InsertScalar("progress", 0); _props.InsertScalar("clampSize", 150); _props.InsertScalar("scaleFactor", 0.7f); // Get references to our property sets for use with ExpressionNodes var scrollingProperties = _scrollerPropertySet.GetSpecializedReference <ManipulationPropertySetReferenceNode>(); var props = _props.GetReference(); var progressNode = props.GetScalarProperty("progress"); var clampSizeNode = props.GetScalarProperty("clampSize"); // Create and start an ExpressionAnimation to track scroll progress over the desired distance ExpressionNode progressAnimation = ExpressionFunctions.Clamp(-scrollingProperties.Translation.Y / clampSizeNode, 0, 1); _props.StartAnimation("progress", progressAnimation); // Get the backing visual for the header so that its properties can be animated headerVisual = ElementCompositionPreview.GetElementVisual(Header); // Create and start an ExpressionAnimation to clamp the header's offset to keep it onscreen ExpressionNode headerTranslationAnimation = ExpressionFunctions.Conditional(progressNode < 1, 0, -scrollingProperties.Translation.Y - clampSizeNode); headerVisual.StartAnimation("Offset.Y", headerTranslationAnimation); // Create and start an ExpressionAnimation to scale the header during overpan ExpressionNode headerScaleAnimation = ExpressionFunctions.Lerp(1, 1.25f, ExpressionFunctions.Clamp(scrollingProperties.Translation.Y / 50, 0, 1)); headerVisual.StartAnimation("Scale.X", headerScaleAnimation); headerVisual.StartAnimation("Scale.Y", headerScaleAnimation); //Set the header's CenterPoint to ensure the overpan scale looks as desired headerVisual.CenterPoint = new Vector3((float)(Header.ActualWidth / 2), (float)Header.ActualHeight, 0); ExpressionNode OpacityAnimation = ExpressionFunctions.Clamp(1 - (progressNode * 2), 0, 1); Visual profileVisual = ElementCompositionPreview.GetElementVisual(ProfileImage); profileVisual.StartAnimation("Opacity", OpacityAnimation); Visual subtitleVisual = ElementCompositionPreview.GetElementVisual(SubtitleBlock); subtitleVisual.StartAnimation("Opacity", OpacityAnimation); // Get the backing visuals for the text and button containers so that their properites can be animated Visual buttonVisual = ElementCompositionPreview.GetElementVisual(ButtonPanel); ExpressionNode buttonOffsetAnimation = progressNode * -14; buttonVisual.StartAnimation("Offset.Y", buttonOffsetAnimation); }
private string GetOperationString() { return(ExpressionFunctions.GetNodeInfoFromType(NodeType).OperationString); }
/// <summary> /// Uses Composition API to get the UIElement and sets an ExpressionAnimation /// The ExpressionAnimation uses the height of the UIElement to calculate an opacity value /// for the Header as it is scrolling off-screen. The opacity reaches 0 when the Header /// is entirely scrolled off. /// </summary> /// <returns><c>true</c> if the assignment was successful; otherwise, <c>false</c>.</returns> private bool AssignAnimation() { StopAnimation(); if (AssociatedObject == null) { return(false); } if (_scrollViewer == null) { _scrollViewer = AssociatedObject as ScrollViewer ?? AssociatedObject.FindDescendant <ScrollViewer>(); } if (_scrollViewer == null) { return(false); } var listView = AssociatedObject as Windows.UI.Xaml.Controls.ListViewBase ?? AssociatedObject.FindDescendant <Windows.UI.Xaml.Controls.ListViewBase>(); if (listView != null && listView.ItemsPanelRoot != null) { Canvas.SetZIndex(listView.ItemsPanelRoot, -1); } if (_scrollProperties == null) { _scrollProperties = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(_scrollViewer); } if (_scrollProperties == null) { return(false); } // Implicit operation: Find the Header object of the control if it uses ListViewBase if (HeaderElement == null && listView != null) { HeaderElement = listView.Header as UIElement; } var headerElement = HeaderElement as FrameworkElement; if (headerElement == null || headerElement.RenderSize.Height == 0) { return(false); } if (_headerVisual == null) { _headerVisual = ElementCompositionPreview.GetElementVisual(headerElement); } if (_headerVisual == null) { return(false); } headerElement.SizeChanged -= ScrollHeader_SizeChanged; headerElement.SizeChanged += ScrollHeader_SizeChanged; _scrollViewer.GotFocus -= ScrollViewer_GotFocus; _scrollViewer.GotFocus += ScrollViewer_GotFocus; var compositor = _scrollProperties.Compositor; if (_animationProperties == null) { _animationProperties = compositor.CreatePropertySet(); _animationProperties.InsertScalar("OffsetY", 0.0f); } _previousVerticalScrollOffset = _scrollViewer.VerticalOffset; var propSetOffset = _animationProperties.GetReference().GetScalarProperty("OffsetY"); var scrollPropSet = _scrollProperties.GetSpecializedReference <ManipulationPropertySetReferenceNode>(); var expressionAnimation = ExpressionFunctions.Max(propSetOffset - scrollPropSet.Translation.Y, 0); _headerVisual.StartAnimation("Offset.Y", expressionAnimation); return(true); }
/// <summary> /// Implements the <= operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static BooleanNode operator <=(ScalarNode left, ScalarNode right) { return(ExpressionFunctions.Function <BooleanNode>(ExpressionNodeType.LessThanEquals, left, right)); }
/// <summary> /// Implements the > operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static BooleanNode operator >(ScalarNode left, ScalarNode right) { return(ExpressionFunctions.Function <BooleanNode>(ExpressionNodeType.GreaterThan, left, right)); }
/// <summary> /// Implements the / operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static ScalarNode operator /(ScalarNode left, ScalarNode right) { return(ExpressionFunctions.Function <ScalarNode>(ExpressionNodeType.Divide, left, right)); }
/// <summary> /// Implements the % operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static ScalarNode operator %(ScalarNode left, ScalarNode right) { return(ExpressionFunctions.Function <ScalarNode>(ExpressionNodeType.Modulus, left, right)); }
/// <summary> /// Implements the * operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static ScalarNode operator *(ScalarNode left, ScalarNode right) { return(ExpressionFunctions.Function <ScalarNode>(ExpressionNodeType.Multiply, left, right)); }
/// <summary> /// Implements the - operator. /// </summary> /// <param name="value">The value.</param> /// <returns>The result of the operator.</returns> public static ScalarNode operator -(ScalarNode value) { return(ExpressionFunctions.Function <ScalarNode>(ExpressionNodeType.Negate, value)); }
// In this simple object scope, we don't allow you to set a path in which some parts in middle don't exist // for example // if you set dialog.a.b = x, but dialog.a don't exist, this will result in an error // because we can't and shouldn't smart create structure in the middle // you can implement a customized Scope that support such behavior /// <summary> /// Set value to a given path. /// </summary> /// <param name="path">Memory path.</param> /// <param name="value">Value to set.</param> public void SetValue(string path, object value) { if (memory == null) { return; } var parts = path.Split(".[]".ToCharArray(), StringSplitOptions.RemoveEmptyEntries) .Select(x => x.Trim('\'', '"')) .ToArray(); var curScope = memory; var curPath = string.Empty; // valid path so far string error = null; // find the 2nd last value, the container for (var i = 0; i < parts.Length - 1; i++) { if (int.TryParse(parts[i], out var index) && ExpressionFunctions.TryParseList(curScope, out var li)) { curPath += $"[{parts[i]}]"; (curScope, error) = ExpressionFunctions.AccessIndex(li, index); } else { curPath += $".{parts[i]}"; if (ExpressionFunctions.TryAccessProperty(curScope, parts[i], out var newScope)) { curScope = newScope; } else { return; } } if (error != null || curScope == null) { return; } } // set the last value if (int.TryParse(parts.Last(), out var idx)) { if (ExpressionFunctions.TryParseList(curScope, out var li)) { if (li is JArray) { value = JToken.FromObject(value); } if (idx > li.Count) { error = $"{idx} index out of range"; } else if (idx == li.Count) { // expand for one li.Add(value); } else { li[idx] = value; } } else { error = $"set value for an index to a non-list object"; } if (error != null) { return; } } else { (_, error) = ExpressionFunctions.SetProperty(curScope, parts.Last(), value); if (error != null) { return; } } // Update the version once memory has been updated version++; }
/// <summary> /// Uses Composition API to get the UIElement and sets an ExpressionAnimation /// The ExpressionAnimation uses the height of the UIElement to calculate an opacity value /// for the Header as it is scrolling off-screen. The opacity reaches 0 when the Header /// is entirely scrolled off. /// </summary> /// <returns><c>true</c> if the assignment was successful; otherwise, <c>false</c>.</returns> private bool AssignAnimation() { StopAnimation(); // Confirm that Windows.UI.Xaml.Hosting.ElementCompositionPreview is available (Windows 10 10586 or later). if (!ApiInformation.IsMethodPresent("Windows.UI.Xaml.Hosting.ElementCompositionPreview", nameof(ElementCompositionPreview.GetScrollViewerManipulationPropertySet))) { // Just return true since it's not supported return(true); } if (AssociatedObject == null) { return(false); } if (_scrollViewer == null) { _scrollViewer = AssociatedObject as ScrollViewer ?? AssociatedObject.FindDescendant <ScrollViewer>(); } if (_scrollViewer == null) { return(false); } var listView = AssociatedObject as Windows.UI.Xaml.Controls.ListViewBase ?? AssociatedObject.FindDescendant <Windows.UI.Xaml.Controls.ListViewBase>(); if (listView != null && listView.ItemsPanelRoot != null) { Canvas.SetZIndex(listView.ItemsPanelRoot, -1); } if (_scrollProperties == null) { _scrollProperties = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(_scrollViewer); } if (_scrollProperties == null) { return(false); } // Implicit operation: Find the Header object of the control if it uses ListViewBase if (HeaderElement == null && listView != null) { HeaderElement = listView.Header as UIElement; } var headerElement = HeaderElement as FrameworkElement; if (headerElement == null || headerElement.RenderSize.Height == 0) { return(false); } if (_headerVisual == null) { _headerVisual = ElementCompositionPreview.GetElementVisual(headerElement); } if (_headerVisual == null) { return(false); } _scrollViewer.ViewChanged -= ScrollViewer_ViewChanged; _scrollViewer.ViewChanged += ScrollViewer_ViewChanged; _scrollViewer.GotFocus -= ScrollViewer_GotFocus; _scrollViewer.GotFocus += ScrollViewer_GotFocus; headerElement.SizeChanged -= ScrollHeader_SizeChanged; headerElement.SizeChanged += ScrollHeader_SizeChanged; var compositor = _scrollProperties.Compositor; if (_animationProperties == null) { _animationProperties = compositor.CreatePropertySet(); _animationProperties.InsertScalar("OffsetY", 0.0f); } var propSetOffset = _animationProperties.GetReference().GetScalarProperty("OffsetY"); var scrollPropSet = _scrollProperties.GetSpecializedReference <ManipulationPropertySetReferenceNode>(); var expressionAnimation = ExpressionFunctions.Max(ExpressionFunctions.Min(propSetOffset, -scrollPropSet.Translation.Y), 0); _headerVisual.StartAnimation("Offset.Y", expressionAnimation); return(true); }
/// <summary> /// Implements the - operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static ScalarNode operator -(ScalarNode left, ScalarNode right) { return(ExpressionFunctions.Function <ScalarNode>(ExpressionNodeType.Subtract, left, right)); }
private OperationType GetOperationKind() { return(ExpressionFunctions.GetNodeInfoFromType(NodeType).NodeOperationKind); }
/// <summary> /// Implements the - operator. /// </summary> /// <param name="value">The value.</param> /// <returns>The result of the operator.</returns> public static Vector4Node operator -(Vector4Node value) { return(ExpressionFunctions.Function <Vector4Node>(ExpressionNodeType.Negate, value)); }
/// <summary> /// Creation of an expression to manage modulo (positive and negative value) /// </summary> /// <param name="scrollViewer">The ScrollViewer to synchronized. A null value is valid</param> /// <param name="imageWidth">Width of the image</param> /// <param name="imageHeight">Height of the image</param> /// <param name="scrollOrientation">The ScrollOrientation</param> private void CreateModuloExpression(ScrollViewer scrollViewer, double imageWidth, double imageHeight, ScrollOrientation scrollOrientation) { const string offsetXParam = "offsetX"; const string offsetYParam = "offsetY"; const string imageWidthParam = "imageWidth"; const string imageHeightParam = "imageHeight"; const string speedParam = "speed"; if (_containerVisual == null) { return; } var compositor = _containerVisual.Compositor; // Setup the expression ExpressionNode expressionX = null; ExpressionNode expressionY = null; ExpressionNode expressionXVal; ExpressionNode expressionYVal; var propertySetModulo = compositor.CreatePropertySet(); propertySetModulo.InsertScalar(imageWidthParam, (float)imageWidth); propertySetModulo.InsertScalar(offsetXParam, (float)OffsetX); propertySetModulo.InsertScalar(imageHeightParam, (float)imageHeight); propertySetModulo.InsertScalar(offsetYParam, (float)OffsetY); propertySetModulo.InsertScalar(speedParam, (float)ParallaxSpeedRatio); var propertySetNodeModulo = propertySetModulo.GetReference(); var imageHeightNode = propertySetNodeModulo.GetScalarProperty(imageHeightParam); var imageWidthNode = propertySetNodeModulo.GetScalarProperty(imageWidthParam); if (scrollViewer == null) { var offsetXNode = ExpressionFunctions.Ceil(propertySetNodeModulo.GetScalarProperty(offsetXParam)); var offsetYNode = ExpressionFunctions.Ceil(propertySetNodeModulo.GetScalarProperty(offsetYParam)); // expressions are created to simulate a positive and negative modulo with the size of the image and the offset expressionXVal = ExpressionFunctions.Conditional( offsetXNode == 0, 0, ExpressionFunctions.Conditional( offsetXNode < 0, -(ExpressionFunctions.Abs(offsetXNode - (ExpressionFunctions.Ceil(offsetXNode / imageWidthNode) * imageWidthNode)) % imageWidthNode), -(imageWidthNode - (offsetXNode % imageWidthNode)))); expressionYVal = ExpressionFunctions.Conditional( offsetYNode == 0, 0, ExpressionFunctions.Conditional( offsetYNode < 0, -(ExpressionFunctions.Abs(offsetYNode - (ExpressionFunctions.Ceil(offsetYNode / imageHeightNode) * imageHeightNode)) % imageHeightNode), -(imageHeightNode - (offsetYNode % imageHeightNode)))); } else { // expressions are created to simulate a positive and negative modulo with the size of the image and the offset and the ScrollViewer offset (Translation) var scrollProperties = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(scrollViewer); var scrollPropSet = scrollProperties.GetSpecializedReference <ManipulationPropertySetReferenceNode>(); var speed = propertySetNodeModulo.GetScalarProperty(speedParam); var xCommon = ExpressionFunctions.Ceil((scrollPropSet.Translation.X * speed) + propertySetNodeModulo.GetScalarProperty(offsetXParam)); expressionXVal = ExpressionFunctions.Conditional( xCommon == 0, 0, ExpressionFunctions.Conditional( xCommon < 0, -(ExpressionFunctions.Abs(xCommon - (ExpressionFunctions.Ceil(xCommon / imageWidthNode) * imageWidthNode)) % imageWidthNode), -(imageWidthNode - (xCommon % imageWidthNode)))); var yCommon = ExpressionFunctions.Ceil((scrollPropSet.Translation.Y * speed) + propertySetNodeModulo.GetScalarProperty(offsetYParam)); expressionYVal = ExpressionFunctions.Conditional( yCommon == 0, 0, ExpressionFunctions.Conditional( yCommon < 0, -(ExpressionFunctions.Abs(yCommon - (ExpressionFunctions.Ceil(yCommon / imageHeightNode) * imageHeightNode)) % imageHeightNode), -(imageHeightNode - (yCommon % imageHeightNode)))); } if (scrollOrientation == ScrollOrientation.Horizontal || scrollOrientation == ScrollOrientation.Both) { expressionX = expressionXVal; if (scrollOrientation == ScrollOrientation.Horizontal) { // In horizontal mode we never move the offset y expressionY = (ScalarNode)0.0f; _containerVisual.Offset = new Vector3((float)OffsetY, 0, 0); } } if (scrollOrientation == ScrollOrientation.Vertical || scrollOrientation == ScrollOrientation.Both) { expressionY = expressionYVal; if (scrollOrientation == ScrollOrientation.Vertical) { // In vertical mode we never move the offset x expressionX = (ScalarNode)0.0f; _containerVisual.Offset = new Vector3(0, (float)OffsetX, 0); } } _containerVisual.StopAnimation("Offset.X"); _containerVisual.StopAnimation("Offset.Y"); _containerVisual.StartAnimation("Offset.X", expressionX); _containerVisual.StartAnimation("Offset.Y", expressionY); _propertySetModulo = propertySetModulo; }
/// <summary> /// Implements the / operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static Vector4Node operator /(Vector4Node left, Vector4Node right) { return(ExpressionFunctions.Function <Vector4Node>(ExpressionNodeType.Divide, left, right)); }
/// <summary> /// Initializes a new instance of the <see cref="Expression"/> class. /// Built-in expression constructor. /// </summary> /// <param name="type">Type of built-in expression from <see cref="ExpressionType"/>.</param> /// <param name="children">Child expressions.</param> public Expression(string type, params Expression[] children) { Evaluator = ExpressionFunctions.Lookup(type); Children = children; }
/// <summary> /// Implements the % operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static Vector4Node operator %(Vector4Node left, Vector4Node right) { return(ExpressionFunctions.Function <Vector4Node>(ExpressionNodeType.Modulus, left, right)); }
private Line CreateAnchor(UIElement element, double x, double y) { var anchor = new Line() { X1 = 0, Y1 = 0, X2 = 80, Y2 = 0 }; SetAnchorProperties(anchor); var anchorVisual = ElementCompositionPreview.GetElementVisual(anchor); var elementVisual = ElementCompositionPreview.GetElementVisual(element); var centerVisual = ElementCompositionPreview.GetElementVisual(_centerContent); var elementNode = elementVisual.GetReference(); var centerNode = centerVisual.GetReference(); ScalarNode expression = null; var elementY = elementNode.Offset.Y + (elementNode.Size.Y / 2); var centerY = centerNode.Offset.Y + (centerNode.Size.Y / 2); var elementX = elementNode.Offset.X + (elementNode.Size.X / 2); var centerX = centerNode.Offset.X + (centerNode.Size.X / 2); var startingAngle = Math.Atan2(y, x); if (startingAngle > Math.PI / 4 && startingAngle < 3 * Math.PI / 4) { expression = ExpressionFunctions.ATan((-1 * (elementX - centerX)) / (elementY - centerY)) - ((float)Math.PI / 2.0f); } else if (startingAngle >= 3 * Math.PI / 4 || startingAngle < -3 * Math.PI / 4) { expression = ExpressionFunctions.ATan((elementY - centerY) / (elementX - centerX)) + (float)Math.PI; } else if (startingAngle >= -3 * Math.PI / 4 && startingAngle < Math.PI / -4) { expression = ExpressionFunctions.ATan((elementX - centerX) / (-1 * (elementY - centerY))) + ((float)Math.PI / 2.0f); } else { expression = ExpressionFunctions.ATan((elementY - centerY) / (elementX - centerX)); } anchorVisual.CenterPoint = new Vector3(0); anchorVisual.StartAnimation(nameof(anchorVisual.RotationAngle), expression); var offsetExpression = ExpressionFunctions.Vector3(centerNode.Offset.X + (centerNode.Size.X / 2), centerNode.Offset.Y + (centerNode.Size.Y / 2), 0); anchorVisual.StartAnimation(nameof(anchorVisual.Offset), offsetExpression); var scaleExpression = ExpressionFunctions.Vector3(ExpressionFunctions.Pow(ExpressionFunctions.Pow(elementX - centerX, 2) + ExpressionFunctions.Pow(elementY - centerY, 2), 0.5f) / 80, 1, 1); anchorVisual.StartAnimation(nameof(anchorVisual.Scale), scaleExpression); return(anchor); }
/// <summary> /// Implements the == operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static BooleanNode operator ==(Vector4Node left, Vector4Node right) { return(ExpressionFunctions.Function <BooleanNode>(ExpressionNodeType.Equals, left, right)); }
/// <summary> /// Implements the * operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static Matrix3x2Node operator *(Matrix3x2Node left, Matrix3x2Node right) { return(ExpressionFunctions.Function <Matrix3x2Node>(ExpressionNodeType.Multiply, left, right)); }
/// <summary> /// Implements the - operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static Vector4Node operator -(Vector4Node left, Vector4Node right) { return(ExpressionFunctions.Function <Vector4Node>(ExpressionNodeType.Subtract, left, right)); }
/// <summary> /// Implements the - operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static Matrix3x2Node operator -(Matrix3x2Node left, Matrix3x2Node right) { return(ExpressionFunctions.Function <Matrix3x2Node>(ExpressionNodeType.Subtract, left, right)); }
private Templates InjectToExpressionFunction() { var totalTempaltes = new List <Templates> { this }.Union(References); foreach (var curTemplates in totalTempaltes) { var globalFuncs = curTemplates.GetGlobalFunctionTable(curTemplates.Options); foreach (var templateName in globalFuncs) { if (curTemplates.Any(u => u.Name == templateName)) { var newGlobalName = $"{curTemplates.Namespace}.{templateName}"; Expression.Functions.Add(newGlobalName, new ExpressionEvaluator(newGlobalName, ExpressionFunctions.Apply(this.GlobalTemplateFunction(templateName)), ReturnType.Object)); } } } return(this); }
/// <summary> /// Implements the * operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static Vector4Node operator *(Vector4Node left, Vector4Node right) { return(ExpressionFunctions.Function <Vector4Node>(ExpressionNodeType.Multiply, left, right)); }
/// <summary> /// Implements the / operator. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <returns>The result of the operator.</returns> public static QuaternionNode operator /(QuaternionNode left, QuaternionNode right) { return(ExpressionFunctions.Function <QuaternionNode>(ExpressionNodeType.Divide, left, right)); }