public void initTextAnimation() {
   animator.setAnimatorListener(this);
   textAnimation =
       animator.addAnimationFromTo(
           textOffsetScalar,
           AnimatedScalar.ANIMATION_PROPERTY_SCALAR,
           0,
           this.labelText.length(),
           Animation.EASINGCURVE_LINEAR,
           scrollTime);
 }
 public void setLabelText(String label) {
   this.labelText = label;
   animator.removeAllAnimations();
   textAnimation =
       animator.addAnimationFromTo(
           textOffsetScalar,
           AnimatedScalar.ANIMATION_PROPERTY_SCALAR,
           0,
           this.labelText.length(),
           Animation.EASINGCURVE_LINEAR,
           scrollTime);
   updateLayout();
 }
Ejemplo n.º 3
0
  /** @see net.rim.device.api.openvg.VGField#initialize(VG) */
  protected void initialize(final VG g) {
    final VG11 vg = (VG11) g;
    vg.vgSetfv(VG10.VG_CLEAR_COLOR, 4, MY_CLEAR_COLOR, 0);

    final XYRect rect = new XYRect();

    // Create the bitmap from bundled resource "icons.png"
    final Bitmap bitmap = Bitmap.getBitmapResource("icons.png");

    // Create the image for all the icons
    for (int i = 0; i < _imageHandles.length; i++) {
      // Update the XYRect in which the image will be displayed
      updateRect(rect, i);

      _imageHandles[i] =
          VGUtils.vgCreateImage(vg, bitmap, true, VG10.VG_IMAGE_QUALITY_BETTER, rect);
    }

    // Get the default font and its FontSpec
    final Font font = Font.getDefault();
    final FontSpec fontSpec = font.getFontSpec();

    // Create text image
    _textImage =
        VGUtils.vgCreateTextAsImage(vg, fontSpec, "Tap or click to swap screens", null, null);

    // Set up the animation. The animation will animate a scalar float value
    // (_mainRotation) from 360 to 0 over 3 seconds and will repeat
    // indefinitely.
    _animator = new Animator(0);
    final Animation animation =
        _animator.addAnimationFromTo(
            _mainRotation,
            AnimatedScalar.ANIMATION_PROPERTY_SCALAR,
            360.0f,
            0.0f,
            Animation.EASINGCURVE_LINEAR,
            3000L);
    animation.setRepeatCount(Animation.REPEAT_COUNT_INDEFINITE);

    _animator.begin(0L);
  }
Ejemplo n.º 4
0
 /** @see net.rim.device.api.openvg.VGField#update() */
 public void update() {
   _animator.update();
 }