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
- Html32TextWriter.cs
- SharedDp.cs
- QueryExtender.cs
- AutomationPattern.cs
- LinkConverter.cs
- ImportDesigner.xaml.cs
- SessionPageStatePersister.cs
- XmlComment.cs
- SuppressedPackageProperties.cs
- TabletDevice.cs
- InstanceDataCollection.cs
- StorageEntitySetMapping.cs
- RoleGroupCollection.cs
- BuildProviderAppliesToAttribute.cs
- HtmlEmptyTagControlBuilder.cs
- Converter.cs
- SqlError.cs
- ProtocolElementCollection.cs
- LeftCellWrapper.cs
- StatusBarItem.cs
- WorkflowApplicationException.cs
- NativeMethods.cs
- ValueProviderWrapper.cs
- CollectionAdapters.cs
- ReadOnlyPropertyMetadata.cs
- DrawTreeNodeEventArgs.cs
- ReferencedType.cs
- XmlNodeComparer.cs
- FusionWrap.cs
- DbParameterCollection.cs
- Setter.cs
- _SslSessionsCache.cs
- Base64Encoding.cs
- LOSFormatter.cs
- PlacementWorkspace.cs
- DelegateSerializationHolder.cs
- WindowExtensionMethods.cs
- StringValueSerializer.cs
- WebServiceFault.cs
- PanelDesigner.cs
- KnownBoxes.cs
- HostProtectionPermission.cs
- PartialCachingAttribute.cs
- SpotLight.cs
- SBCSCodePageEncoding.cs
- ObjectPersistData.cs
- HtmlSelect.cs
- LinqDataSourceUpdateEventArgs.cs
- PackageDigitalSignatureManager.cs
- _SSPIWrapper.cs
- SafeRegistryHandle.cs
- XmlUtil.cs
- PerformanceCounterTraceRecord.cs
- ComponentRenameEvent.cs
- StreamingContext.cs
- Aes.cs
- XmlSerializationWriter.cs
- StorageRoot.cs
- IssuedTokenParametersElement.cs
- HttpListenerTimeoutManager.cs
- PageHandlerFactory.cs
- ItemList.cs
- ZipIOBlockManager.cs
- WebBrowserSiteBase.cs
- _SslState.cs
- ObservableDictionary.cs
- SQLInt64Storage.cs
- CultureInfo.cs
- SQLBoolean.cs
- StateMachineSubscription.cs
- HwndSourceParameters.cs
- PeerContact.cs
- AppSettingsExpressionBuilder.cs
- ZipFileInfoCollection.cs
- MonthCalendar.cs
- CharacterString.cs
- PolicyStatement.cs
- IProvider.cs
- LocalIdKeyIdentifierClause.cs
- DebugInfoGenerator.cs
- UmAlQuraCalendar.cs
- UserPersonalizationStateInfo.cs
- RawTextInputReport.cs
- UserInitiatedNavigationPermission.cs
- Visual3DCollection.cs
- ListViewCommandEventArgs.cs
- InvalidAsynchronousStateException.cs
- MethodBody.cs
- ConnectionInterfaceCollection.cs
- LoginUtil.cs
- HwndKeyboardInputProvider.cs
- ListViewDataItem.cs
- BasicExpressionVisitor.cs
- DefaultBinder.cs
- ImportCatalogPart.cs
- DataBindingExpressionBuilder.cs
- StorageMappingItemCollection.cs
- StringOutput.cs
- CaseInsensitiveComparer.cs
- ExeContext.cs