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
- FixedDSBuilder.cs
- InternalConfigRoot.cs
- DBPropSet.cs
- FtpWebRequest.cs
- CodeAttributeArgument.cs
- StateMachineWorkflowDesigner.cs
- ConfigXmlText.cs
- PropertyTabAttribute.cs
- ShaperBuffers.cs
- DynamicActionMessageFilter.cs
- BitmapSizeOptions.cs
- ClientTarget.cs
- WmlListAdapter.cs
- TextParaClient.cs
- WebCategoryAttribute.cs
- OptionUsage.cs
- FormsAuthenticationUserCollection.cs
- DbException.cs
- WebPartMenu.cs
- ToolStripGripRenderEventArgs.cs
- CommentEmitter.cs
- DynamicVirtualDiscoSearcher.cs
- ObjectStateManagerMetadata.cs
- CounterCreationDataCollection.cs
- X509Certificate2Collection.cs
- HostProtectionException.cs
- EndEvent.cs
- TCEAdapterGenerator.cs
- DataSet.cs
- DeploymentSection.cs
- DesignerAttribute.cs
- XmlNamespaceDeclarationsAttribute.cs
- TailPinnedEventArgs.cs
- GlyphInfoList.cs
- DeviceOverridableAttribute.cs
- EventItfInfo.cs
- SplashScreen.cs
- DefaultPropertyAttribute.cs
- SimpleTableProvider.cs
- MethodImplAttribute.cs
- SoapExtensionReflector.cs
- XsdBuildProvider.cs
- ImageAnimator.cs
- HostUtils.cs
- MessageSmuggler.cs
- UInt32Storage.cs
- HtmlEncodedRawTextWriter.cs
- SerializerProvider.cs
- Vars.cs
- HttpAsyncResult.cs
- _ListenerAsyncResult.cs
- MappingMetadataHelper.cs
- ViewgenContext.cs
- BuilderPropertyEntry.cs
- InputBinder.cs
- FrameworkElement.cs
- RepeatInfo.cs
- XPathNodeIterator.cs
- WindowsButton.cs
- FixedSOMContainer.cs
- UpDownEvent.cs
- NavigationWindowAutomationPeer.cs
- ControlParameter.cs
- ClientFormsIdentity.cs
- ShutDownListener.cs
- AudioFormatConverter.cs
- SystemException.cs
- AsymmetricAlgorithm.cs
- KeyValueInternalCollection.cs
- BinaryUtilClasses.cs
- Hex.cs
- SystemInfo.cs
- Activator.cs
- StorageAssociationTypeMapping.cs
- OletxDependentTransaction.cs
- ListBoxItemAutomationPeer.cs
- ExceptionHandlers.cs
- IntegerValidator.cs
- QueryPageSettingsEventArgs.cs
- DependencyObjectPropertyDescriptor.cs
- SmiXetterAccessMap.cs
- TextSpanModifier.cs
- filewebresponse.cs
- GrammarBuilderPhrase.cs
- HelloOperationAsyncResult.cs
- Menu.cs
- QueryAsyncResult.cs
- LinearGradientBrush.cs
- DataControlFieldCell.cs
- ChildrenQuery.cs
- XmlValidatingReaderImpl.cs
- Unit.cs
- OleDbRowUpdatedEvent.cs
- codemethodreferenceexpression.cs
- SystemDropShadowChrome.cs
- SmtpFailedRecipientException.cs
- HtmlTextArea.cs
- SafeNativeMethodsOther.cs
- Visual3D.cs
- SystemColorTracker.cs