{
private Window window;
private ImageView providerImage;
+ private bool isAnimating;
public delegate void AnimationEventHandler();
internal event AnimationEventHandler AnimationInitialized;
internal DefaultFrameBroker(Window window) : base(window)
{
this.window = window;
+ isAnimating = false;
}
protected override void OnFrameResumed(FrameData frame)
{
+ if(isAnimating)
+ {
+ return;
+ }
+ isAnimating = true;
base.OnFrameResumed(frame);
if (AnimationInitialized != null)
{
if (animation)
{
providerImage = frame.Image;
- providerImage.Size = window.Size;
- window.Add(providerImage);
+ providerImage.PositionUsesPivotPoint = true;
+ providerImage.PivotPoint = animation.GetDefaultPivotPoint();
+ providerImage.ParentOrigin = animation.GetDefaultParentOrigin();
+ providerImage.Position = animation.GetDefaultPosition();
+ providerImage.Size = animation.GetDefaultSize();
- providerImage.PositionX = animation.GetDefaultInitValue();
+ window.Add(providerImage);
animation.PlayAnimateTo(providerImage);
}
}
}
+
private TransitionAnimation forwardAnimation;
internal TransitionAnimation ForwardAnimation
{
providerImage = null;
}
FinishAnimation();
+ isAnimating = false;
}
}
}
}
- internal virtual int GetDefaultInitValue()
+ /// <summary>
+ /// Return default size of main view.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual Size GetDefaultSize()
+ {
+ return new Size(0, 0);
+ }
+
+ /// <summary>
+ /// Return default position of main view.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual Position GetDefaultPosition()
+ {
+ return new Position(0, 0);
+ }
+
+ /// <summary>
+ /// Return default position of main view.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual Position GetDefaultParentOrigin()
+ {
+ return ParentOrigin.Center;
+ }
+
+ /// <summary>
+ /// Return default position of main view.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual Position GetDefaultPivotPoint()
{
- return 0;
+ return PivotPoint.Center;
}
+
}
/// <summary>
defaultInitValue = -Window.Instance.GetWindowSize().Width;
}
- internal override int GetDefaultInitValue()
+ /// <summary>
+ /// Return default position of main view.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Position GetDefaultPosition()
+ {
+ return new Position(defaultInitValue, 0);
+ }
+
+ /// <summary>
+ /// Return default size of main view.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual Size GetDefaultSize()
{
- return defaultInitValue;
+ return Window.Instance.GetWindowSize();
}
+
}
defaultInitValue = 0;
}
- internal override int GetDefaultInitValue()
+ /// <summary>
+ /// Return default position of main view.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Position GetDefaultPosition()
+ {
+ return new Position(defaultInitValue, 0);
+ }
+
+ /// <summary>
+ /// Return default size of main view.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual Size GetDefaultSize()
{
- return defaultInitValue;
+ return Window.Instance.GetWindowSize();
}
}
}
class Program : NUIApplication
{
private UICreator uiCreator;
+ private SeamlessForwardAnimation fAnimation;
+ private SeamlessBackwardAnimation bAnimation;
+
protected override void OnCreate()
{
base.OnCreate();
TransitionOptions = new TransitionOptions(GetDefaultWindow());
TransitionOptions.EnableTransition = true;
- TransitionOptions.ForwardAnimation = new SlideIn(1300);
- TransitionOptions.BackwardAnimation = new SlideOut(1300);
+ fAnimation = new SeamlessForwardAnimation(uiCreator, 600);
+ bAnimation = new SeamlessBackwardAnimation(uiCreator, 600);
+ TransitionOptions.ForwardAnimation = fAnimation;
+ //TransitionOptions.BackwardAnimation = bAnimation;
+
+ TransitionOptions.AnimationInitialized += TransitionOptions_AnimationInitialized;
//(launchBroker as SeamlessAnimator)?.SetUICreator(uiCreator);
}
+ private void TransitionOptions_AnimationInitialized(object sender, EventArgs e)
+ {
+ fAnimation.InitAnimation();
+ //bAnimation.InitAnimation();
+ }
+
+ protected override void OnResume()
+ {
+ base.OnResume();
+ }
protected override void OnPause()
{
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Tizen.NUI;
-using Tizen.NUI.BaseComponents;
-
-namespace NUIBrokerSample
-{
- class SeamlessAnimation : TransitionAnimation
- {
- private Size DEFAULT_POPUP_SIZE = new Size(470, 600);
-
- private Window window;
-
- private Position DefaultIconPos;
- private Position DefaultAddIconPos;
- private Position DefaultMainPos;
- private Position DefaultSubPos;
- private Position DefaultMainViewPos;
-
- private ImageView imgView = null;
- private Animation transitionAnimation = null;
- private bool isForward = false;
-
-
- private UICreator uiCreator;
-
- public SeamlessAnimation(int durationMilliSeconds) : base(durationMilliSeconds)
- {
- }
-
- protected void TestAnimation()
- {
- DestroyImagView();
- ResetAnimation();
-// ResetImageView(frame.Image);
-
- isForward = true;
- if (isForward == true)
- {
- StoreInitDate();
-
- transitionAnimation.AnimateTo(uiCreator.AnimationView, "Size", new Size(window.Size), 50, 600);
- transitionAnimation.AnimateTo(uiCreator.AnimationView, "Position", new Position(0, 0), 50, 600);
- transitionAnimation.AnimateTo(imgView, "Size", new Size(window.Size), 200, 600);
-
- transitionAnimation.AnimateTo(uiCreator.IconView, "Position", new Position(0, 150), 0, 300);
- transitionAnimation.AnimateTo(uiCreator.AddView, "Position", new Position(30, 180), 0, 300);
-
- transitionAnimation.AnimateTo(uiCreator.IconView, "Scale", new Vector3(1.3f, 1.3f, 1.0f), 0, 300);
- transitionAnimation.AnimateTo(uiCreator.AddView, "Scale", new Vector3(0.7f, 0.7f, 1.0f), 0, 300);
-
- uiCreator.MainView.Hide();
- uiCreator.MainProfileText.Hide();
- uiCreator.SubProfileText.Hide();
- }
- else
- {
- transitionAnimation.AnimateTo(uiCreator.AnimationView, "Size", DEFAULT_POPUP_SIZE, 50, 600);
- transitionAnimation.AnimateTo(uiCreator.AnimationView, "Position", DefaultMainViewPos, 50, 600);
- transitionAnimation.AnimateTo(imgView, "Size", DEFAULT_POPUP_SIZE, 200, 600);
-
- transitionAnimation.AnimateTo(uiCreator.IconView, "Position", DefaultIconPos, 400, 600);
- transitionAnimation.AnimateTo(uiCreator.AddView, "Position", DefaultAddIconPos, 400, 600);
-
- transitionAnimation.AnimateTo(uiCreator.IconView, "Scale", new Vector3(1.0f, 1.0f, 1.0f), 400, 600);
- transitionAnimation.AnimateTo(uiCreator.IconView, "Scale", new Vector3(1.0f, 1.0f, 1.0f), 400, 600);
-
- }
-
- transitionAnimation.Finished += Ani_Finished;
- transitionAnimation.Play();
- //StartAnimation();
- }
-
- private void Ani_Finished(object sender, EventArgs e)
- {
- //FinishAnimation();
- Timer timer = new Timer(30);
- timer.Tick += Timer_Tick;
- timer.Start();
- }
-
- private bool Timer_Tick(object source, Timer.TickEventArgs e)
- {
- DestroyImagView();
- if (!isForward)
- {
- uiCreator.MainView.Show();
- uiCreator.MainProfileText.Show();
- uiCreator.SubProfileText.Show();
- }
- return false;
- }
-
- private void ResetAnimation()
- {
- if (transitionAnimation != null)
- {
- transitionAnimation.Reset();
- transitionAnimation.Clear();
- transitionAnimation.Dispose();
- transitionAnimation = null;
- }
- transitionAnimation = new Animation(600);
- transitionAnimation.DefaultAlphaFunction = GetSineInOut80();
- }
-
- private void DestroyImagView()
- {
- if(imgView != null)
- {
- imgView.LowerToBottom();
- imgView.Hide();
- imgView.Unparent();
- imgView.Dispose();
- imgView = null;
- }
- }
-
- private void ResetImageView(ImageView imgFrame)
- {
- imgView = imgFrame;
- imgView.ParentOrigin = ParentOrigin.TopCenter;
- imgView.PivotPoint = PivotPoint.TopCenter;
- imgView.PositionUsesPivotPoint = true;
- imgView.CornerRadius = 50.0f;
-
- uiCreator.AnimationView.Add(imgView);
- imgView.LowerToBottom();
- }
-
- private void StoreInitDate()
- {
- DefaultIconPos = uiCreator.IconView.Position;
- DefaultAddIconPos = uiCreator.AddView.Position;
- DefaultMainPos = uiCreator.MainProfileText.Position;
- DefaultSubPos = uiCreator.SubProfileText.Position;
- DefaultMainViewPos = uiCreator.MainView.Position;
-
- imgView.Size = DEFAULT_POPUP_SIZE;
- uiCreator.AnimationView.Size = DEFAULT_POPUP_SIZE;
- }
-
- internal AlphaFunction GetSineInOut80()
- {
- return new AlphaFunction(new Vector2(0.45f, 0.43f), new Vector2(0.41f, 1.0f));
- }
- }
-}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+
+namespace NUIBrokerSample
+{
+ class SeamlessBackwardAnimation : TransitionAnimation
+ {
+ private Size DEFAULT_POPUP_SIZE = new Size(470, 600);
+
+ private Window window;
+
+ private Position DefaultIconPos;
+ private Position DefaultAddIconPos;
+ private Position DefaultMainPos;
+ private Position DefaultSubPos;
+ private Position DefaultMainViewPos;
+
+ private int durationMilliSeconds;
+ private UICreator uiCreator;
+
+ public SeamlessBackwardAnimation(UICreator uiCreator, int durationMilliSeconds) : base(durationMilliSeconds)
+ {
+ this.durationMilliSeconds = durationMilliSeconds;
+ window = Window.Instance;
+ this.uiCreator = uiCreator;
+
+ int propertyCount = 4;
+ Properties = new string[propertyCount];
+ DestValue = new string[propertyCount];
+ StartTime = new int[propertyCount];
+ EndTime = new int[propertyCount];
+ for (int i = 0; i < propertyCount; i++)
+ {
+ StartTime[i] = 200;
+ EndTime[i] = durationMilliSeconds;
+ }
+
+ DefaultAlphaFunction = GetSineInOut80();
+
+ }
+ private void SetupAnimationData()
+ {
+ Properties[0] = "SizeWidth";
+ DestValue[0] = DEFAULT_POPUP_SIZE.Width.ToString();
+
+ Properties[1] = "SizeHeight";
+ DestValue[1] = DEFAULT_POPUP_SIZE.Height.ToString();
+
+ Properties[2] = "PositionX";
+ DestValue[2] = DefaultMainViewPos.X.ToString();
+
+ Properties[3] = "PositionY";
+ DestValue[3] = DefaultMainViewPos.Y.ToString();
+
+ }
+
+ public void InitAnimation()
+ {
+ Animation ani = new Animation(durationMilliSeconds);
+ ani.DefaultAlphaFunction = GetSineInOut80();
+
+ StoreInitDate();
+ SetupAnimationData();
+
+ this.AnimateTo(uiCreator.AnimationView, "Size", DEFAULT_POPUP_SIZE, 50, 600);
+ this.AnimateTo(uiCreator.AnimationView, "Position", DefaultMainViewPos, 50, 600);
+ //this.AnimateTo(imgView, "Size", DEFAULT_POPUP_SIZE, 200, 600);
+
+ this.AnimateTo(uiCreator.IconView, "Position", DefaultIconPos, 400, 600);
+ this.AnimateTo(uiCreator.AddView, "Position", DefaultAddIconPos, 400, 600);
+
+ this.AnimateTo(uiCreator.IconView, "Scale", new Vector3(1.0f, 1.0f, 1.0f), 400, 600);
+ this.AnimateTo(uiCreator.IconView, "Scale", new Vector3(1.0f, 1.0f, 1.0f), 400, 600);
+
+ ani.Finished += Ani_Finished;
+ ani.Play();
+ }
+
+ private void Ani_Finished(object sender, EventArgs e)
+ {
+ //FinishAnimation();
+ Timer timer = new Timer(30);
+ timer.Tick += Timer_Tick;
+ timer.Start();
+ }
+
+ private bool Timer_Tick(object source, Timer.TickEventArgs e)
+ {
+ uiCreator.MainView.Show();
+ uiCreator.MainProfileText.Show();
+ uiCreator.SubProfileText.Show();
+ return false;
+ }
+
+ private void StoreInitDate()
+ {
+ DefaultIconPos = uiCreator.IconView.Position;
+ DefaultAddIconPos = uiCreator.AddView.Position;
+ DefaultMainPos = uiCreator.MainProfileText.Position;
+ DefaultSubPos = uiCreator.SubProfileText.Position;
+ DefaultMainViewPos = uiCreator.MainView.Position;
+
+ uiCreator.AnimationView.Size = DEFAULT_POPUP_SIZE;
+ }
+
+ internal AlphaFunction GetSineInOut80()
+ {
+ return new AlphaFunction(new Vector2(0.45f, 0.43f), new Vector2(0.41f, 1.0f));
+ }
+
+
+ public override Position GetDefaultPosition()
+ {
+ return DefaultMainViewPos;
+ }
+
+ public override Size GetDefaultSize()
+ {
+ return new Size(0, 0);
+ }
+
+ public override Position GetDefaultParentOrigin()
+ {
+ return ParentOrigin.TopCenter;
+ }
+
+ public override Position GetDefaultPivotPoint()
+ {
+ return PivotPoint.TopCenter;
+ }
+
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+
+namespace NUIBrokerSample
+{
+ class SeamlessForwardAnimation : TransitionAnimation
+ {
+ private Size DEFAULT_POPUP_SIZE = new Size(470, 600);
+
+ private Window window;
+
+ private Position DefaultIconPos;
+ private Position DefaultAddIconPos;
+ private Position DefaultMainViewPos;
+
+ private int durationMilliSeconds;
+ private UICreator uiCreator;
+
+ public SeamlessForwardAnimation(UICreator uiCreator, int durationMilliSeconds) : base(durationMilliSeconds)
+ {
+ this.durationMilliSeconds = durationMilliSeconds;
+ window = Window.Instance;
+ this.uiCreator = uiCreator;
+
+ int propertyCount = 4;
+ Properties = new string[propertyCount];
+ DestValue = new string[propertyCount];
+ StartTime = new int[propertyCount];
+ EndTime = new int[propertyCount];
+ for (int i = 0; i < propertyCount; i++)
+ {
+ StartTime[i] = 200;
+ EndTime[i] = durationMilliSeconds;
+ }
+
+ Properties[0] = "SizeWidth";
+ DestValue[0] = Window.Instance.WindowSize.Width.ToString();
+
+ Properties[1] = "SizeHeight";
+ DestValue[1] = Window.Instance.WindowSize.Height.ToString();
+
+ Properties[2] = "PositionX";
+ DestValue[2] = "0";
+
+ Properties[3] = "PositionY";
+ DestValue[3] = "0";
+
+ DefaultAlphaFunction = GetSineInOut80();
+
+ }
+
+ public void InitAnimation()
+ {
+ Animation ani = new Animation(durationMilliSeconds);
+ ani.DefaultAlphaFunction = GetSineInOut80();
+
+ StoreInitDate();
+ uiCreator.MainView.Hide();
+ //ani.AnimateTo(uiCreator.AnimationView, "Size", new Size(window.Size), 50, 600);
+ ani.AnimateTo(uiCreator.AnimationView, "Position", new Position(0, 0), 50, 600);
+
+ ani.AnimateTo(uiCreator.IconView, "Position", new Position(0, 150), 0, 300);
+ ani.AnimateTo(uiCreator.AddView, "Position", new Position(30, 180), 0, 300);
+
+ ani.AnimateTo(uiCreator.IconView, "Scale", new Vector3(1.3f, 1.3f, 1.0f), 0, 300);
+ ani.AnimateTo(uiCreator.AddView, "Scale", new Vector3(0.7f, 0.7f, 1.0f), 0, 300);
+
+ ani.Finished += Ani_Finished;
+ ani.Play();
+ }
+
+ private void Ani_Finished(object sender, EventArgs e)
+ {
+ uiCreator.AnimationView.Position = DefaultMainViewPos;
+ uiCreator.IconView.Position = DefaultIconPos;
+ uiCreator.IconView.Scale = new Vector3(1.0f, 1.0f, 1.0f);
+ uiCreator.AddView.Position = DefaultAddIconPos;
+ uiCreator.AddView.Scale = new Vector3(1.0f, 1.0f, 1.0f);
+ uiCreator.AnimationView.Size = new Size(470, 600);
+ uiCreator.MainView.Show();
+ }
+
+ private void StoreInitDate()
+ {
+ DefaultIconPos = new Position(-160, 80); //uiCreator.IconView.Position;
+ DefaultAddIconPos = new Position(160, 80); //uiCreator.AddView.Position;
+
+ DefaultMainViewPos = uiCreator.MainView.Position;
+ uiCreator.AnimationView.Size = DEFAULT_POPUP_SIZE;
+ }
+
+ internal AlphaFunction GetSineInOut80()
+ {
+ return new AlphaFunction(new Vector2(0.45f, 0.43f), new Vector2(0.41f, 1.0f));
+ }
+
+
+ public override Position GetDefaultPosition()
+ {
+ return DefaultMainViewPos;
+ }
+
+ public override Size GetDefaultSize()
+ {
+ return new Size(0, 0);
+ }
+
+ public override Position GetDefaultParentOrigin()
+ {
+ return ParentOrigin.TopCenter;
+ }
+
+ public override Position GetDefaultPivotPoint()
+ {
+ return PivotPoint.TopCenter;
+ }
+
+ }
+}
public UICreator(NUIApplication app)
{
application = app;
- CreateMobileSize();
+ CreateFHubSize();
}
private void CreateMobileSize()
{
public UICreator()
{
- //CreateFHubSize();
- CreateMobileSize();
+ CreateFHubSize();
}
public void CreateMobileSize()
{