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
- httpserverutility.cs
- TextServicesDisplayAttributePropertyRanges.cs
- LogEntryDeserializer.cs
- OutputCache.cs
- ClientUIRequest.cs
- RootNamespaceAttribute.cs
- ImageListUtils.cs
- UdpReplyToBehavior.cs
- NumberFormatInfo.cs
- ReturnValue.cs
- Nullable.cs
- COM2ColorConverter.cs
- AssociationSetEnd.cs
- CustomSignedXml.cs
- SQLMembershipProvider.cs
- Automation.cs
- Control.cs
- ChangeTracker.cs
- DataGridColumnDropSeparator.cs
- MsmqBindingElementBase.cs
- Helpers.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- ComponentDispatcherThread.cs
- ModifiableIteratorCollection.cs
- webbrowsersite.cs
- EventItfInfo.cs
- BindingBase.cs
- XPathParser.cs
- ObjectParameterCollection.cs
- SqlBinder.cs
- RectangleConverter.cs
- ComponentCollection.cs
- DragAssistanceManager.cs
- FileSecurity.cs
- QilXmlWriter.cs
- TextSearch.cs
- TextParaLineResult.cs
- SvcMapFileLoader.cs
- GenericParameterDataContract.cs
- OutKeywords.cs
- AttributeCallbackBuilder.cs
- MetadataException.cs
- PnrpPeerResolverElement.cs
- ConfigurationProperty.cs
- TransportSecurityProtocol.cs
- DatatypeImplementation.cs
- ManagedFilter.cs
- RuntimeConfig.cs
- ProvidersHelper.cs
- ellipse.cs
- filewebrequest.cs
- ProcessInputEventArgs.cs
- GridViewHeaderRowPresenter.cs
- FormattedTextSymbols.cs
- PagePropertiesChangingEventArgs.cs
- ToolStripLabel.cs
- WS2007HttpBinding.cs
- ReflectEventDescriptor.cs
- WmpBitmapDecoder.cs
- GenericIdentity.cs
- IsolationInterop.cs
- SerializationSectionGroup.cs
- XmlFormatExtensionPointAttribute.cs
- OrderedDictionary.cs
- DynamicActionMessageFilter.cs
- AnnotationComponentManager.cs
- AssertSection.cs
- PublisherIdentityPermission.cs
- DirectionalLight.cs
- _NetRes.cs
- MruCache.cs
- EventLogger.cs
- EnumMember.cs
- ConnectionPointGlyph.cs
- TemplateManager.cs
- SchemaElementDecl.cs
- UInt16Storage.cs
- SQLByte.cs
- ToolStripSplitButton.cs
- versioninfo.cs
- ApplicationBuildProvider.cs
- WorkflowClientDeliverMessageWrapper.cs
- TransactionTraceIdentifier.cs
- DynamicRenderer.cs
- EncryptedKey.cs
- QueryStringParameter.cs
- AttributeUsageAttribute.cs
- ConsoleTraceListener.cs
- TransportContext.cs
- GuidConverter.cs
- VersionUtil.cs
- Util.cs
- XmlSchemaComplexType.cs
- SecurityException.cs
- SystemParameters.cs
- ComNativeDescriptor.cs
- Models.cs
- ContractAdapter.cs
- NetNamedPipeSecurity.cs
- SoundPlayerAction.cs