Export (0) Print
Expand All

Seconds Property (Duration)

Gets or sets the number of seconds that the Duration represents.

XAML
No direct attribute syntax; see Remarks.
Scripting
value = object.Seconds
object.Seconds = value

Property Value

Double

The number of seconds that the Duration represents.

This property is read/write. The default value is 0.

Remarks

You cannot set the Seconds property as a distinct attribute of a Duration in XAML, because it is not possible to create a Duration element in XAML.

You can set or get the Seconds value in script using object.property syntax, after getting an existing Duration from a property value such as TimeLine.Duration. You can set the value on a running animation, and the value will apply immediately. The new current state of the animation will reflect the progress of the animation that had already run prior to the change, with that same progress applied towards the new Duration. Setting a Seconds value on an animation that previously had Automatic or Forever behavior has this same effect.

If the Duration for an animation is not explicitly set (either through scripting or XAML), then the value of object.Duration will be null. In this case, scripting for object.Duration.Seconds will produce an error, because the Duration is null.

The Seconds value is the converted summation of all the possible unit inputs for a Duration. For instance, a Duration created with an attribute value of "0:01:00.555" will have a Seconds value of 60.555. Only the Seconds property exists for getting the representative value in script; there are no JavaScript object model scripting properties for "Minutes", "Days", "Milliseconds", etc. The Seconds value is 0 for a Duration created with an attribute value of "Automatic" or "Forever".

Applies To

Duration

See Also

Animation Overview

Community Additions

Show:
© 2014 Microsoft