B4J Tutorial [ABMaterial] Animating about anything

I'm finalizing version 1.07, and one of the new things you will be able to do is animate ABMContainers (and ergo all its child components. Here is a demo animating a slide in/slide out of a ABMCard and a blur effect on a ABMCodeLabel component.

ABMMaterial 1.07 will go out to the donators by the end of this week.


Again, this can be done with very little B4J code:

B4X:
    ' create the container with animation   
   
    ' you ALWAYS need an Initial state, duration should be 0 for the initial state
    Dim myAnim1 As ABMAnimation
    myAnim1.Initialize("initial", 0, ABM.TWEEN_EASEINQUAD)
    myAnim1.SlideLeft ' move it a screen to the left so it is out of view
    myAnim1.ScaleX(0)
    myAnim1.ScaleY(0)
    myAnim1.RotateY(-180)
    page.AddAnimation(myAnim1)
   
    ' we create an animation to 'fade in'
    Dim myAnim2 As ABMAnimation
    myAnim2.Initialize("animin", 500, ABM.TWEEN_EASEINQUAD)
    myAnim2.SlideInPositionX ' sliding in the 'normal' position where it would be if no animation was used
    myAnim2.ScaleX(1)
    myAnim2.ScaleY(1)
    myAnim2.RotateY(0)
    page.AddAnimation(myAnim2)   
   
    ' we create an animation to 'fade out'
    Dim myAnim3 As ABMAnimation
    myAnim3.Initialize("animout", 500, ABM.TWEEN_EASEINQUAD)
    myAnim3.SlideRight ' move it a screen to the right so it is out of view.  We later ae going to set it left again withthe 'initial' animation.
    myAnim3.ScaleX(0)
    myAnim3.ScaleY(0)
    myAnim3.RotateY(-180)
    page.AddAnimation(myAnim3)
   
    Dim cont2 As ABMContainer
    ' new initialize method where you have to set your initial animation
    cont2.InitializeAnimated(page, "cont2", "initial", "")
    cont2.AddRowsM(1,False,0,0, "").AddCells12(1,"")
    cont2.BuildGrid ' IMPORTANT   
   
    ' we can put anything in the container, so for the demo, let's use an ABMCard
    Dim tmpCard As ABMCard
    tmpCard.InitializeAsCard(page, "card1", DateTime.Date(DateTime.Now) & " " & DateTime.Time(DateTime.now), "This is a new animated card", ABM.CARD_LARGE, "whitetitle")
    tmpCard.Image = "../images2/16.jpg"
    tmpCard.AddAction("BUTTON 1")   
    ' add the card
    cont2.Cell(1,1).AddComponent(tmpCard)
   
    page.Cell(7,1).AddComponent(cont2)
 
Top