Scripts/New-UDMorph.ps1
<# .SYNOPSIS Sample control for UniversalDashboard. .DESCRIPTION Sample control function for UniversalDashboard. This function must have an ID and return a hash table. .PARAMETER Id An id for the component default value will be generated by new-guid. .EXAMPLE PS C:\> New-UDMorph -Id "MORPHING" -Height 250 -Width 500 -FontSize 100 -Colors { "#086788", "#F0C808", "#DD1C1A", "#000" } -Words { "Powershell", "Universal", "Dashboard", "Component", "psdevuk" } Shows a morphing animation between the words specified in the word parameter .INPUTS Inputs (if any) .OUTPUTS Output (if any) .NOTES General notes #> function New-UDMorph { param( [Parameter()] [string]$Id = (New-Guid).ToString(), [Parameter()] [array]$Words, [Parameter()] [scriptblock]$Colors, [Parameter()] [int]$Height, [Parameter()] [int]$Width, [Parameter()] [int]$FontSize, [Parameter()] [string]$FontUrl = "https://fonts.gstatic.com/s/pacifico/v9/yunJt0R8tCvMyj_V4xSjafesZW2xOQ-xsNqO47m55DA.woff", [Parameter()] [int]$Period = 2, [Parameter()] [int]$Speed = 2, [Parameter()] [int]$Steps = 500, [Parameter()] [int]$LineWidth = 2 ) End { @{ # The AssetID of the main JS File assetId = $AssetId # Tell UD this is a plugin isPlugin = $true # This ID must be the same as the one used in the JavaScript to register the control with UD type = "UD-Morph" # An ID is mandatory id = $Id # This is where you can put any other properties. They are passed to the React control's props # The keys are case-sensitive in JS. words = [array]$Words.Invoke() colors = [array]$Colors.Invoke() height = $Height width = $Width fontSize = $FontSize fontUrl = $FontUrl period = $Period speed = $Speed steps = $Steps lineWidth = $LineWidth } } } |