Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function displaceX(UXNode $object, int $duration, $coord) {
- $this->time = 0;
- $this->from = $object->x;
- $this->delta = $this->direction * $coord;
- $this->duration = $duration;
- $this->direction *= 1;
- $this->timer = new UXAnimationTimer(function(){
- $val = $this->circular($this->time, $this->from, $this->delta, $this->duration);
- $this->time += $this->timer->FRAME_INTERVAL_MS;
- if($this->time >= $this->duration) {
- $val = $this->from + $this->delta;
- $this->timer->stop();
- }
- $this->x = $val;
- });
- $this->timer->FRAME_INTERVAL_MS = 10;
- $this->timer->start();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement