android.view.animation.Animation.setStartOffset()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中android.view.animation.Animation.setStartOffset()方法的一些代码示例,展示了Animation.setStartOffset()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Animation.setStartOffset()方法的具体详情如下:
包路径:android.view.animation.Animation
类名称:Animation
方法名:setStartOffset

Animation.setStartOffset介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator()); //add this
fadeIn.setDuration(1000);

Animation fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator()); //and this
fadeOut.setStartOffset(1000);
fadeOut.setDuration(1000);

AnimationSet animation = new AnimationSet(false); //change to false
animation.addAnimation(fadeIn);
animation.addAnimation(fadeOut);
this.setAnimation(animation);

代码示例来源:origin: ankidroid/Anki-Android

public static Animation fade(int type, int duration, int offset) {
    float startValue = type;
    Animation animation = new AlphaAnimation(startValue, 1.0f - startValue);
    animation.setDuration(duration);
    if (type == FADE_IN) {
      animation.setZAdjustment(Animation.ZORDER_TOP);
    }
    animation.setStartOffset(offset);
    return animation;
  }
}

代码示例来源:origin: stackoverflow.com

final Animation in = new AlphaAnimation(0.0f, 1.0f);
in.setDuration(3000);

final Animation out = new AlphaAnimation(1.0f, 0.0f);
out.setDuration(3000);

AnimationSet as = new AnimationSet(true);
as.addAnimation(out);
in.setStartOffset(3000);
as.addAnimation(in);

代码示例来源:origin: stackoverflow.com

TextView myText = (TextView) findViewById(R.id.myText );

Animation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(50); //You can manage the blinking time with this parameter
anim.setStartOffset(20);
anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(Animation.INFINITE);
myText.startAnimation(anim);

代码示例来源:origin: stackoverflow.com

TextView myText = (TextView) findViewById(R.id.myText );

Animation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(50); //You can manage the time of the blink with this parameter
anim.setStartOffset(20);
anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(Animation.INFINITE);
myText.startAnimation(anim);

代码示例来源:origin: rey5137/material

@Override
public boolean onPreDraw() {
  mPopup.getContentView().getViewTreeObserver().removeOnPreDrawListener(this);
  for(int i = 0, count = mDropDownList.getChildCount(); i < count; i ++){
    View v = mDropDownList.getChildAt(i);
    Animation anim = AnimationUtils.loadAnimation(mContext, mItemAnimationId);
    anim.setStartOffset(mItemAnimationOffset * i);
    v.startAnimation(anim);
  }
  return false;
}

代码示例来源:origin: ankidroid/Anki-Android

animation.setStartOffset(offset);
return animation;

代码示例来源:origin: stackoverflow.com

fadeOut.setStartOffset(fadeInDuration + timeBetween);
fadeOut.setDuration(fadeOutDuration);

代码示例来源:origin: Bearded-Hen/Android-Bootstrap

/**
 * Starts a Flashing Animation on the AwesomeTextView
 *
 * @param forever whether the animation should be infinite or play once
 * @param speed   how fast the item should flash
 */
public void startFlashing(boolean forever, AnimationSpeed speed) {
  Animation fadeIn = new AlphaAnimation(0, 1);
  //set up extra variables
  fadeIn.setDuration(50);
  fadeIn.setRepeatMode(Animation.REVERSE);
  //default repeat count is 0, however if user wants, set it up to be infinite
  fadeIn.setRepeatCount(0);
  if (forever) {
    fadeIn.setRepeatCount(Animation.INFINITE);
  }
  fadeIn.setStartOffset(speed.getFlashDuration());
  startAnimation(fadeIn);
}

代码示例来源:origin: Bearded-Hen/Android-Bootstrap

/**
 * Starts a rotating animation on the AwesomeTextView
 *
 * @param clockwise true for clockwise, false for anti clockwise spinning
 * @param speed     how fast the item should rotate
 */
