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
- Misc.cs
- Wizard.cs
- SetIterators.cs
- UIElementIsland.cs
- ChangeConflicts.cs
- KeySpline.cs
- DataRow.cs
- EventSinkHelperWriter.cs
- GridLength.cs
- LineInfo.cs
- RequestQueue.cs
- TreeNodeClickEventArgs.cs
- DataGridViewColumnEventArgs.cs
- ThicknessKeyFrameCollection.cs
- MappingSource.cs
- GraphicsPathIterator.cs
- TextPatternIdentifiers.cs
- ListBindableAttribute.cs
- _NtlmClient.cs
- StylusCollection.cs
- FunctionDescription.cs
- CacheRequest.cs
- Size.cs
- XhtmlMobileTextWriter.cs
- DesigntimeLicenseContext.cs
- CompilationUnit.cs
- BuiltInPermissionSets.cs
- HttpResponse.cs
- Parser.cs
- SchemaNotation.cs
- IdentityNotMappedException.cs
- BitmapEffectInput.cs
- StylusSystemGestureEventArgs.cs
- SQLMoneyStorage.cs
- DataRowExtensions.cs
- FormatException.cs
- ImageButton.cs
- PropertyGeneratedEventArgs.cs
- Profiler.cs
- CompensationTokenData.cs
- ItemsPresenter.cs
- SerializationInfoEnumerator.cs
- mactripleDES.cs
- smtppermission.cs
- TrustManagerPromptUI.cs
- PageParser.cs
- OleDbSchemaGuid.cs
- BinarySerializer.cs
- TdsParserStaticMethods.cs
- MethodMessage.cs
- RegularExpressionValidator.cs
- Rights.cs
- ExpressionBinding.cs
- TimeoutValidationAttribute.cs
- Soap.cs
- WebPartPersonalization.cs
- CodeSubDirectoriesCollection.cs
- BinaryObjectInfo.cs
- WebRequestModulesSection.cs
- ServerValidateEventArgs.cs
- PDBReader.cs
- DynamicRenderer.cs
- PageParserFilter.cs
- RelationshipFixer.cs
- BlobPersonalizationState.cs
- WindowsStatusBar.cs
- ReferentialConstraint.cs
- UserValidatedEventArgs.cs
- ErrorFormatter.cs
- AssociatedControlConverter.cs
- NotificationContext.cs
- ServiceMemoryGates.cs
- TriState.cs
- BevelBitmapEffect.cs
- SafeRightsManagementQueryHandle.cs
- PeerApplicationLaunchInfo.cs
- SoapEnumAttribute.cs
- MSAANativeProvider.cs
- WebPartDescriptionCollection.cs
- NamespaceCollection.cs
- IChannel.cs
- SqlError.cs
- ColorAnimation.cs
- DependencyObjectType.cs
- QilInvokeEarlyBound.cs
- ParagraphVisual.cs
- DrawingGroup.cs
- ProxyWebPartConnectionCollection.cs
- PackageDigitalSignature.cs
- ReadOnlyPropertyMetadata.cs
- _SslStream.cs
- BooleanSwitch.cs
- MouseActionConverter.cs
- BinaryKeyIdentifierClause.cs
- XmlSchemaExternal.cs
- ProcessManager.cs
- PrePrepareMethodAttribute.cs
- TranslateTransform3D.cs
- DataGridViewComboBoxColumn.cs
- FigureHelper.cs