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_CTAlfTimedValue()

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

TAlfTimedValue(TReal32)

IMPORT_CTAlfTimedValue(TReal32aInitialValue)

Constructor. Enables initial value setting.

Parameters

TReal32 aInitialValueInitial value.

TAlfTimedValue(TReal32, TInt)

IMPORT_CTAlfTimedValue(TReal32aTargetValue,
TIntaTime
)

Constructor. Enables target value setting.

Parameters

TReal32 aTargetValueTarget value.
TInt aTimeWhen the target value will be in effect. Transition duration in milliseconds.

Member Functions Documentation

Flags()

IMPORT_C TInt &Flags()

Gets flags.

MappingFunctionIdentifier()

IMPORT_C TIntMappingFunctionIdentifier()const

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

SetMappingFunctionIdentifier(TInt)

IMPORT_C voidSetMappingFunctionIdentifier(TIntaIdentifier)

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

Parameters

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

SetStyle(TAlfInterpolationStyle)

IMPORT_C voidSetStyle(TAlfInterpolationStyleaStyle)

Sets the interpolation style of the timed value.

Parameters

TAlfInterpolationStyle aStyleInterpolation style used to reach target value.

SetTarget(const TReal32 &, TInt)

IMPORT_C voidSetTarget(const TReal32 &aTarget,
TIntaTime
)

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

Parameters

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

SetTargetWithSpeed(TReal32, TReal32)

IMPORT_C voidSetTargetWithSpeed(TReal32aTarget,
TReal32aUnitsPerSecond
)

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

Parameters

TReal32 aTargetNew target value.
TReal32 aUnitsPerSecondSpeed of change.

SetValueNow(const TReal32 &)

IMPORT_C voidSetValueNow(const TReal32 &aValueNow)

Set a new current value Change becomes effective immediately.

Parameters

const TReal32 & aValueNowNew currentvalue.

Speed()

IMPORT_C TReal32Speed()const

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

Style()

IMPORT_C TAlfInterpolationStyleStyle()

Gets the interpolation style of the timed value.

Target()

IMPORT_C TReal32Target()const

Gets target value.

TimeToTargetinMilliSeconds()

IMPORT_C TIntTimeToTargetinMilliSeconds()const

Gets duration of the transition.

ValueNow()

IMPORT_C TReal32ValueNow()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]