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
- Knowncolors.cs
- BaseUriHelper.cs
- FrameworkName.cs
- GenericXmlSecurityTokenAuthenticator.cs
- DataKeyArray.cs
- InvalidOperationException.cs
- Transform.cs
- ItemsPresenter.cs
- ZipFileInfoCollection.cs
- LinqDataSource.cs
- StructuredType.cs
- FormClosingEvent.cs
- UInt64Converter.cs
- BitmapEffectInput.cs
- CodeAccessSecurityEngine.cs
- MetabaseReader.cs
- DataGridViewCellStyleEditor.cs
- EnlistmentTraceIdentifier.cs
- COM2IDispatchConverter.cs
- AdapterUtil.cs
- RootProfilePropertySettingsCollection.cs
- ComponentDesigner.cs
- ListBox.cs
- DataMember.cs
- ListComponentEditorPage.cs
- AssociationTypeEmitter.cs
- SqlFunctionAttribute.cs
- CardSpaceShim.cs
- XPathPatternBuilder.cs
- AspProxy.cs
- PrincipalPermission.cs
- WebControlParameterProxy.cs
- FormViewPageEventArgs.cs
- SmiSettersStream.cs
- QueryInterceptorAttribute.cs
- DataGridViewColumnConverter.cs
- DataContractJsonSerializerOperationBehavior.cs
- XDeferredAxisSource.cs
- Roles.cs
- Style.cs
- TemplateDefinition.cs
- WebPartAuthorizationEventArgs.cs
- GeneralTransform3D.cs
- ResourceDictionaryCollection.cs
- ObjectToken.cs
- RectangleGeometry.cs
- ValueUtilsSmi.cs
- ListDictionary.cs
- X509CertificateCollection.cs
- XmlSchemaSequence.cs
- WindowsScroll.cs
- Pen.cs
- BooleanKeyFrameCollection.cs
- EventRouteFactory.cs
- Activator.cs
- JapaneseLunisolarCalendar.cs
- _NestedMultipleAsyncResult.cs
- HybridWebProxyFinder.cs
- NamespaceCollection.cs
- DocumentScope.cs
- TraceContextEventArgs.cs
- XsltLoader.cs
- entityreference_tresulttype.cs
- x509store.cs
- WindowsEditBoxRange.cs
- ControlBuilderAttribute.cs
- RichTextBoxContextMenu.cs
- SoapObjectWriter.cs
- Stack.cs
- SystemIPv4InterfaceProperties.cs
- XmlConverter.cs
- SystemSounds.cs
- SafeFindHandle.cs
- Int32CollectionConverter.cs
- WsiProfilesElementCollection.cs
- DocumentAutomationPeer.cs
- SplitterCancelEvent.cs
- AuthorizationRuleCollection.cs
- WindowsHyperlink.cs
- SAPIEngineTypes.cs
- LinkedResourceCollection.cs
- IndexedString.cs
- TreeChangeInfo.cs
- DefaultAssemblyResolver.cs
- BitmapInitialize.cs
- ThreadStateException.cs
- XPathDocument.cs
- ProtocolsConfigurationEntry.cs
- RuleInfoComparer.cs
- DispatcherOperation.cs
- XPathParser.cs
- DataRelationCollection.cs
- PenLineCapValidation.cs
- MethodRental.cs
- InputLanguageEventArgs.cs
- LoadMessageLogger.cs
- DispatcherProcessingDisabled.cs
- ObjectToken.cs
- ProgressBar.cs
- ObjectQuery.cs