noclass1980 Active Member Licensed User Longtime User Jan 9, 2014 #1 Hi, I use the Path functionality to define a shape (a hexagon) and then use ClipPath to assign a bitmap to the defined path (to create a textured look. Is it possible to use the created shape as a discrete object that can be rotated, flipped and moved about the screen? In other words, create that hexagon at some point on the screen at run time and then move it to another location as an animation. Thanks in advance
Hi, I use the Path functionality to define a shape (a hexagon) and then use ClipPath to assign a bitmap to the defined path (to create a textured look. Is it possible to use the created shape as a discrete object that can be rotated, flipped and moved about the screen? In other words, create that hexagon at some point on the screen at run time and then move it to another location as an animation. Thanks in advance
klaus Expert Licensed User Longtime User Jan 9, 2014 #2 I suggest you to use a transparent ImageView or Panel, draw the hexagon onto it and then you can move and rotate it, rotation will need the Reflection library. Or you could use a transparent Panel covering the whole screen and draw the hexagone where you want, to erase the previous hexagon draw a transparent one at it's position. Upvote 0
I suggest you to use a transparent ImageView or Panel, draw the hexagon onto it and then you can move and rotate it, rotation will need the Reflection library. Or you could use a transparent Panel covering the whole screen and draw the hexagone where you want, to erase the previous hexagon draw a transparent one at it's position.
noclass1980 Active Member Licensed User Longtime User Jan 9, 2014 #3 Ok, thanks, I'll try that. Upvote 0
noclass1980 Active Member Licensed User Longtime User Jan 10, 2014 #4 Hi Klaus, I'vve had a look at the reflection library but don't know which methods to use. The code below draws (on Panel1 with PanelCanvas on it) the shape previously defined by XPath1 and puts the texture Xsurface on it. How do I then rotate the panel by 60 degrees and move it from X1,Y1 to X2Y2? Thanks Code: Copy PanelCanvas.DrawPath(XPath1,Colors.White, True, 1dip) PanelCanvas.ClipPath(XPath1) PanelCanvas.DrawBitmap(Xsurface,Null,DestRect) Activity.Invalidate Thanks in advance Upvote 0
Hi Klaus, I'vve had a look at the reflection library but don't know which methods to use. The code below draws (on Panel1 with PanelCanvas on it) the shape previously defined by XPath1 and puts the texture Xsurface on it. How do I then rotate the panel by 60 degrees and move it from X1,Y1 to X2Y2? Thanks Code: Copy PanelCanvas.DrawPath(XPath1,Colors.White, True, 1dip) PanelCanvas.ClipPath(XPath1) PanelCanvas.DrawBitmap(Xsurface,Null,DestRect) Activity.Invalidate Thanks in advance
noclass1980 Active Member Licensed User Longtime User Jan 10, 2014 #5 Hi, I developed a work around for my last post above (#4) using the AnimationPlus libary as below. In terms of resources, is this more expensive than using the Reflection library. I'd appreciate it if anyone can advise and also provide the reflection code to achieve the rotation. Thanks in advance. Code: Copy Dim ani as AnimationPlus ani.InitializeRotatecenter("ani",0,45, Panel1) 'ani.Duration=2000 if the duration isn't set then the animation is instantaneous ani.Start(Panel1) ani.PersistAfter=True Upvote 0
Hi, I developed a work around for my last post above (#4) using the AnimationPlus libary as below. In terms of resources, is this more expensive than using the Reflection library. I'd appreciate it if anyone can advise and also provide the reflection code to achieve the rotation. Thanks in advance. Code: Copy Dim ani as AnimationPlus ani.InitializeRotatecenter("ani",0,45, Panel1) 'ani.Duration=2000 if the duration isn't set then the animation is instantaneous ani.Start(Panel1) ani.PersistAfter=True
klaus Expert Licensed User Longtime User Jan 10, 2014 #6 The Reflection routine to rotate a view : Code: Copy 'Sets the rotation angle of the given view Sub setRotation(v As View, a As Float) refl.Target = v refl.RunMethod2("setRotation", a, "java.lang.float") End Sub Attached a small demo program. Attachments RotatePanel.zip RotatePanel.zip 7.1 KB · Views: 344 Upvote 0
The Reflection routine to rotate a view : Code: Copy 'Sets the rotation angle of the given view Sub setRotation(v As View, a As Float) refl.Target = v refl.RunMethod2("setRotation", a, "java.lang.float") End Sub Attached a small demo program.
noclass1980 Active Member Licensed User Longtime User Jan 10, 2014 #7 Many thanks, Klaus, very helpful as always! Upvote 0