Skip to main content

Android Image Flipping in 3D View Tutorial

In my first tutorial entitled “Android Image Fading Animation” , I discussed about how to fade in and fade out an image. Now I will introduce some sort of flipping with a 3 Dimensional View in an Image. As you can see, there are 7 buttons that I created namely b1, b2, b3, b4, b5, b6, b7 and one ImageView as your Image. The design in the designer should be like the image below. Name your layout as “flip3dview” and press save. flip 3D Designer
  1. Sub Globals
  2. Dim b1,b2,b3,b4,b5,b6,b7 As Button
  3. Dim a As ICOSFlip3DView
  4. Dim i1 As ImageView
  5. End Sub
The code above is for initializing and declaring a variable for Buttons, Flip3DView, and ImageView. I created 7 buttons in which b1 is for flipping the Image in 3D View Horizontally, b2 for flipping the Image in 3D View vertically, b3 for flipping the image in XYZ coordinates, b4 for automatic repeat or iteration of flipping the image horizontally, b5 for automatic repeat or iteration of flipping image in 3D View vertically, b6 for infinite reverse of flipping the image in 3D View Horizontally, and b7 for infinite reverse of flipping the image in 3D View vertically. Here's the complete code for this application:
  1. Sub Process_Globals
  3. End Sub
  5. Sub Globals
  6. Dim b1,b2,b3,b4,b5,b6,b7 As Button
  7. Dim a As ICOSFlip3DView
  8. Dim i1 As ImageView
  10. End Sub
  12. Sub Activity_Create(FirstTime As Boolean)
  13. Activity.LoadLayout("flip3dview")
  14. Activity.Title="Flip 3D View - Lyndon Bermoy"
  15. End Sub
  17. Sub Activity_Resume
  18. End Sub
  20. Sub b1_Click
  21. a.Flip3DView("a",i1,180,2000,a.FLIP_HORIZONTAL)
  22. a.StartAnim(i1)
  23. End Sub
  25. Sub b2_Click
  26. a.Flip3DView("a",i1,180,2000,a.FLIP_VERTICAL)
  27. a.StartAnim(i1)
  28. End Sub
  30. Sub b3_Click
  31. a.Flip3DView2("a",i1,0,360,2000)
  32. a.StartAnim(i1)
  33. End Sub
  35. Sub b4_Click
  36. a.Flip3DView("a",i1,360,2000,a.FLIP_HORIZONTAL)
  37. a.AutoRepeat
  38. a.StartAnim(i1)
  39. End Sub
  41. Sub b5_Click
  42. a.Flip3DView("a",i1,360,2000,a.FLIP_VERTICAL)
  43. a.AutoRepeat
  44. a.StartAnim(i1)
  45. End Sub
  47. Sub b6_Click
  48. a.Flip3DView("a",i1,180,2000,a.FLIP_HORIZONTAL)
  49. a.AutoReverse
  50. a.AutoRepeat
  51. a.StartAnim(i1)
  52. End Sub
  54. Sub b7_Click
  55. a.Flip3DView("a",i1,180,2000,a.FLIP_VERTICAL)
  56. a.AutoReverse
  57. a.AutoRepeat
  58. a.StartAnim(i1)
  59. End Sub
  61. Sub a_animationend
  62. ToastMessageShow("DONE",False)
  63. End Sub
Note for the codes above: * ICOSFlip3DView - is a library package that contains codes for flipping an image in a 3D Viewing. * a.Flip3DView("a",i1,180,2000,a.FLIP_HORIZONTAL) is a syntax where the image can view in 3D horizontally. The "a" here is the title, i1 is the name of our ImageView which contains the image to flip in 3D, 180 is the degrees to be flipped, 2000 is the duration of time in milliseconds to flip the image in 3D, FLIP_Horizontal for the direction of flipping the image. *  a.FLIP_VERTICAL is the syntax where the image can flip in the vertical direction. *  a.Flip3DView2("a",i1,0,360,2000) is a syntax for flipping the Image in 3D view in zero degrees up to 360 degrees. *  a.AutoRepeat - the word AutoRepeat here provides repetition in flipping the image. *  a.StartAnim(i1) - the word "StartAnim" is the start of your animation with regards to flipping because it is part of "a" as our ICOSFlip3DView animation library. *  a.AutoReverse is the syntax for reversing horizontal image flipping to vertical and vice versa. Best regards, Engr. Lyndon R. Bermoy IT Instructor/System Developer/Mobile Developer 09126450702 [email protected] Visit my page on Facebook at:

Add new comment