Skip to content

Commit

Permalink
changing UI into new concept
Browse files Browse the repository at this point in the history
  • Loading branch information
hani-sayegh committed Mar 10, 2017
1 parent 2f69418 commit cca0bf3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Assets/Scene/Test Scenes/Networking Test.unity
Original file line number Diff line number Diff line change
Expand Up @@ -2494,7 +2494,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1681601057
RectTransform:
m_ObjectHideFlags: 0
Expand Down
28 changes: 28 additions & 0 deletions Assets/hanisstuff/scripts/TimeLineUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ void Update()
{
foreach (var second in secondsOnScreen)
{
animate(second);
second.rectTransform.anchoredPosition += Vector2.left * direction * widthBetweenSeconds * Time.deltaTime;
var charOrigin = second.rectTransform.anchoredPosition.x;
//In pixels
Expand Down Expand Up @@ -103,4 +104,31 @@ void Update()
}

}

void animate(Text second)
{
var currPos = second.rectTransform.position.x;
var offsetFromMidpoint = 150;
if (currPos < midpoint + offsetFromMidpoint && currPos > midpoint)
{
var distanceFromMidpoint = currPos - midpoint;
var ratio = (offsetFromMidpoint - distanceFromMidpoint) / offsetFromMidpoint;
second.fontSize = 15 + (int)(ratio * 15);
//remove this
if (second.fontSize > 30)
second.fontSize = 30;
}
else if (currPos > midpoint - offsetFromMidpoint && currPos < midpoint)
{
//take abs
var distanceFromMidpoint = midpoint - currPos;
var ratio = (offsetFromMidpoint - distanceFromMidpoint) / offsetFromMidpoint;
second.fontSize = 15 + (int)(ratio * 15);
}
}
}


//current + scale* 15;
//015--------------|301
// distance = x;

0 comments on commit cca0bf3

Please sign in to comment.