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
- MessageBox.cs
- SkipQueryOptionExpression.cs
- DefaultPrintController.cs
- OutputBuffer.cs
- Quaternion.cs
- CancellationTokenSource.cs
- CachedFontFamily.cs
- JsonFormatGeneratorStatics.cs
- MessageParameterAttribute.cs
- PeerNameResolver.cs
- ColumnMapTranslator.cs
- CodeStatementCollection.cs
- WebRequest.cs
- DescendentsWalkerBase.cs
- WebPart.cs
- DragEvent.cs
- RectangleHotSpot.cs
- BulletedListEventArgs.cs
- ToggleButton.cs
- BufferAllocator.cs
- MenuItemStyleCollectionEditor.cs
- BufferedStream2.cs
- BindingExpressionBase.cs
- TcpClientSocketManager.cs
- URL.cs
- _WebProxyDataBuilder.cs
- EncoderExceptionFallback.cs
- SmiEventSink_Default.cs
- TypeConverterBase.cs
- dbenumerator.cs
- NCryptSafeHandles.cs
- SimpleRecyclingCache.cs
- IntSecurity.cs
- IList.cs
- ResXDataNode.cs
- FieldBuilder.cs
- BindingList.cs
- BuildManagerHost.cs
- M3DUtil.cs
- BuildManager.cs
- ComPlusDiagnosticTraceSchemas.cs
- CustomValidator.cs
- ConfigurationValue.cs
- DeferredSelectedIndexReference.cs
- EdmEntityTypeAttribute.cs
- FilterInvalidBodyAccessException.cs
- CodePageUtils.cs
- SqlPersonalizationProvider.cs
- SslStream.cs
- WsdlBuildProvider.cs
- SapiGrammar.cs
- GeneralTransform3DGroup.cs
- Point3DCollectionValueSerializer.cs
- ToolStripTextBox.cs
- WorkflowEventArgs.cs
- PasswordRecovery.cs
- SelectedDatesCollection.cs
- AdPostCacheSubstitution.cs
- IsolatedStorage.cs
- Paragraph.cs
- ByeOperationAsyncResult.cs
- FormatterServices.cs
- WindowsGraphics.cs
- BrowserDefinition.cs
- InternalUserCancelledException.cs
- HttpModule.cs
- CoreSwitches.cs
- BStrWrapper.cs
- CqlIdentifiers.cs
- PropertyItem.cs
- VectorCollection.cs
- ApplicationTrust.cs
- SystemGatewayIPAddressInformation.cs
- EdmValidator.cs
- BadImageFormatException.cs
- HtmlInputReset.cs
- unsafenativemethodsother.cs
- SeparatorAutomationPeer.cs
- HtmlInputImage.cs
- SamlConditions.cs
- X509Certificate2Collection.cs
- EpmCustomContentWriterNodeData.cs
- DataObjectPastingEventArgs.cs
- LinqDataView.cs
- WhereQueryOperator.cs
- DataGridViewComboBoxColumn.cs
- NameValuePair.cs
- DateTimeOffsetConverter.cs
- ExtensibleSyndicationObject.cs
- TableItemPatternIdentifiers.cs
- DuplicateDetector.cs
- ReachPageContentCollectionSerializer.cs
- LogicalChannelCollection.cs
- VScrollBar.cs
- GridProviderWrapper.cs
- ListViewItem.cs
- JpegBitmapEncoder.cs
- XPathChildIterator.cs
- WebPartsSection.cs
- DbDataRecord.cs