}
/// <summary>
- /// Create visual animation (transition) with the input property map
+ /// Create visual animation (transition) with the input parameters.
/// </summary>
- /// <param name="visualMap">property map to define visual animation</param>
+ /// <param name="target"> The visual map to animation.</param>
+ /// <param name="property"> The property of visual to animation.</param>
+ /// <param name="destinationValue"> The destination value of property after animation.</param>
+ /// <param name="startTime"> The start time of visual animation.</param>
+ /// <param name="endTime"> The end time of visual animation.</param>
+ /// <param name="alphaFunction"> The alpha function of visual animation</param>
/// <returns>Animation instance</returns>
- public Animation VisualAnimate(VisualAnimator visualMap)
+ public Animation AnimateVisual(VisualMap target, string property, object destinationValue, int startTime, int endTime, AlphaFunction.BuiltinFunctions alphaFunction)
{
+ string _alphaFunction = "";
+ switch (alphaFunction)
+ {
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
+ {
+ _alphaFunction = "LINEAR";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
+ {
+ _alphaFunction = "REVERSE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
+ {
+ _alphaFunction = "EASE_IN_SQUARE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
+ {
+ _alphaFunction = "EASE_OUT_SQUARE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
+ {
+ _alphaFunction = "EASE_IN";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
+ {
+ _alphaFunction = "EASE_OUT";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
+ {
+ _alphaFunction = "EASE_IN_OUT";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
+ {
+ _alphaFunction = "EASE_IN_SINE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
+ {
+ _alphaFunction = "EASE_OUT_SINE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
+ {
+ _alphaFunction = "EASE_IN_OUT_SINE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
+ {
+ _alphaFunction = "BOUNCE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
+ {
+ _alphaFunction = "SIN";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
+ {
+ _alphaFunction = "EASE_OUT_BACK";
+ break;
+ }
+ default:
+ {
+ _alphaFunction = "DEFAULT";
+ break;
+ }
+ }
+
foreach (var item in _visualDictionary.ToList())
{
- if (item.Value.Name == visualMap.Target)
+ if (item.Value.Name == target.Name)
{
- TransitionData _transitionData = new TransitionData(visualMap.OutputVisualMap);
+ PropertyMap _animator = new PropertyMap();
+ _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
+
+ PropertyMap _timePeriod = new PropertyMap();
+ _timePeriod.Add("duration", new PropertyValue((endTime - startTime) / 1000.0f));
+ _timePeriod.Add("delay", new PropertyValue(startTime / 1000.0f));
+ _animator.Add("timePeriod", new PropertyValue(_timePeriod));
+
+ string _str1 = property.Substring(0, 1);
+ string _str2 = property.Substring(1);
+ string _str = _str1.ToLower() + _str2;
+
+ PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
+
+ PropertyMap _transition = new PropertyMap();
+ _transition.Add("target", new PropertyValue(target.Name));
+ _transition.Add("property", new PropertyValue(_str));
+ _transition.Add("targetValue", val);
+ _transition.Add("animator", new PropertyValue(_animator));
+
+ TransitionData _transitionData = new TransitionData(_transition);
return this.CreateTransition(_transitionData);
}
}
}
}
- /// <summary>
- /// A class encapsulating the property map of a visual transition(Animator).
- /// </summary>
- public class VisualAnimator : VisualMap
- {
- public VisualAnimator() : base()
- {
- }
-
- private string _alphaFunction = null;
- private int _startTime = 0;
- private int _endTime = 0;
- private string _target = null;
- private string _propertyIndex = null;
- private object _destinationValue = null;
-
- public AlphaFunction.BuiltinFunctions AlphaFunction
- {
- get
- {
- switch (_alphaFunction)
- {
- case "LINEAR":
- return Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear;
- case "REVERSE":
- return Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse;
- case "EASE_IN_SQUARE":
- return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare;
- case "EASE_OUT_SQUARE":
- return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare;
- case "EASE_IN":
- return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn;
- case "EASE_OUT":
- return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut;
- case "EASE_IN_OUT":
- return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut;
- case "EASE_IN_SINE":
- return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine;
- case "EASE_OUT_SINE":
- return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine;
- case "EASE_IN_OUT_SINE":
- return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine;
- case "BOUNCE":
- return Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce;
- case "SIN":
- return Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin;
- case "EASE_OUT_BACK":
- return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack;
- default:
- return Tizen.NUI.AlphaFunction.BuiltinFunctions.Default;
- }
- }
- set
- {
- switch (value)
- {
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
- {
- _alphaFunction = "LINEAR";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
- {
- _alphaFunction = "REVERSE";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
- {
- _alphaFunction = "EASE_IN_SQUARE";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
- {
- _alphaFunction = "EASE_OUT_SQUARE";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
- {
- _alphaFunction = "EASE_IN";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
- {
- _alphaFunction = "EASE_OUT";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
- {
- _alphaFunction = "EASE_IN_OUT";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
- {
- _alphaFunction = "EASE_IN_SINE";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
- {
- _alphaFunction = "EASE_OUT_SINE";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
- {
- _alphaFunction = "EASE_IN_OUT_SINE";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
- {
- _alphaFunction = "BOUNCE";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
- {
- _alphaFunction = "SIN";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
- {
- _alphaFunction = "EASE_OUT_BACK";
- break;
- }
- default:
- {
- _alphaFunction = "DEFAULT";
- break;
- }
- }
- }
- }
-
- public int StartTime
- {
- get
- {
- return _startTime;
- }
- set
- {
- _startTime = value;
- }
- }
-
- public int EndTime
- {
- get
- {
- return _endTime;
- }
- set
- {
- _endTime = value;
- }
- }
-
- public string Target
- {
- get
- {
- return _target;
- }
- set
- {
- _target = value;
- }
- }
-
- public string PropertyIndex
- {
- get
- {
- return _propertyIndex;
- }
- set
- {
- _propertyIndex = value;
- }
- }
-
- public object DestinationValue
- {
- get
- {
- return _destinationValue;
- }
- set
- {
- _destinationValue = value;
- }
- }
-
- protected override void ComposingPropertyMap()
- {
- PropertyMap _animator = new PropertyMap();
- _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
-
- PropertyMap _timePeriod = new PropertyMap();
- _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
- _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
- _animator.Add("timePeriod", new PropertyValue(_timePeriod));
-
- string _str1 = _propertyIndex.Substring(0, 1);
- string _str2 = _propertyIndex.Substring(1);
- string _str = _str1.ToLower() + _str2;
-
- PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
-
- PropertyMap _transition = new PropertyMap();
- _transition.Add("target", new PropertyValue(_target));
- _transition.Add("property", new PropertyValue(_str));
- _transition.Add("targetValue", val);
- _transition.Add("animator", new PropertyValue(_animator));
-
- _outputVisualMap = _transition;
- }
- }
}