本文整理汇总了Java中android.animation.AnimatorSet.setTarget方法的典型用法代码示例。如果您正苦于以下问题:Java AnimatorSet.setTarget方法的具体用法?Java AnimatorSet.setTarget怎么用?Java AnimatorSet.setTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.AnimatorSet
的用法示例。
在下文中一共展示了AnimatorSet.setTarget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEnterAnimtorSet
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* 爱心的显示动画实现
*/
private AnimatorSet getEnterAnimtorSet(View target) {
//爱心的3中动画组合 透明度 x,y轴的缩放
ObjectAnimator alpha = ObjectAnimator.ofFloat(target, View.ALPHA, 0.2f, 1f);
ObjectAnimator scaleX = ObjectAnimator.ofFloat(target, View.SCALE_X, 0.2f, 1f);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(target, View.SCALE_Y, 0.2f, 1f);
//组合动画
AnimatorSet set = new AnimatorSet();
set.setDuration(500);
set.setInterpolator(new LinearInterpolator());
set.playTogether(alpha, scaleX, scaleY);
set.setTarget(target);
return set;
}
示例2: onCreate
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_timer);
tvHour = (TextView) findViewById(R.id.tvHour);
tvSeparator = (TextView) findViewById(R.id.tvSeparator);
tvMinute = (TextView) findViewById(R.id.tvMinute);
tvHour.setText(getHour());
tvMinute.setText(getMinute());
// animacion en el separador de horas
set = (AnimatorSet) AnimatorInflater.loadAnimator(this, R.animator.ticker_tick);
set.setTarget(tvSeparator);
set.start();
}
示例3: getAnimator
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private Animator getAnimator(LeafHolder target, RectF leafFlyRect, float progress) {
ValueAnimator bezierValueAnimator = getBezierValueAnimator(target, leafFlyRect, progress);
AnimatorSet finalSet = new AnimatorSet();
finalSet.playSequentially(bezierValueAnimator);
finalSet.setInterpolator(INTERPOLATORS[mRandom.nextInt(INTERPOLATORS.length)]);
finalSet.setTarget(target);
return finalSet;
}
示例4: getAnimtor
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* 爱心的显示和运行轨迹动画组合实现
*/
private Animator getAnimtor(View target) {
AnimatorSet enterAnimtorSet = getEnterAnimtorSet(target);
ValueAnimator bezierAnimtor = getBezierAnimtor(target);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playSequentially(enterAnimtorSet);
animatorSet.playSequentially(enterAnimtorSet, bezierAnimtor);
animatorSet.setInterpolator(interpolators[mRandom.nextInt(4)]);
animatorSet.setTarget(target);
return animatorSet;
}
示例5: getAnimator
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/** 爱心的显示和运行轨迹动画组合实现 */
private Animator getAnimator(View view) {
AnimatorSet enterAnimatorSet = getEnterAnimatorSet(view);
ValueAnimator valueAnimator = getBezierAnimator(view);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playSequentially(enterAnimatorSet);
animatorSet.playSequentially(enterAnimatorSet, valueAnimator);
animatorSet.setInterpolator(mInterpolators[mRandom.nextInt(4)]);
animatorSet.setTarget(view);
return animatorSet;
}
示例6: getEnterAnimatorSet
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/** 爱心显示动画实现 */
private AnimatorSet getEnterAnimatorSet(View view) {
ObjectAnimator alpha = ObjectAnimator.ofFloat(view, ALPHA, 0.2f, 1.0f);
ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, SCALE_X, 0.2f, 1.0f);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, SCALE_Y, 0.2f, 1.0f);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(500);
animatorSet.playTogether(alpha, scaleX, scaleY);
animatorSet.setTarget(view);
return animatorSet;
}
示例7: playAnimation
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void playAnimation() {
if (!isInEditMode()) {
AnimatorSet animator = (AnimatorSet) AnimatorInflater
.loadAnimator(getContext(), R.animator.bubble_shown_animator);
animator.setTarget(this);
animator.start();
}
}
示例8: playAnimationClickDown
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void playAnimationClickDown() {
if (!isInEditMode()) {
AnimatorSet animator = (AnimatorSet) AnimatorInflater
.loadAnimator(getContext(), R.animator.bubble_down_click_animator);
animator.setTarget(this);
animator.start();
}
}
示例9: playAnimationClickUp
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void playAnimationClickUp() {
if (!isInEditMode()) {
AnimatorSet animator = (AnimatorSet) AnimatorInflater
.loadAnimator(getContext(), R.animator.bubble_up_click_animator);
animator.setTarget(this);
animator.start();
}
}
示例10: makeChildTransfromer
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* 对 bitmap 进行伪 3d 变换
*
* @param child
* @param position
* @param offset
*/
private void makeChildTransfromer(View child, int position, float offset) {
child.layout(0, 0, child.getMeasuredWidth(), child.getMeasuredHeight());
float scale = 0;
float scaleX = 0;
scale = 1 - Math.abs(offset) * 0.25f;
scaleX = 1 - Math.abs(offset) * 0.15f;
// 延x轴移动的距离应该根据center图片决定
float translateY = 0;
final int originalChildHeight = (int) (mChildHeight - mChildHeight
* reflectHeightFraction - reflectGap);
final float originalChildHeightScale = (float) originalChildHeight / child.getHeight();
final float childHeightScale = originalChildHeightScale * scale;
final float childWidthScale = originalChildHeightScale * scaleX;
final int centerChildHeight = (int) (child.getHeight() * originalChildHeightScale);
topSpace = (mHeight-centerChildHeight)/2;
// float baseDis = dip2px(getContext(),24);
baseDis = centerChildHeight/4.9f;
translateY = (mHeight-centerChildHeight)/2- baseDis *offset*-1;
//根据offset 算出透明度
float alpha = 254 - Math.abs(offset) * STANDARD_ALPHA;
child.setAlpha(0);
if (alpha < 0) {
alpha = 0;
} else if (alpha > 254) {
alpha = 254;
}
child.setAlpha(alpha / 254.0f);
ObjectAnimator anim1 = ObjectAnimator.ofFloat(child, "scaleX", 1.0f, childWidthScale);
ObjectAnimator anim2 = ObjectAnimator.ofFloat(child, "scaleY", 1.0f, childHeightScale);
AnimatorSet animSet = new AnimatorSet();
animSet.setDuration(0);
//两个动画同时执行
animSet.playTogether(anim1, anim2);
child.setPivotX(child.getWidth()/2);
child.setPivotY(child.getHeight() / 2);
//显示的调用invalidate
child.invalidate();
animSet.setTarget(child);
animSet.start();
child.setTranslationX(mChildTranslateX);
child.setTranslationY(translateY);
}
示例11: onCreate
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
binding = DataBindingUtil.setContentView(this, R.layout.activity_account_register);
binding.backgroundImage.setAlpha(0.2f);
AnimatorSet set = (AnimatorSet) AnimatorInflater.loadAnimator(this, R.animator.rotate);
set.setTarget(binding.backgroundImage);
set.start();
}
示例12: getAnimator
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private Animator getAnimator(View target) {
AnimatorSet set = getEnterAnimtor(target);
ValueAnimator bezierValueAnimator = getBezierValueAnimator(target);
AnimatorSet finalSet = new AnimatorSet();
finalSet.playSequentially(set);
finalSet.playSequentially(set, bezierValueAnimator);
finalSet.setInterpolator(interpolators[random.nextInt(4)]);
finalSet.setTarget(target);
return finalSet;
}
示例13: getEnterAnimtor
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private AnimatorSet getEnterAnimtor(final View target) {
ObjectAnimator alpha = ObjectAnimator.ofFloat(target, View.ALPHA, 0.2f, 1f);
ObjectAnimator scaleX = ObjectAnimator.ofFloat(target, View.SCALE_X, 0.2f, 1f);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(target, View.SCALE_Y, 0.2f, 1f);
AnimatorSet enter = new AnimatorSet();
enter.setDuration(300);
enter.setInterpolator(new LinearInterpolator());
enter.playTogether(alpha, scaleX, scaleY);
enter.setTarget(target);
return enter;
}
示例14: onCreate
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mLocationButton = (Button) findViewById(R.id.button_location);
mLocationTextView = (TextView) findViewById(R.id.textview_location);
mAndroidImageView = (ImageView) findViewById(R.id.imageview_android);
// Initialize the FusedLocationClient.
mFusedLocationClient = LocationServices.getFusedLocationProviderClient(
this);
// Set up the animation.
mRotateAnim = (AnimatorSet) AnimatorInflater.loadAnimator
(this, R.animator.rotate);
mRotateAnim.setTarget(mAndroidImageView);
// Restore the state if the activity is recreated.
if (savedInstanceState != null) {
mTrackingLocation = savedInstanceState.getBoolean(
TRACKING_LOCATION_KEY);
}
// Set the listener for the location button.
mLocationButton.setOnClickListener(new View.OnClickListener() {
/**
* Toggle the tracking state.
* @param v The track location button.
*/
@Override
public void onClick(View v) {
if (!mTrackingLocation) {
startTrackingLocation();
mTrackingLocation = true;
} else {
stopTrackingLocation();
mTrackingLocation = false;
}
}
});
// Initialize the location callbacks.
mLocationCallback = new LocationCallback() {
/**
* This is the callback that is triggered when the
* FusedLocationClient updates your location.
* @param locationResult The result containing the device location.
*/
@Override
public void onLocationResult(LocationResult locationResult) {
// If tracking is turned on, reverse geocode into an address
if (mTrackingLocation) {
new FetchAddressTask().execute(locationResult
.getLastLocation());
}
}
};
}
示例15: playAnimation
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void playAnimation(int animationResourceId) {
if (!isInEditMode()) {
AnimatorSet animator = (AnimatorSet) AnimatorInflater
.loadAnimator(getContext(), animationResourceId);
animator.setTarget(getChildAt(0));
animator.start();
}
}