Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / Animation / ElasticEase.cs / 1305600 / ElasticEase.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation, 2008 // // File: ElasticEase.cs //----------------------------------------------------------------------------- using MS.Internal; namespace System.Windows.Media.Animation { ////// This class implements an easing function that gives an elastic/springy curve /// public class ElasticEase : EasingFunctionBase { public ElasticEase() { } ////// Bounces Property /// public static readonly DependencyProperty OscillationsProperty = DependencyProperty.Register( "Oscillations", typeof(int), typeof(ElasticEase), new PropertyMetadata(3)); ////// Specifies the number of oscillations /// public int Oscillations { get { return (int)GetValue(OscillationsProperty); } set { SetValueInternal(OscillationsProperty, value); } } ////// Springiness Property /// public static readonly DependencyProperty SpringinessProperty = DependencyProperty.Register( "Springiness", typeof(double), typeof(ElasticEase), new PropertyMetadata(3.0)); ////// Specifies the amount of springiness /// public double Springiness { get { return (double)GetValue(SpringinessProperty); } set { SetValueInternal(SpringinessProperty, value); } } protected override double EaseInCore(double normalizedTime) { double oscillations = Math.Max(0.0, (double)Oscillations); double springiness = Math.Max(0.0, Springiness); double expo; if (DoubleUtil.IsZero(springiness)) { expo = normalizedTime; } else { expo = (Math.Exp(springiness * normalizedTime) - 1.0) / (Math.Exp(springiness) - 1.0); } return expo * (Math.Sin((Math.PI * 2.0 * oscillations + Math.PI * 0.5) * normalizedTime)); } protected override Freezable CreateInstanceCore() { return new ElasticEase(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation, 2008 // // File: ElasticEase.cs //----------------------------------------------------------------------------- using MS.Internal; namespace System.Windows.Media.Animation { ////// This class implements an easing function that gives an elastic/springy curve /// public class ElasticEase : EasingFunctionBase { public ElasticEase() { } ////// Bounces Property /// public static readonly DependencyProperty OscillationsProperty = DependencyProperty.Register( "Oscillations", typeof(int), typeof(ElasticEase), new PropertyMetadata(3)); ////// Specifies the number of oscillations /// public int Oscillations { get { return (int)GetValue(OscillationsProperty); } set { SetValueInternal(OscillationsProperty, value); } } ////// Springiness Property /// public static readonly DependencyProperty SpringinessProperty = DependencyProperty.Register( "Springiness", typeof(double), typeof(ElasticEase), new PropertyMetadata(3.0)); ////// Specifies the amount of springiness /// public double Springiness { get { return (double)GetValue(SpringinessProperty); } set { SetValueInternal(SpringinessProperty, value); } } protected override double EaseInCore(double normalizedTime) { double oscillations = Math.Max(0.0, (double)Oscillations); double springiness = Math.Max(0.0, Springiness); double expo; if (DoubleUtil.IsZero(springiness)) { expo = normalizedTime; } else { expo = (Math.Exp(springiness * normalizedTime) - 1.0) / (Math.Exp(springiness) - 1.0); } return expo * (Math.Sin((Math.PI * 2.0 * oscillations + Math.PI * 0.5) * normalizedTime)); } protected override Freezable CreateInstanceCore() { return new ElasticEase(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ExpressionConverter.cs
- ThreadStateException.cs
- FormViewModeEventArgs.cs
- DBDataPermissionAttribute.cs
- DataGridViewCellStyleConverter.cs
- TextServicesContext.cs
- HashAlgorithm.cs
- MsdtcClusterUtils.cs
- XmlBoundElement.cs
- smtppermission.cs
- ObjectSet.cs
- HwndProxyElementProvider.cs
- WebPartActionVerb.cs
- AttachmentService.cs
- CategoryList.cs
- KeyEvent.cs
- FontFamilyConverter.cs
- FormViewDeletedEventArgs.cs
- DataObjectSettingDataEventArgs.cs
- Pen.cs
- LinearQuaternionKeyFrame.cs
- ConsumerConnectionPoint.cs
- MenuItemAutomationPeer.cs
- DescendantBaseQuery.cs
- ModuleConfigurationInfo.cs
- OracleInternalConnection.cs
- ToolBar.cs
- CopyOnWriteList.cs
- RootProfilePropertySettingsCollection.cs
- AppDomainManager.cs
- MonikerHelper.cs
- ComponentEvent.cs
- CodePageUtils.cs
- DataRecordObjectView.cs
- CodeDirectionExpression.cs
- Size3D.cs
- ExtractedStateEntry.cs
- BinHexEncoding.cs
- validationstate.cs
- DataGridItemEventArgs.cs
- SqlMethodAttribute.cs
- QilUnary.cs
- PropVariant.cs
- OutputCacheSettings.cs
- DictionaryBase.cs
- XPathParser.cs
- RegistrySecurity.cs
- BinaryNode.cs
- MapPathBasedVirtualPathProvider.cs
- HashCodeCombiner.cs
- SparseMemoryStream.cs
- TagMapInfo.cs
- CalendarItem.cs
- DataAdapter.cs
- DataControlPagerLinkButton.cs
- JsonGlobals.cs
- PtsPage.cs
- PeerSecurityManager.cs
- CheckPair.cs
- RegistrySecurity.cs
- Primitive.cs
- PlainXmlSerializer.cs
- StrongNameKeyPair.cs
- MonthCalendar.cs
- PreviewPrintController.cs
- DrawListViewSubItemEventArgs.cs
- JsonQueryStringConverter.cs
- ResourceContainer.cs
- NamedPermissionSet.cs
- ControlEvent.cs
- Security.cs
- TextUtf8RawTextWriter.cs
- DictionaryChange.cs
- XmlValidatingReader.cs
- CodeTypeDeclaration.cs
- ResolveMatchesApril2005.cs
- keycontainerpermission.cs
- AttributeTable.cs
- WorkflowMessageEventHandler.cs
- PrivilegedConfigurationManager.cs
- SerializationObjectManager.cs
- CompilerGlobalScopeAttribute.cs
- StylusPlugInCollection.cs
- BrowserDefinitionCollection.cs
- ZipIOLocalFileHeader.cs
- EmbeddedMailObject.cs
- HttpWrapper.cs
- LayoutEditorPart.cs
- SingletonConnectionReader.cs
- SecurityChannel.cs
- ElapsedEventArgs.cs
- BinaryExpression.cs
- FontClient.cs
- OAVariantLib.cs
- DataGridViewColumnEventArgs.cs
- ConstructorArgumentAttribute.cs
- NewExpression.cs
- ExceptionUtil.cs
- ChannelServices.cs
- FormViewModeEventArgs.cs