// ----------------------------------------------------------------------- // // Copyright 2015 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- namespace Perspex.Media { using System; /// /// Rotates an . /// public class RotateTransform : Transform { /// /// Defines the property. /// public static readonly PerspexProperty AngleProperty = PerspexProperty.Register("Angle"); /// /// Initializes a new instance of the class. /// public RotateTransform() { this.GetObservable(AngleProperty).Subscribe(_ => this.RaiseChanged()); } /// /// Initializes a new instance of the class. /// /// The angle, in degrees. public RotateTransform(double angle) : this() { this.Angle = angle; } /// /// Gets or sets the angle of rotation, in degrees. /// public double Angle { get { return this.GetValue(AngleProperty); } set { this.SetValue(AngleProperty, value); } } /// /// Gets the tranform's . /// public override Matrix Value { get { return Matrix.CreateRotation(Matrix.ToRadians(this.Angle)); } } } }