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
- FastPropertyAccessor.cs
- ParamArrayAttribute.cs
- CodeConditionStatement.cs
- CloseCryptoHandleRequest.cs
- WriterOutput.cs
- __TransparentProxy.cs
- Point3DCollectionConverter.cs
- FileSystemEventArgs.cs
- NativeMethods.cs
- RunClient.cs
- ConfigurationLocation.cs
- UidPropertyAttribute.cs
- RemotingSurrogateSelector.cs
- XmlCharType.cs
- HttpTransportElement.cs
- ConstructorArgumentAttribute.cs
- PathTooLongException.cs
- DataDesignUtil.cs
- GridEntryCollection.cs
- ByteAnimationBase.cs
- RawStylusActions.cs
- FileUtil.cs
- StaticResourceExtension.cs
- ToolStripControlHost.cs
- ImageProxy.cs
- ContentType.cs
- SafeEventLogReadHandle.cs
- XmlSchemaObject.cs
- coordinatorscratchpad.cs
- PropertyOrder.cs
- LayoutEngine.cs
- SourceElementsCollection.cs
- MetadataItem_Static.cs
- ConditionChanges.cs
- XmlSchemaAnyAttribute.cs
- AdornedElementPlaceholder.cs
- MDIWindowDialog.cs
- SelectionChangedEventArgs.cs
- XmlEntityReference.cs
- HtmlInputSubmit.cs
- RelationshipSet.cs
- PropertyDescriptors.cs
- UIElementParaClient.cs
- HelpKeywordAttribute.cs
- IntSecurity.cs
- CleanUpVirtualizedItemEventArgs.cs
- BamlBinaryWriter.cs
- NamespaceQuery.cs
- DataObjectPastingEventArgs.cs
- MaskInputRejectedEventArgs.cs
- UncommonField.cs
- BasicKeyConstraint.cs
- NumericUpDownAccelerationCollection.cs
- RangeContentEnumerator.cs
- QueueProcessor.cs
- FieldNameLookup.cs
- XamlSerializationHelper.cs
- URI.cs
- MetadataArtifactLoaderCompositeFile.cs
- UrlPropertyAttribute.cs
- SHA512Managed.cs
- XamlStream.cs
- __Filters.cs
- SchemaElementDecl.cs
- SmtpNetworkElement.cs
- ExpressionReplacer.cs
- UnitySerializationHolder.cs
- InvalidChannelBindingException.cs
- SimpleMailWebEventProvider.cs
- RectIndependentAnimationStorage.cs
- HostingPreferredMapPath.cs
- RequestContextBase.cs
- Filter.cs
- ToolStripSystemRenderer.cs
- SqlConnection.cs
- CodeIdentifiers.cs
- DeclarativeCatalogPart.cs
- QueryContinueDragEvent.cs
- HttpStreamFormatter.cs
- InvalidEnumArgumentException.cs
- BindingMAnagerBase.cs
- WindowsListViewItem.cs
- RelationshipDetailsRow.cs
- TreeNodeEventArgs.cs
- ACE.cs
- WasHttpHandlersInstallComponent.cs
- Types.cs
- StringSorter.cs
- TextDecorations.cs
- EntityDataSourceWizardForm.cs
- CoTaskMemUnicodeSafeHandle.cs
- InvalidContentTypeException.cs
- Ticks.cs
- ComponentResourceKey.cs
- ResourceContainer.cs
- DoubleSumAggregationOperator.cs
- CacheMemory.cs
- TrustLevelCollection.cs
- TreeViewImageGenerator.cs
- WindowProviderWrapper.cs