Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / Animation / EasingFunctionBase.cs / 1305600 / EasingFunctionBase.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation, 2008 // // File: EasingFunctionBase.cs //----------------------------------------------------------------------------- namespace System.Windows.Media.Animation { ////// This class is the base class for many easing functions. /// public abstract class EasingFunctionBase : Freezable, IEasingFunction { ////// EasingMode Property /// public static readonly DependencyProperty EasingModeProperty = DependencyProperty.Register( "EasingMode", typeof(EasingMode), typeof(EasingFunctionBase), new PropertyMetadata(EasingMode.EaseOut)); ////// Specifies the easing behavior. /// public EasingMode EasingMode { get { return (EasingMode)GetValue(EasingModeProperty); } set { SetValueInternal(EasingModeProperty, value); } } ////// Transforms normalized time to control the pace of an animation. /// /// normalized time (progress) of the animation ///transformed progress ///Uses EasingMode in conjunction with EaseInCore to evaluate the easing function. public double Ease(double normalizedTime) { switch (EasingMode) { case EasingMode.EaseIn: return EaseInCore(normalizedTime); case EasingMode.EaseOut: // EaseOut is the same as EaseIn, except time is reversed & the result is flipped. return 1.0 - EaseInCore(1.0 - normalizedTime); case EasingMode.EaseInOut: default: // EaseInOut is a combination of EaseIn & EaseOut fit to the 0-1, 0-1 range. return (normalizedTime < 0.5) ? EaseInCore( normalizedTime * 2.0 ) * 0.5 : (1.0 - EaseInCore((1.0 - normalizedTime) * 2.0)) * 0.5 + 0.5; } } ////// Transforms normalized time to control the pace of an animation for the EaseIn EasingMode /// /// normalized time (progress) of the animation ///transformed progress ////// You only have to specifiy your easing function for the 'EaseIn' case because the implementation /// of Ease will handle transforming normalizedTime & the result of this method to handle 'EaseOut' & 'EaseInOut'. /// protected abstract double EaseInCore(double normalizedTime); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation, 2008 // // File: EasingFunctionBase.cs //----------------------------------------------------------------------------- namespace System.Windows.Media.Animation { ////// This class is the base class for many easing functions. /// public abstract class EasingFunctionBase : Freezable, IEasingFunction { ////// EasingMode Property /// public static readonly DependencyProperty EasingModeProperty = DependencyProperty.Register( "EasingMode", typeof(EasingMode), typeof(EasingFunctionBase), new PropertyMetadata(EasingMode.EaseOut)); ////// Specifies the easing behavior. /// public EasingMode EasingMode { get { return (EasingMode)GetValue(EasingModeProperty); } set { SetValueInternal(EasingModeProperty, value); } } ////// Transforms normalized time to control the pace of an animation. /// /// normalized time (progress) of the animation ///transformed progress ///Uses EasingMode in conjunction with EaseInCore to evaluate the easing function. public double Ease(double normalizedTime) { switch (EasingMode) { case EasingMode.EaseIn: return EaseInCore(normalizedTime); case EasingMode.EaseOut: // EaseOut is the same as EaseIn, except time is reversed & the result is flipped. return 1.0 - EaseInCore(1.0 - normalizedTime); case EasingMode.EaseInOut: default: // EaseInOut is a combination of EaseIn & EaseOut fit to the 0-1, 0-1 range. return (normalizedTime < 0.5) ? EaseInCore( normalizedTime * 2.0 ) * 0.5 : (1.0 - EaseInCore((1.0 - normalizedTime) * 2.0)) * 0.5 + 0.5; } } ////// Transforms normalized time to control the pace of an animation for the EaseIn EasingMode /// /// normalized time (progress) of the animation ///transformed progress ////// You only have to specifiy your easing function for the 'EaseIn' case because the implementation /// of Ease will handle transforming normalizedTime & the result of this method to handle 'EaseOut' & 'EaseInOut'. /// protected abstract double EaseInCore(double normalizedTime); } } // 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
- WeakReadOnlyCollection.cs
- PropertyEmitterBase.cs
- LineServices.cs
- ApplicationFileCodeDomTreeGenerator.cs
- MessageQueueAccessControlEntry.cs
- ListItemCollection.cs
- XmlSerializationReader.cs
- ProcessModelInfo.cs
- Parser.cs
- DeobfuscatingStream.cs
- PropertyGridCommands.cs
- TdsParserSessionPool.cs
- RequestChannelBinder.cs
- CompModSwitches.cs
- PassportAuthenticationEventArgs.cs
- TableLayoutCellPaintEventArgs.cs
- EUCJPEncoding.cs
- FocusChangedEventArgs.cs
- ContextQuery.cs
- SingleAnimationUsingKeyFrames.cs
- ResourceWriter.cs
- InternalCompensate.cs
- ViewGenResults.cs
- DictionaryChange.cs
- LinearGradientBrush.cs
- AssemblyHash.cs
- HostingEnvironmentSection.cs
- MenuItemStyle.cs
- BaseParagraph.cs
- NoResizeHandleGlyph.cs
- StatusBar.cs
- RangeValidator.cs
- figurelengthconverter.cs
- DetailsViewRowCollection.cs
- safesecurityhelperavalon.cs
- NonParentingControl.cs
- UserControlBuildProvider.cs
- BindingsCollection.cs
- ChtmlSelectionListAdapter.cs
- WinFormsSecurity.cs
- PackageDigitalSignature.cs
- FtpRequestCacheValidator.cs
- ChildTable.cs
- ProjectionCamera.cs
- FormatterConverter.cs
- AsyncPostBackErrorEventArgs.cs
- SymbolMethod.cs
- SerializationStore.cs
- ButtonBase.cs
- HyperLinkField.cs
- FormViewInsertedEventArgs.cs
- InfoCardArgumentException.cs
- URIFormatException.cs
- CodeTypeMember.cs
- DbMetaDataCollectionNames.cs
- XmlEntityReference.cs
- GridViewColumn.cs
- ToolStripDropDownClosedEventArgs.cs
- NavigationWindow.cs
- QuadraticBezierSegment.cs
- WpfWebRequestHelper.cs
- FileSecurity.cs
- Utils.cs
- XLinq.cs
- DesignerSerializationOptionsAttribute.cs
- DrawListViewSubItemEventArgs.cs
- BitmapInitialize.cs
- BinaryReader.cs
- TextViewElement.cs
- WebServiceHandler.cs
- LinqDataSource.cs
- Transform.cs
- MessageSmuggler.cs
- BitmapEffectOutputConnector.cs
- autovalidator.cs
- IsolatedStorageFile.cs
- AspCompat.cs
- ContextQuery.cs
- PhysicalFontFamily.cs
- WebPartDisplayMode.cs
- DifferencingCollection.cs
- DiscreteKeyFrames.cs
- ProtocolsSection.cs
- SolidColorBrush.cs
- FixedHyperLink.cs
- UdpChannelFactory.cs
- LineVisual.cs
- XmlChildNodes.cs
- JournalEntryListConverter.cs
- CheckBoxAutomationPeer.cs
- StatusBar.cs
- FlowNode.cs
- RightsManagementEncryptedStream.cs
- LinearKeyFrames.cs
- AsyncCompletedEventArgs.cs
- PseudoWebRequest.cs
- EntityDataSourceDataSelectionPanel.cs
- NativeMethodsCLR.cs
- LZCodec.cs
- ComboBoxRenderer.cs