Export (0) Print
Expand All

KeyTime Object

During the relative course of an animation, a KeyTime instance specifies the precise timing when a particular key frame should take place.

XAML
<object property="keyTimeString" .../>
Scripting
object.property="keyTimeString"

keyTimeString Grammar

Type Grammar Example Example result
Time span [days.]hours:minutes:seconds[.fractionalSeconds] "0:0:15" When used as a KeyTime, specifies a key time for a frame at 15 seconds.
  • In the grammar above, [] indicates optional values, the [] are not literals. The : (colon) and . (period) characters are both literals.
  • Values for hours can be any integer value between 0 and 23 inclusive. Values for minutes and seconds can be any integer value between 0 and 59 inclusive. The value for days can be very large, but does have an unspecified upper bound. The decimal value for fractionalSeconds (with the decimal point included) must be between 0 and 1.

Properties

Name, Seconds

Methods

Equals, FindName, GetHost, GetValue, SetValue

Remarks

Creating a Duration, KeyTime, RepeatBehavior, or TimeSpan in XAML or in script is only possible through a type conversion syntax when setting a property such as KeyTime that takes one of these types, with the value specified as a string. The string format for specifying a time in each of these types is identical.

The main scenario for working with a KeyTime as an object in script is to get or set its Seconds property in order to query or change an existing animation value.

Specifying a KeyTime by only an integer without any time span literal characters such as : or . will result in a KeyTime of that number of days! This is seldom the intended result. Usually you specify time spans in seconds. As such, the KeyTime string must include preceding zero values for hours and minutes, along with the appropriate literal : characters as separators between hours, minutes and seconds. For instance, to specify a KeyTime of five seconds, the KeyTime string would be "0:0:5" ("0:0:05" is equivalent).

See Also

Key-Frame Animations Overview

Community Additions

Show:
© 2014 Microsoft