本文整理匯總了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();
}
}