Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. function displaceX(UXNode $object, int $duration, $coord) {
  2.         $this->time = 0;
  3.         $this->from = $object->x;
  4.         $this->delta = $this->direction * $coord;
  5.         $this->duration = $duration;
  6.         $this->direction *= 1;
  7.        
  8.         $this->timer = new UXAnimationTimer(function(){
  9.             $val = $this->circular($this->time, $this->from, $this->delta, $this->duration);
  10.             $this->time += $this->timer->FRAME_INTERVAL_MS;
  11.             if($this->time >= $this->duration) {
  12.                 $val = $this->from + $this->delta;
  13.                 $this->timer->stop();
  14.             }
  15.             $this->x = $val;
  16.         });
  17.         $this->timer->FRAME_INTERVAL_MS = 10;
  18.         $this->timer->start();
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement