THuiInteractionInterval Class Reference

class THuiInteractionInterval

THuiInteractionInterval is a utility class that can be used to determine the correct animation interval time, while taking into account how much time has elapsed since the last time the interval was determined.

An interaction interval is useful for example when animating a list selector. By default, the time interval for moving between two items could be 500 ms, but if the user moves faster than this, the selector's animation may be unnecessarily delayed. In this situation, the interaction interval would shorten the time interval for the moving animation, if necessary, to keep better in sync with how quickly the user is moving in the list.

Public Member Functions
THuiInteractionInterval(TReal32)
IMPORT_C TIntInterval(TInt)
IMPORT_C TReal32Scalar()
IMPORT_C voidSetScalar(TReal32)
Private Attributes
TUint32 iLastTimeMs
TReal32 iScalar

Constructor & Destructor Documentation

THuiInteractionInterval(TReal32)

IMPORT_CTHuiInteractionInterval(TReal32aScalar = 2.0f)

Initializes the interaction interval.

SetScalar()

Parameters

TReal32 aScalar = 2.0fDetermines how strongly the interval adapts.

Member Functions Documentation

Interval(TInt)

IMPORT_C TIntInterval(TIntaIntervalTime)

Evaluates the current interval. The evaluated interval will always be at least as large as the elapsed time since the last evaluation, but at most aIntervalTime.

SetScalar()

Parameters

TInt aIntervalTimeThe requested normal interval time.

Scalar()

IMPORT_C TReal32Scalar()const

Returns the current adapation scalar.

SetScalar(TReal32)

IMPORT_C voidSetScalar(TReal32aScalar)

Sets the adaptation scalar. Determines how strongly the interval will adapt to the elapsed time since the last evaluation.

For example, 1.0 would mean that the maximum interval time is the time elapsed between the current evaluation and the previous one. In this case, when the animation frequency stays the same, each sequence would have time to complete before the next sequence begins. When the scalar is 2.0, the maximum is twice the elapsed time, meaning that the ongoing animation sequence would always be finished halfway when the next sequence begins. This produces a smoother end result.

Parameters

TReal32 aScalarNew adaptation scalar.

Member Data Documentation

TUint32 iLastTimeMs

TUint32 iLastTimeMs[private]

Last time interaction interval was determined.

TReal32 iScalar

TReal32 iScalar[private]

Interval scalar.