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 );
Public Member Functions | |
---|---|
TAlfTimedValue () | |
TAlfTimedValue ( TReal32 ) | |
TAlfTimedValue ( TReal32 , TInt ) | |
IMPORT_C TInt & | Flags () |
IMPORT_C TInt | MappingFunctionIdentifier () |
IMPORT_C void | SetMappingFunctionIdentifier ( TInt ) |
IMPORT_C void | SetStyle ( TAlfInterpolationStyle ) |
IMPORT_C void | SetTarget (const TReal32 &, TInt ) |
IMPORT_C void | SetTargetWithSpeed ( TReal32 , TReal32 ) |
IMPORT_C void | SetValueNow (const TReal32 &) |
IMPORT_C TReal32 | Speed () |
IMPORT_C TAlfInterpolationStyle | Style () |
IMPORT_C TReal32 | Target () |
IMPORT_C TInt | TimeToTargetinMilliSeconds () |
IMPORT_C TReal32 | ValueNow () |
Private Attributes | |
---|---|
TInt | iFlags |
TInt | iInterpolationStyle |
TInt | iMappingFunctionIdentifier |
TInt | iSpare1 |
TInt | iSpare2 |
TReal32 | iSpeed |
TInt | iTimeToTarget |
TReal32 | iValueNow |
TReal32 | iValueTarget |
IMPORT_C | TAlfTimedValue | ( | ) |
Constructor. Enables creation of timed value with no explicitly set initial value. The timed value is set to zero.
IMPORT_C | TAlfTimedValue | ( | TReal32 | aInitialValue | ) |
Constructor. Enables initial value setting.
TReal32 aInitialValue | Initial value. |
IMPORT_C | TAlfTimedValue | ( | TReal32 | aTargetValue, |
TInt | aTime | |||
) |
Constructor. Enables target value setting.
IMPORT_C TInt | MappingFunctionIdentifier | ( | ) | const |
Gets identifier of a mapping function that affects the timed value.
IMPORT_C void | SetMappingFunctionIdentifier | ( | TInt | aIdentifier | ) |
Sets identifier of a mapping function that affects the timed value.
TInt aIdentifier | Identifier of a function that will map the current value to required number space. |
IMPORT_C void | SetStyle | ( | TAlfInterpolationStyle | aStyle | ) |
Sets the interpolation style of the timed value.
TAlfInterpolationStyle aStyle | Interpolation style used to reach target value. |
IMPORT_C void | SetTarget | ( | const TReal32 & | aTarget, |
TInt | aTime | |||
) |
Set a new target value that becomes effective after a delay. SetTargetWithSpeed()
IMPORT_C void | SetTargetWithSpeed | ( | TReal32 | aTarget, |
TReal32 | aUnitsPerSecond | |||
) |
Sets a new target value. The transition time depends on the speed. SetTarget()
IMPORT_C void | SetValueNow | ( | const TReal32 & | aValueNow | ) |
Set a new current value Change becomes effective immediately.
const TReal32 & aValueNow | New currentvalue. |
IMPORT_C TReal32 | Speed | ( | ) | const |
Gets speed of the transition in units per second if it has been set with SetTargetWithSpeed.
IMPORT_C TInt | TimeToTargetinMilliSeconds | ( | ) | const |
Gets duration of the transition.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.