zoukankan      html  css  js  c++  java
  • Laya 镜头移动缓冲

    Laya 镜头移动缓冲

    @author ixenos 2020-05-13 12:16:53

     1         public function moveUpdate(dt:int):void{
     2             dt = dt * 0.001;
     3             var rate:Number = 6;
     4             if(_moveToX!=this.x)
     5             {
     6                 if(Math.abs(_moveToX-this.x)>MOVE_X)
     7                 {
     8                     var moveX:Number = _moveToX - this.x;
     9                     moveX = moveX * rate * dt;
    10                     if(Math.abs(moveX) < MOVE_X)
    11                     {
    12                         moveX = moveX > 0 ? MOVE_X : -MOVE_X;
    13                     }
    14                     else if(Math.abs(moveX) > Math.abs(_moveToX - this.x))
    15                     {
    16                         moveX = _moveToX - this.x;
    17                     }
    18                     this.x = this.x + moveX;
    19                 }
    20                 else
    21                 {
    22                     this.x = _moveToX;
    23                 }
    24             }
    25             if(_moveToY!=this.y)
    26             {
    27                 if(Math.abs(_moveToY-this.y)>MOVE_Y)
    28                 {
    29                     var moveY:Number = _moveToY - this.y;
    30                     moveY = moveY * rate  * dt;
    31                     if(Math.abs(moveY) < MOVE_Y)
    32                     {
    33                         moveY = moveY > 0 ? MOVE_Y : -MOVE_Y;
    34                     }
    35                     else if(Math.abs(moveY) > Math.abs(_moveToY - this.y))
    36                     {
    37                         moveY = _moveToY - this.y;
    38                     }
    39                     this.y = this.y + moveY;
    40                 }
    41                 else
    42                 {
    43                     this.y = _moveToY;
    44                 }
    45             }
    46         }
  • 相关阅读:
    图片处理
    define 常量的定义和读取
    curl
    stream_get_contents 和file_get_content的区别
    php flock 文件锁
    字符串函数
    php 常量
    debug_backtrace()
    pathlib模块替代os.path
    Python中对 文件 的各种骚操作
  • 原文地址:https://www.cnblogs.com/ixenos/p/12881624.html
Copyright © 2011-2022 走看看