Accurate BPM event listener in AS3

前端 未结 4 772
盖世英雄少女心
盖世英雄少女心 2021-01-03 12:08

I\'m trying to sync animation to music at a specific BPM. I\'ve tried using the Timer but it isn\'t accurate when dealing with small intervals in milliseconds. I did some re

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-03 12:49

    Setting the frame rate so that the event interval is a multiple of the frame rate might help (for example, 167ms equals 6 fps; 12, 18, 24 etc. are then also ok).

    If I understood correctly, better solution would be to use the enterframe event. Instead of determining the position of the animation by counting the events, calculate it using elapsed time (getTimer or sound position). This would also make the animation work on slower computers that have lag.

提交回复
热议问题