Most Popular Programming Languages 1965 - 2019

AnandGupta

Expert
Licensed User
Longtime User
I found this link in another forum.


The presentation is so cool that I am wondering if we make something similar in B4X, i.e. display big time-line data in such a cool and smooth manner !

And yes, hope B4X goes to top in 2020 !

Regards,

Anand
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
BTW, the code is (surprisingly) simple and the same approach can be used for all kinds of transitions.

The main idea is to keep both the current values and the target values and limit the 'change per tick':
B4X:
Dim ct As CTItem = Items.Get(i)
ct.CurrentValue = CalcNewValue(ct.CurrentValue, ct.TargetValue, MaxDelta / FromValueToPixels)
ct.CurrentHeight = CalcNewValue(ct.CurrentHeight, height, MaxDelta)
ct.CurrentTop = CalcNewValue(ct.CurrentTop, i * height, MaxDelta)

Private Sub CalcNewValue (CurrentValue As Float, TargetValue As Float, MaxDelta As Float) As Float
   If CurrentValue <= TargetValue Then
       Return Min(TargetValue, CurrentValue + MaxDelta)
   Else
       Return Max(TargetValue, CurrentValue - MaxDelta)
   End If
End Sub
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Downloaded the Erel's project attached to post #3.
Before run it, I wanted to read it.
So I immediately noted a strange "type", CoolTimeline. What is it, I thought? Checked the libraries used... nothing.
Well, it should be a class, then.

A class wrote in a few minutes!!!
What envy !!!




However, I know that this is due to the fact that Erel already has all the necessary future code in mind and that... he dictates the code, he doesn't type it
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Great¡¡
@Erel, you should publish it in the main forum in order the example be indexed.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is proof of concept. He will publish the proper class/view of B4X in few days, I presume.
This element is too specialized for me to create a library.
It shouldn't be too difficult to take the code and further extend it as needed.

@Erel, you should publish it in the main forum in order the example be indexed.
I will move the thread to the questions forum.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
ct.CurrentHeight = CalcNewValue(ct.CurrentHeight, height, MaxDelta) ' <------ ? This is not needed/useful
This is not demonstrated in the example but it can be a nice transition if you add more items at runtime (though you will need to make some additional changes and to remove the "SetNow" flag).
 
Upvote 0

rabbitBUSH

Well-Known Member
Licensed User
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
nice video
but the order at end 2019 i do not believe.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…