TAlfTimedValue Class Reference

class TAlfTimedValue

Timed value class.

Timed values are able to interpolate their value independently based on time. The interpolation can be configured to follow a curve instead of being linear. Timed value does not restrict the value units but interpolates on any given real value. Mapping function can be used that maps the interpolated values to some other real value space. If no mapping function is specified an identity mapping is used. Current values and target values of timed value can be set through class methods. Delays for timed value to achieve the target value can be given in the Set - method. Timed value supports number of different interpolation styles.

        // Here are some examples how the timed value can be used.
   // In the examples, the opacity of the visual is used as
   // an example, but any of the timed values work the same.
 
   // #1 New variable - getters are not really relevant
   TAlfTimedValue opacity;
   opacity->SetTarget( 1, 500 );
   visual->SetOpacity( opacity ); // changes only the target
   
   // 2# Data fetching
   // a) preferred
   const TAlfTimedValue& opacity = visual->Opacity();
   TReal32 valueNow = opacity->ValueNow();
   TReal32 target = opacity->Target();
   // b) 
   TReal32 valueNow = visual->Opacity().ValueNow();
   TReal32 target = visual->Opacity().Target();
   
   // 3# Data fetching and value update
   TAlfTimedValue opacity( visual->Opacity() );
   TReal32 target = opacity->Target();
   opacity->SetTarget( target*2, 500 );
   visual->SetOpacity( opacity );
   
   // 4# Use the same timed value for other places:
   // a)
   const TAlfTimedValue& visualOpacity = visual->Opacity();
   layout->SetOpacity( visualOpacity );
   // b)
   TAlfTimedValue visualOpacity( visual->Opacity() );
   visualOpacity->SetTarget( 1, 500 );
   layout->SetOpacity( visualOpacity );
       
alfclient.lib
Since
S60 v3.2

Constructor & Destructor Documentation

TAlfTimedValue()

IMPORT_C TAlfTimedValue ( )

Constructor. Enables creation of timed value with no explicitly set initial value. The timed value is set to zero.

TAlfTimedValue(TReal32)

IMPORT_C TAlfTimedValue ( TReal32 aInitialValue )

Constructor. Enables initial value setting.

Parameters

TReal32 aInitialValue Initial value.

TAlfTimedValue(TReal32, TInt)

IMPORT_C TAlfTimedValue ( TReal32 aTargetValue,
TInt aTime
)

Constructor. Enables target value setting.

Parameters

TReal32 aTargetValue Target value.
TInt aTime When the target value will be in effect. Transition duration in milliseconds.

Member Functions Documentation

Flags()

IMPORT_C TInt & Flags ( )

Gets flags.

MappingFunctionIdentifier()

IMPORT_C TInt MappingFunctionIdentifier ( ) const

Gets identifier of a mapping function that affects the timed value.

SetMappingFunctionIdentifier(TInt)

IMPORT_C void SetMappingFunctionIdentifier ( TInt aIdentifier )

Sets identifier of a mapping function that affects the timed value.

Parameters

TInt aIdentifier Identifier of a function that will map the current value to required number space.

SetStyle(TAlfInterpolationStyle)

IMPORT_C void SetStyle ( TAlfInterpolationStyle aStyle )

Sets the interpolation style of the timed value.

Parameters

TAlfInterpolationStyle aStyle Interpolation style used to reach target value.

SetTarget(const TReal32 &, TInt)

IMPORT_C void SetTarget ( const TReal32 & aTarget,
TInt aTime
)

Set a new target value that becomes effective after a delay. SetTargetWithSpeed()

Parameters

const TReal32 & aTarget
TInt aTime Time duration after the target value will be in effect. Transition duration in milliseconds.

SetTargetWithSpeed(TReal32, TReal32)

IMPORT_C void SetTargetWithSpeed ( TReal32 aTarget,
TReal32 aUnitsPerSecond
)

Sets a new target value. The transition time depends on the speed. SetTarget()

Parameters

TReal32 aTarget New target value.
TReal32 aUnitsPerSecond Speed of change.

SetValueNow(const TReal32 &)

IMPORT_C void SetValueNow ( const TReal32 & aValueNow )

Set a new current value Change becomes effective immediately.

Parameters

const TReal32 & aValueNow New currentvalue.

Speed()

IMPORT_C TReal32 Speed ( ) const

Gets speed of the transition in units per second if it has been set with SetTargetWithSpeed.

Style()

IMPORT_C TAlfInterpolationStyle Style ( )

Gets the interpolation style of the timed value.

Target()

IMPORT_C TReal32 Target ( ) const

Gets target value.

TimeToTargetinMilliSeconds()

IMPORT_C TInt TimeToTargetinMilliSeconds ( ) const

Gets duration of the transition.

ValueNow()

IMPORT_C TReal32 ValueNow ( ) const

Gets current value.

Member Data Documentation

TInt iFlags

TInt iFlags [private]

TInt iInterpolationStyle

TInt iInterpolationStyle [private]

TInt iMappingFunctionIdentifier

TInt iMappingFunctionIdentifier [private]

TInt iSpare1

TInt iSpare1 [private]

TInt iSpare2

TInt iSpare2 [private]

TReal32 iSpeed

TReal32 iSpeed [private]

TInt iTimeToTarget

TInt iTimeToTarget [private]

TReal32 iValueNow

TReal32 iValueNow [private]

TReal32 iValueTarget

TReal32 iValueTarget [private]