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
- PackageRelationshipCollection.cs
- SQLByte.cs
- TypeElement.cs
- _ConnectStream.cs
- ReflectionTypeLoadException.cs
- OutputCacheProfileCollection.cs
- StyleHelper.cs
- SimpleExpression.cs
- InheritanceService.cs
- ClientTarget.cs
- TraceLevelStore.cs
- LocationUpdates.cs
- ComponentDispatcherThread.cs
- DodSequenceMerge.cs
- FileLogRecordStream.cs
- CharAnimationBase.cs
- NamespaceCollection.cs
- ClientOptions.cs
- SubqueryRules.cs
- HttpStreamMessageEncoderFactory.cs
- AccessControlEntry.cs
- ValueTypeFixupInfo.cs
- BindableTemplateBuilder.cs
- AttributeCallbackBuilder.cs
- InstanceData.cs
- EventMappingSettings.cs
- formatter.cs
- LogicalExpr.cs
- Visual.cs
- DataGridHyperlinkColumn.cs
- Semaphore.cs
- TreeViewHitTestInfo.cs
- WindowsButton.cs
- ContractInferenceHelper.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- VisualBrush.cs
- UnsafePeerToPeerMethods.cs
- ListBindableAttribute.cs
- ResourceProviderFactory.cs
- ApplicationServiceHelper.cs
- InheritanceContextChangedEventManager.cs
- DesignerActionList.cs
- TypedReference.cs
- PageVisual.cs
- PluralizationServiceUtil.cs
- ContentFilePart.cs
- BamlLocalizationDictionary.cs
- WindowsListView.cs
- MetadataPropertyCollection.cs
- ToolStripDropDownItem.cs
- Nullable.cs
- DBDataPermission.cs
- ToolStripRenderer.cs
- OdbcException.cs
- TextLineResult.cs
- ComponentRenameEvent.cs
- PriorityChain.cs
- DynamicMethod.cs
- SqlPersonalizationProvider.cs
- ReadOnlyPropertyMetadata.cs
- HandlerWithFactory.cs
- WizardPanel.cs
- BooleanFunctions.cs
- TdsEnums.cs
- PrintDocument.cs
- GroupBox.cs
- RequestNavigateEventArgs.cs
- XmlChildEnumerator.cs
- Size.cs
- WindowsGrip.cs
- NativeMsmqMessage.cs
- SafeTimerHandle.cs
- PropertyTabAttribute.cs
- DataProviderNameConverter.cs
- MobileUserControlDesigner.cs
- ErrorHandler.cs
- JournalNavigationScope.cs
- CodeFieldReferenceExpression.cs
- SrgsText.cs
- IntSecurity.cs
- SQlBooleanStorage.cs
- WebPartManagerInternals.cs
- Rotation3DAnimationUsingKeyFrames.cs
- DynamicMethod.cs
- diagnosticsswitches.cs
- InputScope.cs
- DNS.cs
- ReceiveCompletedEventArgs.cs
- securitymgrsite.cs
- CustomErrorsSectionWrapper.cs
- WpfGeneratedKnownProperties.cs
- InvokePatternIdentifiers.cs
- ConfigXmlElement.cs
- WebPartVerbsEventArgs.cs
- RowType.cs
- XamlReader.cs
- DataGridViewIntLinkedList.cs
- MasterPageBuildProvider.cs
- ContractMapping.cs
- PerspectiveCamera.cs