Alex
- Forum-Beiträge: 17
26.03.2012, 09:09:44 via Website
26.03.2012 09:09:44 via Website
hi all,
i have a big problem. i try to implement a kind of speedometer. i get the informations like RPM... every 10-100ms from the car over bluetooth. now i want to rotate the rpm needle to the right position. i do this every time i get data.
ivNadel.startAnimation(RpmAnim);
ivBoost.startAnimation(BoostAnim);
ivLoad.startAnimation(LoadAnim);
the Animations are all implemented like this:
//rotate Tachonadel
Rpmcurrentdegree=Rpmcurrentdegree+Rpmdegree;
Rpmdegree=((rpms-lastrpm)*RPMtoDegree);
if(Rpmdegree!=0)
{
RpmAnim=new RotateAnimation((float)Rpmcurrentdegree, (float)Rpmdegree, ivNadel.getWidth()/2, ivNadel.getHeight()/2);
RpmAnim.setInterpolator(new LinearInterpolator());
RpmAnim.setFillEnabled(true);
RpmAnim.setFillAfter(true);
}
the problem is that the startAnimations slow down the reaction time of the ui by about half a second. when i comment the 3 startAnimation out it works fine again. so does anyone know a way how to work around this slow down?
i also tried to start the animation only if there was a change on the degrees but then the ImageView does not hold its new position after the rotateanimation.
plz help
i have a big problem. i try to implement a kind of speedometer. i get the informations like RPM... every 10-100ms from the car over bluetooth. now i want to rotate the rpm needle to the right position. i do this every time i get data.
ivNadel.startAnimation(RpmAnim);
ivBoost.startAnimation(BoostAnim);
ivLoad.startAnimation(LoadAnim);
the Animations are all implemented like this:
//rotate Tachonadel
Rpmcurrentdegree=Rpmcurrentdegree+Rpmdegree;
Rpmdegree=((rpms-lastrpm)*RPMtoDegree);
if(Rpmdegree!=0)
{
RpmAnim=new RotateAnimation((float)Rpmcurrentdegree, (float)Rpmdegree, ivNadel.getWidth()/2, ivNadel.getHeight()/2);
RpmAnim.setInterpolator(new LinearInterpolator());
RpmAnim.setFillEnabled(true);
RpmAnim.setFillAfter(true);
}
the problem is that the startAnimations slow down the reaction time of the ui by about half a second. when i comment the 3 startAnimation out it works fine again. so does anyone know a way how to work around this slow down?
i also tried to start the animation only if there was a change on the degrees but then the ImageView does not hold its new position after the rotateanimation.
plz help
— geändert am 26.03.2012, 09:15:12
Empfohlener redaktioneller Inhalt
Mit Deiner Zustimmung wird hier ein externer Inhalt geladen.
Mit Klick auf den oben stehenden Button erklärst Du Dich damit einverstanden, dass Dir externe Inhalte angezeigt werden dürfen. Dabei können personenbezogene Daten an Drittanbieter übermittelt werden. Mehr Infos dazu findest Du in unserer Datenschutzerklärung.