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
- ExpressionDumper.cs
- NamespaceList.cs
- SettingsProperty.cs
- TextTreeTextNode.cs
- MasterPageParser.cs
- StyleSelector.cs
- shaper.cs
- PropertyItemInternal.cs
- ModuleBuilder.cs
- TreeNodeConverter.cs
- CodeTypeParameter.cs
- ProcessThreadCollection.cs
- MemberListBinding.cs
- GACIdentityPermission.cs
- PathSegmentCollection.cs
- SqlComparer.cs
- DataSourceHelper.cs
- FilterQuery.cs
- UIAgentMonitor.cs
- WebPartTransformerCollection.cs
- DesignerGenericWebPart.cs
- Misc.cs
- MainMenu.cs
- AsyncPostBackErrorEventArgs.cs
- SafeHandles.cs
- XmlIncludeAttribute.cs
- SqlNodeTypeOperators.cs
- DataGridViewRowsAddedEventArgs.cs
- GridViewCellAutomationPeer.cs
- Lease.cs
- TypeResolver.cs
- CatalogZoneBase.cs
- SemaphoreFullException.cs
- CryptoApi.cs
- ToolStripPanel.cs
- StrokeNodeEnumerator.cs
- CompilerGlobalScopeAttribute.cs
- BlobPersonalizationState.cs
- Hashtable.cs
- BoundPropertyEntry.cs
- SqlCommandSet.cs
- ConfigurationLockCollection.cs
- DetailsViewCommandEventArgs.cs
- WebConfigurationManager.cs
- SQLDecimal.cs
- PlaceHolder.cs
- EntityDataSourceDataSelectionPanel.designer.cs
- Calendar.cs
- DataMember.cs
- Control.cs
- XmlILConstructAnalyzer.cs
- ComponentCollection.cs
- SpotLight.cs
- SerializationFieldInfo.cs
- LowerCaseStringConverter.cs
- GPPOINT.cs
- XmlTextEncoder.cs
- LocalizableAttribute.cs
- Int32KeyFrameCollection.cs
- _UriSyntax.cs
- ConfigurationStrings.cs
- CallbackValidatorAttribute.cs
- TabletDevice.cs
- ProxyWebPartManager.cs
- AtomContentProperty.cs
- TriggerBase.cs
- ButtonAutomationPeer.cs
- CompiledXpathExpr.cs
- CmsInterop.cs
- TreeViewItem.cs
- DesignTimeDataBinding.cs
- CookieParameter.cs
- NetworkStream.cs
- ElementHost.cs
- ColorBuilder.cs
- QueryCursorEventArgs.cs
- ReflectionTypeLoadException.cs
- Rfc4050KeyFormatter.cs
- MSAANativeProvider.cs
- DataGridRow.cs
- DbModificationCommandTree.cs
- ByteAnimationUsingKeyFrames.cs
- StringDictionary.cs
- StringDictionaryCodeDomSerializer.cs
- ControlBindingsCollection.cs
- SqlTypeConverter.cs
- EncodingNLS.cs
- NavigatorInput.cs
- OdbcErrorCollection.cs
- CorePropertiesFilter.cs
- XmlValidatingReader.cs
- ProtocolsConfigurationHandler.cs
- SpeechRecognitionEngine.cs
- COM2ExtendedTypeConverter.cs
- DesignTimeSiteMapProvider.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- TreeViewEvent.cs
- RoleGroup.cs
- HashAlgorithm.cs
- RemotingConfiguration.cs