Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Accelerometer smoothnes

Explorer ,
Jan 16, 2013 Jan 16, 2013

I don't know how to use Accelerometer and to have smooth animation of that object(vector), I just need it to go to one side of the screen and to another when mobile device is moved in that direction (left or right).

I used acceleromete basics but besides its very choppy movements, it goes off the screen and doesn't stays inside.

Thanks

TOPICS
ActionScript
780
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 16, 2013 Jan 16, 2013

Please provide some code examples of how you're utilizing the accelerometer.

Aside that you're most likely not moving objects on a fast enough speed (either ENTER_FRAME with some custom easing or using a Twen engine like TweenLite ( http://www.greensock.com )).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 16, 2013 Jan 16, 2013

I'm just starting to use it don't have any code yet except that codesnippet, so if you could provide me one example that would be great. I just need one object moving from left to right without going off the screen.

thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jan 17, 2013 Jan 17, 2013

Here you can find some really useful tricks to enhance performance of flash-tweens for mobile devices.

Especially this tip should be related to your problem:

Use cacheAsBitmap and cacheAsBitmapMatrix

If you have vector object that you’d like to animate in your project remember to cache them and then animate; remember also to set your application with GPU acceleration and you can see a really good performance with this technique.

Avoid to cache objects that you need to remove from display list, it will be so expensive for your memory.

Here is a video from Adobe with code examples that shows exactly the problem you are facing.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 17, 2013 Jan 17, 2013
LATEST

There's a million examples on the net about using the Accelerometer. The original one I started with a very long time ago can be found here:

AIR2 Accelerometer Game Example

It's about 180 lines of code and is a complete game using the accelerometer with some custom coded easing (very simple stuff). No extra classes needed, very easy to read code. It's very old but still works fine and I think it hits your basic needs perfectly. The newer tutorials do exactly the same thing but use extra libraries to smooth movement. I try to stick to less libraries whenever possible.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines