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
- CheckBoxList.cs
- BindingOperations.cs
- RowBinding.cs
- VectorAnimation.cs
- BindableTemplateBuilder.cs
- KeyBinding.cs
- TextSelectionProcessor.cs
- ObjectIDGenerator.cs
- ExpandCollapsePattern.cs
- UrlMappingsSection.cs
- ManagedCodeMarkers.cs
- ComponentResourceKeyConverter.cs
- NamespaceInfo.cs
- SiteMapNodeItem.cs
- BamlBinaryReader.cs
- PrePostDescendentsWalker.cs
- DispatchRuntime.cs
- DecimalSumAggregationOperator.cs
- DataListDesigner.cs
- DateTimeParse.cs
- ResourceProperty.cs
- WindowsFormsHostPropertyMap.cs
- WebPartCatalogCloseVerb.cs
- AxisAngleRotation3D.cs
- BoundsDrawingContextWalker.cs
- Documentation.cs
- ServiceOperation.cs
- RuleInfoComparer.cs
- GlyphRun.cs
- MDIWindowDialog.cs
- CompilerResults.cs
- compensatingcollection.cs
- Transform3DGroup.cs
- SID.cs
- Speller.cs
- SmiMetaDataProperty.cs
- HttpRequestTraceRecord.cs
- IsolationInterop.cs
- HttpBindingExtension.cs
- RecipientInfo.cs
- XmlEntityReference.cs
- StaticFileHandler.cs
- EntityDataSourceStatementEditor.cs
- PasswordTextNavigator.cs
- SqlCaseSimplifier.cs
- WindowsComboBox.cs
- TypeUsageBuilder.cs
- DesignerForm.cs
- MouseOverProperty.cs
- DataColumn.cs
- ExpressionCopier.cs
- MarkupExtensionParser.cs
- ContentFileHelper.cs
- BitmapPalette.cs
- SqlDataReader.cs
- SourceFileInfo.cs
- TextChange.cs
- DynamicActionMessageFilter.cs
- Profiler.cs
- RegexFCD.cs
- TextFormatterHost.cs
- EventProxy.cs
- IsolatedStoragePermission.cs
- CancelEventArgs.cs
- DesignerCategoryAttribute.cs
- SmiXetterAccessMap.cs
- ProfilePropertyMetadata.cs
- SmiXetterAccessMap.cs
- _NegoStream.cs
- AncillaryOps.cs
- WebDescriptionAttribute.cs
- MLangCodePageEncoding.cs
- KeyedHashAlgorithm.cs
- FileSystemInfo.cs
- DataGridViewComboBoxColumn.cs
- SecureUICommand.cs
- DataGridViewAdvancedBorderStyle.cs
- HtmlControl.cs
- Section.cs
- ScrollItemProviderWrapper.cs
- ToolboxComponentsCreatingEventArgs.cs
- ErrorStyle.cs
- ContentElement.cs
- TreeNodeBindingCollection.cs
- PackageRelationshipCollection.cs
- DockProviderWrapper.cs
- MLangCodePageEncoding.cs
- BitmapData.cs
- FamilyMapCollection.cs
- LineVisual.cs
- ClusterUtils.cs
- RoleManagerSection.cs
- EventNotify.cs
- Ipv6Element.cs
- LinqDataSourceDisposeEventArgs.cs
- IndependentAnimationStorage.cs
- DefaultObjectMappingItemCollection.cs
- EventItfInfo.cs
- BehaviorService.cs
- InProcStateClientManager.cs