X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Ftransition-data-impl.cpp;h=a91b8ab6fef81d03e96200ccee3294bec2546475;hp=30c0deef89d561c99b71bece2a0dd1bc3dd1d7b6;hb=8641983679bb074a9951c2df9fff7ac6cbf5f5f2;hpb=bf8ef7cb5b533057ad73140803e59acd3c0b0914 diff --git a/dali-toolkit/internal/visuals/transition-data-impl.cpp b/dali-toolkit/internal/visuals/transition-data-impl.cpp index 30c0dee..a91b8ab 100644 --- a/dali-toolkit/internal/visuals/transition-data-impl.cpp +++ b/dali-toolkit/internal/visuals/transition-data-impl.cpp @@ -169,68 +169,119 @@ TransitionData::Animator* TransitionData::ConvertMap( const Property::Map& map) if( key == TOKEN_ALPHA_FUNCTION ) { - std::string alphaFunctionValue = value.Get< std::string >(); + if( value.GetType() == Property::ARRAY ) + { + bool valid = true; + Vector4 controlPoints; + Property::Array *array = value.GetArray(); + if( array && array->Count() >= 4 ) + { + for( size_t vecIdx = 0; vecIdx < 4; ++vecIdx ) + { + Property::Value& v = array->GetElementAt(vecIdx); + if( v.GetType() == Property::FLOAT ) + { + controlPoints[vecIdx] = v.Get(); + } + else + { + valid = false; + break; + } + } + } + else + { + valid = false; + } - if( alphaFunctionValue == "LINEAR" ) + if( valid ) + { + Vector2 controlPoint1( controlPoints.x, controlPoints.y ); + Vector2 controlPoint2( controlPoints.z, controlPoints.w ); + animator->alphaFunction = AlphaFunction( controlPoint1, controlPoint2 ); + } + else + { + animator->animate = false; + } + } + else if( value.GetType() == Property::VECTOR4 ) { - animator->alphaFunction = AlphaFunction::LINEAR; + Vector4 controlPoints = value.Get(); + Vector2 controlPoint1( controlPoints.x, controlPoints.y ); + Vector2 controlPoint2( controlPoints.z, controlPoints.w ); + animator->alphaFunction = AlphaFunction( controlPoint1, controlPoint2 ); } - else if( ! alphaFunctionValue.compare(0, 5, "EASE_" ) ) + else if( value.GetType() == Property::STRING ) { - if( alphaFunctionValue == "EASE_IN" ) - { - animator->alphaFunction = AlphaFunction::EASE_IN; - } - else if( alphaFunctionValue == "EASE_OUT" ) + std::string alphaFunctionValue = value.Get< std::string >(); + + if( alphaFunctionValue == "LINEAR" ) { - animator->alphaFunction = AlphaFunction::EASE_OUT; + animator->alphaFunction = AlphaFunction(AlphaFunction::LINEAR); } - else if( ! alphaFunctionValue.compare( 5, 3, "IN_" ) ) + else if( ! alphaFunctionValue.compare(0, 5, "EASE_" ) ) { - if( ! alphaFunctionValue.compare(8, -1, "SQUARE" )) + if( alphaFunctionValue == "EASE_IN" ) { - animator->alphaFunction = AlphaFunction::EASE_IN_SQUARE; + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_IN); } - else if( ! alphaFunctionValue.compare(8, -1, "OUT" )) + else if( alphaFunctionValue == "EASE_OUT" ) { - animator->alphaFunction = AlphaFunction::EASE_IN_OUT; + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_OUT); } - else if( ! alphaFunctionValue.compare(8, -1, "OUT_SINE" )) + else if( ! alphaFunctionValue.compare( 5, 3, "IN_" ) ) { - animator->alphaFunction = AlphaFunction::EASE_IN_OUT_SINE; + if( ! alphaFunctionValue.compare(8, -1, "SQUARE" )) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_IN_SQUARE); + } + else if( ! alphaFunctionValue.compare(8, -1, "OUT" )) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_IN_OUT); + } + else if( ! alphaFunctionValue.compare(8, -1, "OUT_SINE" )) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_IN_OUT_SINE); + } + else if( ! alphaFunctionValue.compare(8, -1, "SINE" )) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_IN_SINE); + } } - else if( ! alphaFunctionValue.compare(8, -1, "SINE" )) + else if( ! alphaFunctionValue.compare( 5, 4, "OUT_" ) ) { - animator->alphaFunction = AlphaFunction::EASE_IN_SINE; + if( ! alphaFunctionValue.compare(9, -1, "SQUARE" ) ) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_OUT_SQUARE); + } + else if( ! alphaFunctionValue.compare(9, -1, "SINE" ) ) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_OUT_SINE); + } + else if( ! alphaFunctionValue.compare(9, -1, "BACK" ) ) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_OUT_BACK); + } } } - else if( ! alphaFunctionValue.compare( 5, 4, "OUT_" ) ) + else if( alphaFunctionValue == "REVERSE" ) { - if( ! alphaFunctionValue.compare(9, -1, "SQUARE" ) ) - { - animator->alphaFunction = AlphaFunction::EASE_OUT_SQUARE; - } - else if( ! alphaFunctionValue.compare(9, -1, "SINE" ) ) - { - animator->alphaFunction = AlphaFunction::EASE_OUT_SINE; - } - else if( ! alphaFunctionValue.compare(9, -1, "BACK" ) ) - { - animator->alphaFunction = AlphaFunction::EASE_OUT_BACK; - } + animator->alphaFunction = AlphaFunction(AlphaFunction::REVERSE); + } + else if( alphaFunctionValue == "BOUNCE" ) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::BOUNCE); + } + else if( alphaFunctionValue == "SIN" ) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::SIN); } } - else if( alphaFunctionValue == "REVERSE" ) - { - animator->alphaFunction = AlphaFunction::REVERSE; - } - else if( alphaFunctionValue == "BOUNCE" ) - { - animator->alphaFunction = AlphaFunction::BOUNCE; - } - else if( alphaFunctionValue == "SIN" ) + else { - animator->alphaFunction = AlphaFunction::SIN; + animator->animate = false; } } else if( key == TOKEN_TIME_PERIOD ) @@ -306,13 +357,24 @@ Property::Map TransitionData::GetAnimatorAt( size_t index ) } if( animator->animate ) { - map[TOKEN_ANIMATOR] = Property::Map() - .Add(TOKEN_ALPHA_FUNCTION, GetEnumerationName( animator->alphaFunction, - ALPHA_FUNCTION_BUILTIN_TABLE, - ALPHA_FUNCTION_BUILTIN_TABLE_COUNT )) - .Add(TOKEN_TIME_PERIOD, Property::Map() - .Add( TOKEN_DELAY, animator->timePeriodDelay ) - .Add( TOKEN_DURATION, animator->timePeriodDuration )); + Property::Map animateMap; + + if( animator->alphaFunction.GetMode() == AlphaFunction::BUILTIN_FUNCTION ) + { + animateMap.Add(TOKEN_ALPHA_FUNCTION, GetEnumerationName( animator->alphaFunction.GetBuiltinFunction(), + ALPHA_FUNCTION_BUILTIN_TABLE, + ALPHA_FUNCTION_BUILTIN_TABLE_COUNT )); + } + else if( animator->alphaFunction.GetMode() == AlphaFunction::BEZIER ) + { + Vector4 controlPoints = animator->alphaFunction.GetBezierControlPoints(); + animateMap.Add( TOKEN_ALPHA_FUNCTION, controlPoints ); + } + animateMap.Add(TOKEN_TIME_PERIOD, Property::Map() + .Add( TOKEN_DELAY, animator->timePeriodDelay ) + .Add( TOKEN_DURATION, animator->timePeriodDuration )); + + map[TOKEN_ANIMATOR] = animateMap; } return map;