I iCAB Well-Known Member Licensed User Longtime User Oct 7, 2015 #1 Hi there I am using Animation to display a rotating object. My objective is to have the object rotate around itself smoothly for X number of seconds without a pause in between. I am using the code below Code: aRotate.InitializeRotateCenter(ProcessingLayerEventName, 0, iTimeoutInSecond * 360, ProcessingPanel.GetView(ProcessingPanel.NumberOfViews - 1 ) ) aRotate.Duration = iTimeoutInSecond * 1000 aRotate.RepeatCount = 0 The code above seems to do the job, except that the rotation starts slow then increases speed. Is there anything I can do about it to make sure the object rotates at the same speed all the time? Thanks in advance
Hi there I am using Animation to display a rotating object. My objective is to have the object rotate around itself smoothly for X number of seconds without a pause in between. I am using the code below Code: aRotate.InitializeRotateCenter(ProcessingLayerEventName, 0, iTimeoutInSecond * 360, ProcessingPanel.GetView(ProcessingPanel.NumberOfViews - 1 ) ) aRotate.Duration = iTimeoutInSecond * 1000 aRotate.RepeatCount = 0 The code above seems to do the job, except that the rotation starts slow then increases speed. Is there anything I can do about it to make sure the object rotates at the same speed all the time? Thanks in advance
Erel B4X founder Staff member Licensed User Longtime User Oct 7, 2015 #2 You can use this code to create a linear animation: Code: Dim jo As JavaObject = aRotate Dim interpolator As JavaObject interpolator.InitializeNewInstance("android.view.animation.LinearInterpolator", Null) jo.RunMethod("setInterpolator", Array(interpolator)) Upvote 0
You can use this code to create a linear animation: Code: Dim jo As JavaObject = aRotate Dim interpolator As JavaObject interpolator.InitializeNewInstance("android.view.animation.LinearInterpolator", Null) jo.RunMethod("setInterpolator", Array(interpolator))