Пример #1
0
 public void onUpdate(Sprite sprite) {
   timeDiff = Rokon.getTime() - _startTime;
   scale = _startScale + ((float) timeDiff / (float) _time);
   if (timeDiff > _time) {
     setExpired(true);
     if (_handler != null) _handler.onFinished();
   }
   sprite.setScale(scale, scale);
   width = sprite.getWidth();
   height = sprite.getHeight();
   offsetX = (width / 2f) - (scale * (width / 2f));
   offsetY = (height / 2f) - (scale * (height / 2f));
   sprite.setOffset(offsetX, offsetY);
 }
Пример #2
0
 /**
  * Shrinks a sprite in a given timeframe, and triggers BasicHandler.onFinished() when complete
  *
  * @param time milliseconds, time to reach 0x0 pixels
  * @param handler onFinished() will be triggered when the Sprite reaches 0x0 pixels
  */
 public Grow(int time, BasicHandler handler) {
   if (handler != null) _handler = handler;
   _time = time;
   _startTime = Rokon.getTime();
 }