Skip to content

Commit

Permalink
Prepare release 1.1.0 (#80)
Browse files Browse the repository at this point in the history
* Prepare release 1.1.0
* Update animation examples
* Update Readme file
  • Loading branch information
mgierlasinski authored May 4, 2020
1 parent 0914aae commit a0e979b
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 50 deletions.
12 changes: 5 additions & 7 deletions MagicGradients/MagicGradients.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>1.0.1</Version>
<Version>1.1.0</Version>
<Authors>Marcin Gierlasiński, Bohdan Benetskyi and Contributors</Authors>
<Product>Magic Gradients</Product>
<Description>Draw breathtaking backgrounds in your Xamarin.Forms application. It's a kind of magic. Powered by SkiaSharp.</Description>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/mgierlasinski/MagicGradients/</PackageProjectUrl>
<PackageTags>magic;gradients;linear;radial;skiasharp;xamarin;forms;android;ios;uwp</PackageTags>
<PackageIconUrl>https://raw.githubusercontent.com/mgierlasinski/MagicGradients/master/Assets/icon.png</PackageIconUrl>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -22,10 +22,8 @@
</ItemGroup>

<ItemGroup>
<None Include="..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="..\LICENSE" Pack="True" PackagePath="\" />
<None Include="..\Assets\icon.png" Pack="True" PackagePath="\" />
</ItemGroup>

</Project>
15 changes: 12 additions & 3 deletions Playground/Playground/Views/LinearGradientsAnimationPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,23 @@
x:Class="Playground.Views.LinearGradientsAnimationPage"
Title="Linear Gradients">
<StackLayout Spacing="0">
<magic:GradientView VerticalOptions="FillAndExpand">
<magic:LinearGradient x:Name="RotateTarget">
<magic:GradientStop Color="Yellow" />
<magic:GradientStop Color="Orange" />
<magic:GradientStop Color="Red" />
<magic:GradientStop Color="Orange" />
<magic:GradientStop Color="Yellow" />
</magic:LinearGradient>
</magic:GradientView>
<magic:GradientView VerticalOptions="FillAndExpand">
<magic:GradientCollection>
<magic:LinearGradient >
<magic:GradientStop Color="Yellow" />
<magic:GradientStop Color="Black" />
</magic:LinearGradient>
<magic:LinearGradient Angle="90" x:Name="Gradient">
<magic:LinearGradient Angle="90">
<magic:GradientStop Color="#14000000" Offset="0" />
<magic:GradientStop Color="Red" Offset="0" x:Name="AnimatedStop" />
<magic:GradientStop Color="#00FF21" Offset="0" x:Name="ScannerTarget" />
<magic:GradientStop Color="#14000000" Offset="1" />
</magic:LinearGradient>
</magic:GradientCollection>
Expand Down
18 changes: 15 additions & 3 deletions Playground/Playground/Views/LinearGradientsAnimationPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,28 @@ public LinearGradientsAnimationPage()
{
InitializeComponent();

var animationOffset = new Animation(v => AnimatedStop.Offset = (float)v, 0, 1);
var animationOffsetBack = new Animation(v => AnimatedStop.Offset = (float)v, 1, 0);
AnimateRotate();
AnimateScanner();
}

private void AnimateRotate()
{
var rotateAnimation = new Animation(v => RotateTarget.Angle = (float)v, 0, 360);
rotateAnimation.Commit(this, "RotateAnimation", 16, 3000, repeat: () => true);
}

private void AnimateScanner()
{
var animationOffset = new Animation(v => ScannerTarget.Offset = (float)v, 0, 1);
var animationOffsetBack = new Animation(v => ScannerTarget.Offset = (float)v, 1, 0);

var parentAnimation = new Animation
{
{0, 0.5, animationOffset},
{0.5, 1, animationOffsetBack}
};

parentAnimation.Commit(this, "Animation", 16, 3000, repeat: () => true);
parentAnimation.Commit(this, "ScannerAnimation", 16, 3000, repeat: () => true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Title="Radial Gradients">
<StackLayout Spacing="0">
<magic:GradientView VerticalOptions="FillAndExpand">
<magic:RadialGradient Center="0.5,0.5" RadiusX="200" RadiusY="200" x:Name="AnimatedGradient">
<magic:RadialGradient Center="0.5,0.5" RadiusX="200" RadiusY="200" x:Name="PulseTarget">
<magic:GradientStop Color="Red" Offset="0" />
<magic:GradientStop Color="Yellow" Offset="0.5" />
<magic:GradientStop Color="Green" Offset="1" />
Expand Down
15 changes: 10 additions & 5 deletions Playground/Playground/Views/RadialGradientsAnimationPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ public RadialGradientsAnimationPage()
{
InitializeComponent();

var animationXGrow = new Animation(v => AnimatedGradient.RadiusX = (float)v, 10, 300);
var animationYGrow = new Animation(v => AnimatedGradient.RadiusY = (float)v, 10, 300);
var animationXShrink = new Animation(v => AnimatedGradient.RadiusX = (float)v, 300, 10);
var animationYShrink = new Animation(v => AnimatedGradient.RadiusY = (float)v, 300, 10);
AnimatePulse();
}

private void AnimatePulse()
{
var animationXGrow = new Animation(v => PulseTarget.RadiusX = (float)v, 10, 300);
var animationYGrow = new Animation(v => PulseTarget.RadiusY = (float)v, 10, 300);
var animationXShrink = new Animation(v => PulseTarget.RadiusX = (float)v, 300, 10);
var animationYShrink = new Animation(v => PulseTarget.RadiusY = (float)v, 300, 10);

var parentAnimation = new Animation
{
Expand All @@ -21,7 +26,7 @@ public RadialGradientsAnimationPage()
{0.5, 1, animationYShrink}
};

parentAnimation.Commit(this, "Animation", 30, 2000, repeat: () => true);
parentAnimation.Commit(this, "PulseAnimation", 30, 2000, repeat: () => true);
}
}
}
56 changes: 25 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Draw breathtaking backgrounds in your Xamarin.Forms application. You can add unl

| Package | Version | Dependencies |
|---|---|---|
| MagicGradients | [![Nuget](https://img.shields.io/nuget/vpre/MagicGradients)](https://www.nuget.org/packages/MagicGradients) | [![Nuget](https://img.shields.io/badge/Xamarin.Forms-v4.2-green)](https://www.nuget.org/packages/Xamarin.Forms/) [![Nuget](https://img.shields.io/badge/SkiaSharp-v1.68-blue)](https://www.nuget.org/packages/SkiaSharp/) [![Nuget](https://img.shields.io/badge/SkiaSharp.Views.Forms-v1.68-blue)](https://www.nuget.org/packages/SkiaSharp.Views.Forms/)
| MagicGradients | [![Nuget](https://img.shields.io/nuget/vpre/MagicGradients)](https://www.nuget.org/packages/MagicGradients) | [![Nuget](https://img.shields.io/badge/Xamarin.Forms-v4.4-green)](https://www.nuget.org/packages/Xamarin.Forms/) [![Nuget](https://img.shields.io/badge/SkiaSharp-v1.68.1-blue)](https://www.nuget.org/packages/SkiaSharp/) [![Nuget](https://img.shields.io/badge/SkiaSharp.Views.Forms-v1.68.1-blue)](https://www.nuget.org/packages/SkiaSharp.Views.Forms/)

## Gallery

Expand All @@ -29,35 +29,31 @@ As it requires SkiaSharp, you will also need to ensure you add SkiaSharp.Views.F

## Setting gradient source

You can build gradients manually in Xaml. To draw single gradient just create `LinearGradient` or `RadialGradient` as the child of `GradientSource` property.
You can build gradients manually in Xaml. To draw single gradient just create `LinearGradient` or `RadialGradient` as the child of `GradientView` control.

``` xml
<magic:GradientView VerticalOptions="FillAndExpand">
<magic:GradientView.GradientSource>
<magic:LinearGradient Angle="45">
<magic:GradientStop Color="Red" Offset="0" />
<magic:GradientStop Color="Yellow" Offset="1" />
</magic:LinearGradient>
</magic:GradientView.GradientSource>
<magic:GradientView>
<magic:LinearGradient Angle="45">
<magic:GradientStop Color="Red" />
<magic:GradientStop Color="Yellow" />
</magic:LinearGradient>
</magic:GradientView>
```

There is also possibility to add collection of gradients. You can mix linear and radial gradients, use transparency in color definitions to get blend effect.

``` xml
<magic:GradientView>
<magic:GradientView.GradientSource>
<magic:GradientCollection>
<magic:LinearGradient Angle="45">
<magic:GradientStop Color="Orange" Offset="0" />
<magic:GradientStop Color="#ff0000" Offset="0.6" />
</magic:LinearGradient>
<magic:LinearGradient Angle="90">
<magic:GradientStop Color="#33ff0000" Offset="0.4" />
<magic:GradientStop Color="#ff00ff00" Offset="1" />
</magic:LinearGradient>
</magic:GradientCollection>
</magic:GradientView.GradientSource>
<magic:GradientCollection>
<magic:LinearGradient Angle="45">
<magic:GradientStop Color="Orange" Offset="0" />
<magic:GradientStop Color="#ff0000" Offset="0.6" />
</magic:LinearGradient>
<magic:LinearGradient Angle="90">
<magic:GradientStop Color="#33ff0000" Offset="0.4" />
<magic:GradientStop Color="#ff00ff00" Offset="1" />
</magic:LinearGradient>
</magic:GradientCollection>
</magic:GradientView>
```

Expand Down Expand Up @@ -90,15 +86,13 @@ You can embed inline CSS directly in xaml:

``` xml
<magic:GradientView>
<magic:GradientView.GradientSource>
<magic:CssGradientSource>
<x:String>
<![CDATA[
linear-gradient(242deg, red, green, orange)
]]>
</x:String>
</magic:CssGradientSource>
</magic:GradientView.GradientSource>
<magic:CssGradientSource>
<x:String>
<![CDATA[
linear-gradient(242deg, red, green, orange)
]]>
</x:String>
</magic:CssGradientSource>
</magic:GradientView>
```

Expand Down Expand Up @@ -194,7 +188,7 @@ radial-gradient(farthest-corner at 40px 40px, #f35 0%, #43e 100%);
- [Gradient Background for your Xamarin.Forms App - blog post](https://medium.com/@benetskyybogdan/gradient-background-for-your-xamarin-forms-app-6d7e46fba558)
- [XF Shell Gradient Flyout with Magic Gradients - blog post](https://medium.com/@benetskyybogdan/xf-shell-gradient-flyout-with-magic-gradients-e9f0eb46bae0)
- [How we extended Xamarin.Forms CSS to style GradientView - blog post](https://medium.com/@benetskyybogdan/xamarin-forms-custom-css-properties-d75872bea20e)

- [Xamarin.Forms Gradient Background For All Pages in 1 minute - blog post](https://medium.com/@benetskyybogdan/xamarin-forms-gradient-background-for-all-pages-in-1-minute-9e172d986618)

---
<div>Icons made by <a href="https://www.flaticon.com/authors/icongeek26" title="Icongeek26">Icongeek26</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>
20 changes: 20 additions & 0 deletions Scripts/PublishNuGetsLocal.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Function Build-Solution{
param(
[Parameter(Mandatory=$true)]
[String] $Path
)
process
{
$MsBuildExe = 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe'

Write-Host "Building $($Path)" -foregroundcolor green
& "$($MsBuildExe)" "$($Path)" /t:clean,restore,rebuild,pack /p:Configuration=Release /p:Platform="Any CPU" /m
}
}

$NuGetPath = '..\MagicGradients\**\Release\*.nupkg'

Remove-Item $NuGetPath
Build-Solution('..\MagicGradients\MagicGradients.csproj')

Get-ChildItem -Path $NuGetPath -Recurse | Copy-Item -Destination 'C:\Packages'
34 changes: 34 additions & 0 deletions Scripts/UpdateNuGetVersion.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Function Update-NuGetVersion{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]$Version,
[Parameter(Mandatory=$true)]
[String]$File
)
Replace-LineInFile $Version $File
}

Function Replace-LineInFile{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[String]$Version,
[String]$File
)
Write-Host "Set new $Version version for $File"
$Regex = '(?<=<Version>)[^<]*'
(Get-Content $File) -replace $Regex, $Version | Set-Content $File
}

Function Update-AllNuGetVersions{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[String]$Version
)

Update-NuGetVersion $Version '..\MagicGradients\MagicGradients.csproj';
}

Update-AllNuGetVersions

0 comments on commit a0e979b

Please sign in to comment.