ДействиеСценарий / Говнокод #5783 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
/**
 *  @private
 *  The exponent used in the easer function for the main part of the throw animation.
 *  NOTE: if you change this, you need to re-differentiate the easer
 *  function and use the resulting derivative calculation in createThrowMotionPath. 
 */
private static const THROW_CURVE_EXPONENT:Number = 3.0;

...

// Set the velocity for the next loop iteration.  Make sure it matches the actual velocity in effect when the
// throw reaches the end of the list.
//
// The easer function we use for the throw is 1-((1-x)^3), the derivative of which is 3*x^2-6*x+3.
// (I used http://www.numberempire.com/derivatives.php to differentiate the easer function).
// Since the slope of a curve function at any point x (i.e. f(x)) is the value of the derivative at x (i.e. f'(x)),
// we can use this to determine the velocity of the throw at the point it reached the beginning of the bounce.
var x:Number = partialTime / effectTime;
var y:Number = 3 * Math.pow(x, 2) - 6 * x + 3;

Flex 4.5 Hero.
Благо на работу кода это не сказывается, но всё-таки...

Разработчикам: Вообще класс и непосредственно алгоритм touch/kinetic скролла там сделан отвратительно, но с некоторыми весьма хорошими фишками (отпределение скорости, например). Советую вам покопаться.

Запостил: fljot fljot, (Updated )

Комментарии (6) RSS

  • Самое печальное, что с адовцами хрен свяжешься и поправишь. Джира как чёрная дыра.
    Ответить
    • Тачскролл на флекс?
      Какой сейчас процент планшетных дестктопов?
      Ответить
      • Проекты бывают не только для веба/аппсторов, но ещё и для всяких инсталляций в музеях и т.п.
        Ответить
    • Ну правильную формулу выводит даже тот сайт, который они же сами приводили в комментариях. Так что просто wtf
      Ответить
    • А за этот сайтик спасибо, весьма полезным может оказаться!
      Ответить

Добавить комментарий

Переведи на "PHP", guest!

    А не использовать ли нам bbcode?


    8