public void startRotate(boolean clockwise, AnimationSpeed speed) {
  Animation rotate;
  //set up the rotation animation
  if (clockwise) {
    rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
  }
  else {
    rotate = new RotateAnimation(360, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
  }
  //set up some extra variables
  rotate.setRepeatCount(Animation.INFINITE);
  rotate.setInterpolator(new LinearInterpolator());
  rotate.setStartOffset(0);
  rotate.setRepeatMode(Animation.RESTART);
  rotate.setDuration(speed.getRotateDuration());
  startAnimation(rotate);
}

代码示例来源:origin: robolectric/robolectric

@Test @Ignore("Needs additional work")
 public void start_shouldRunAnimation() {
  final AnimationSet set = new AnimationSet(true);

  final Animation move = new TranslateAnimation(0, 100, 0, 100);
  move.setDuration(1000);
  move.setAnimationListener(moveListener);

  final Animation spin = new RotateAnimation(0, 360);
  spin.setDuration(1000);
  spin.setStartOffset(1000);
  spin.setAnimationListener(spinListener);

  set.start();

  verify(moveListener).onAnimationStart(move);

  Robolectric.flushForegroundThreadScheduler();

  verify(moveListener).onAnimationEnd(move);
 }
}

代码示例来源:origin: stackoverflow.com

Animation animation = AnimationUtils.loadAnimation(getBaseContext(), R.anim.slide_right_in);
animation.setStartOffset(0);
myButton.startAnimation(animation);

代码示例来源:origin: stackoverflow.com

public Animation PlayAnim( int viewid, Context Con, int animationid, int StartOffset )
{
  View v = findViewById(viewid);

  if( v != null )
  {
    Animation animation = AnimationUtils.loadAnimation(Con, animationid  );
    animation.setStartOffset(StartOffset);
    v.startAnimation(animation);

    return animation;
  }
  return null;
}

代码示例来源:origin: stackoverflow.com

Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator()); //add this
fadeIn.setDuration(1500); //time in milliseconds

Animation fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator()); //and this
fadeOut.setStartOffset(1000);
fadeOut.setDuration(1500); //time in milliseconds

AnimationSet animation = new AnimationSet(false); //change to false
animation.addAnimation(fadeIn);
animation.addAnimation(fadeOut);
this.setAnimation(animation);

代码示例来源:origin: stackoverflow.com

fadeOut.setStartOffset(fadeInDuration + timeBetween);
fadeOut.setDuration(fadeOutDuration);

代码示例来源:origin: stackoverflow.com

Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator()); //add this
fadeIn.setDuration(1000);

Animation fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator()); //and this
fadeOut.setStartOffset(1000);
fadeOut.setDuration(1000);

AnimationSet animation = new AnimationSet(false); //change to false
animation.addAnimation(fadeIn);
animation.addAnimation(fadeOut);
View.startAnimation(animation);

代码示例来源:origin: stackoverflow.com

Handler handler = new Handler();
 Animation fadeIn = new AlphaAnimation(0, 1);
     fadeIn.setInterpolator(new DecelerateInterpolator()); //add this
     fadeIn.setDuration(2000);
     Animation fadeOut = new AlphaAnimation(1, 0);
     fadeOut.setInterpolator(new AccelerateInterpolator()); //and this
     fadeOut.setStartOffset(1000);
     fadeOut.setDuration(1000);
     AnimationSet animation = new AnimationSet(false); //change to false
     animation.addAnimation(fadeIn);
     //animation.addAnimation(fadeOut);
     logo.setAnimation(animation);

代码示例来源:origin: stackoverflow.com

LinearLayout ll = (LinearLayout) findViewById(R.id.activity_main);
Animation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(50); 
anim.setStartOffset(20);
anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(Animation.INFINITE);
ll.startAnimation(anim);

代码示例来源:origin: stackoverflow.com

Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setDuration(1000);
Animation fadeOut = new AlphaAnimation(1, 0);
fadeOut.setStartOffset(1000);
fadeOut.setDuration(1000);
AnimationSet animation = new AnimationSet(true);
animation.addAnimation(fadeIn);
animation.addAnimation(fadeOut);
view.startAnimation(animation);

代码示例来源:origin: davideas/FlipView

private void initInAnimation(@IntRange(from = 0) long duration) {
  if (getInAnimation() == null)
    this.setInAnimation(getContext(), R.anim.grow_from_middle_x_axis);
  super.getInAnimation().setDuration(duration);
  super.getInAnimation().setStartOffset(anticipateInAnimationTime > duration ?
      duration : duration - anticipateInAnimationTime);
}

相关文章

微信公众号

最新文章

更多