B4J Library Transitions and Animations libraries

Hi,

This is a wrapper for the transitions of JavaFX. It's very easy to set up, I have tried to make it very simple:

B4X:
Dim st As ScaleTransition
st.Initialize(Me, 500, ap, "st")
st.AutoReverse = True
st.FromX = 0
st.FromY = 0
st.ToX = 1
st.ToY = 1
st.CycleCount = 1
st.Delay = rnd(50, 200)
st.Play

I have currently ported the Scale, Translate, Rotate and Fade transitions. For each of those transitions, there is an event "Finished" to notify when the animation is over.

Enjoy.

Update: 2016-10-31:
- Grouped all 4 transitions to 1 single library: jTransitions (so you can delete the previous FadeTransition, RotateTransition, ScaleTransition, TranslateTransition libraries)
- passing -1 to cycleCount will play animation indefinitely.
- Added Stop, Pause methods
 

Attachments

  • jTransitions_Lib.zip
    14.6 KB · Views: 752
  • jTransitions_Source.zip
    8.1 KB · Views: 574
  • jTransitions_Demo.zip
    2.8 KB · Views: 657
Last edited:

rayellam

Member
Licensed User
Longtime User
Hi Jmon,
Thanks for this. Is there a way to control which axis is rotated at run time? I can do it through the designer by selecting which axis to rotate but i need to do it at run time.

Thanks
Ray
 

jmon

Well-Known Member
Licensed User
Longtime User

Douglas Farias

Expert
Licensed User
Longtime User
hi @jmon
i m getting this error when i try compile your example
B4J version: 4.50
Parsing code. (0.00s)
Compiling code. (0.03s)
Compiling layouts code. (0.00s)
Compiling generated Java code. Error
B4J line: 20
itm.Initialize(lv, \
javac 1.8.0_111
src\b4j\example\main.java:87: error: method _initialize in class item cannot be applied to given types;
_itm._initialize(ba,_lv,"Item : "+BA.NumberToString(_i));
^
required: item,BA,ListViewWrapper,String
found: BA,ListViewWrapper,String
reason: actual and formal argument lists differ in length
1 error

i dont made any changes, only downloaded and tryed compile this.
some ideia about this error?

thx
 

jmon

Well-Known Member
Licensed User
Longtime User

Douglas Farias

Expert
Licensed User
Longtime User
strange, i have the problem with your example only, but no problem, i m using your fade and transition animation and its working fine, its only on your demo the problem for me.

now i have 3 questions

1 - why when i use fade 0 to 1 i need use visible = true before?
Example
'ANIMAÇÃO SPLASH 1
psplash1.Visible = True
fadesplash1.Initialize(Me, 3000, psplash1, "fadesplash1")
fadesplash1.AutoReverse = True
fadesplash1.CycleCount = 2
fadesplash1.FromValue = 0
fadesplash1.ToValue = 1
fadesplash1.Play
the same for 1 to 0, using 1 to 0 fadeout, the animation works, but i need use visible = false later, if i dont use the view still visible but transparent, i can click on this it will get the click, only change to invisible.
it is a bug or is how works this lib?


2 - can you add the stop function please?


3 - can you add CycleCount = infinite? -1 etc?


many thx man, u saved me with this lib, when my project done i will make a donate for u work.

thx again
 
Last edited:

jmon

Well-Known Member
Licensed User
Longtime User
Hi, I added the Stop, pause, and cyclecount inifinte (-1)
If you set cycleCount = -1, it will play indefinitely

IMPORTANT: I regrouped all 4 previous libraries into 1 single library : jTransitions
-> So you can delete the 4 previous libraries (FadeTransition, RotateTransition, ScaleTransition, TranslateTransition).

I updated the first post, attached the new library, and also added the source.
Update: 2016-10-31:
- Grouped all 4 transitions to 1 single library: jTransitions (so you can delete the previous FadeTransition, RotateTransition, ScaleTransition, TranslateTransition libraries)
- passing -1 to cycleCount will play animation indefinitely.
- Added Stop, Pause methods
 

jmon

Well-Known Member
Licensed User
Longtime User
why when i use fade 0 to 1 i need use visible = true before?
You need to set your pane visible before showing it BUT you should set the alpha to 0:

B4X:
psplash1.Alpha = 0
'then fade from 0 to 1
or
B4X:
dim j as JavaObject = psplash1
j.RunMethod("setAlpha", Array(0.0))
'then fade from 0 to 1

Fade transition does an alpha transition, and not a visibility transition. So your node needs to be visible in the form

Tell me if it's not clear
 

Douglas Farias

Expert
Licensed User
Longtime User
Hi, I added the Stop, pause, and cyclecount inifinte (-1)
If you set cycleCount = -1, it will play indefinitely

IMPORTANT: I regrouped all 4 previous libraries into 1 single library : jTransitions
-> So you can delete the 4 previous libraries (FadeTransition, RotateTransition, ScaleTransition, TranslateTransition).

I updated the first post, attached the new library, and also added the source.
many thx man


You need to set your pane visible before showing it BUT you should set the alpha to 0:

B4X:
psplash1.Alpha = 0
'then fade from 0 to 1
or
B4X:
dim j as JavaObject = psplash1
j.RunMethod("setAlpha", Array(0.0))
'then fade from 0 to 1

Fade transition does an alpha transition, and not a visibility transition. So your node needs to be visible in the form

Tell me if it's not clear


ok, thank you again.
 
Top