B4i Library [B4X] SD RollingBall

How many times has the need to roll the balls of a billiard table arose. In some gaming applications or anyway with a creative interface it is nice to see moving views that simulate real objects. I started with spinning the dice with the previous library, now I wanted to spin the balls and it seems that he has succeeded. I added the light effect but I turned off the 3D effect

NOTE: You can use this library for personal and commercial use. Include it in your projects.. Attention, even if it is a B4XLib library, it is not allowed to decompress it, modify it, change its name or redistribute it without the permission of the author

for DICE see here

SD_RollingBall

Author:
Star-Dust
Version: 0.01
  • SD_RollingBall
    • Events:
      • MovementCompleted
      • ReboundCopmpleted
      • ResizeCopmpleted
    • Fields:
      • BallText As String
      • Effect3d As Boolean
      • EffectLight As Boolean
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
        Base type must be Object
      • GetBase As B4XView
      • Initialize (Callback As Object, EventName As String)
      • Move (Duration As Int, DeltaX As Int, DeltaY As Int)
      • MoveTo (Duration As Int, Left As Int, Top As Int)
      • Rebound (magnification As Float)
        Animation 600 mills
      • Resize (Duration As Int, Width As Int, Height As Int)
      • Start
      • Stop

________________________________________________________________________________________________________________________
B4X:
Sub Process_Globals
    Private SD_RollingBall2 As SD_RollingBall
End Sub

Sub Ball
    Sleep(1000)
    SD_RollingBall2.Move(800,300,300)
    Wait For SD_RollingBall2_MovementCompleted
    SD_RollingBall2.Rebound(2)
    Wait For SD_RollingBall2_ReboundCopmpleted
    Sleep(100)
    SD_RollingBall2.Stop
End Sub

 

Attachments

  • SD_RollingBall.b4xlib
    59.4 KB · Views: 19
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
B4XPages Rolling Ball Sample.
 

Attachments

  • B4XSampleRollingBall.zip
    229.7 KB · Views: 9
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Ignore the missing file error because it will be automatically loaded from the shared folder
Tip: if you want to save space and avoid duplicating the files then add &VMArgs=-DZeroSharedFiles%3DTrue to the comment link. Zipper will create files with zero size and the full shared file will be copied during compilation.
 

Star-Dust

Expert
Licensed User
Longtime User
Tip: if you want to save space and avoid duplicating the files then add &VMArgs=-DZeroSharedFiles%3DTrue to the comment link. Zipper will create files with zero size and the full shared file will be copied during compilation.
Thanks, that's a very useful tip. In the early afternoon I will try it now and update the example.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…