亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

Android屬性動畫賞析

難度中級
時長 1小時20分
學習人數
綜合評分9.80
125人評價 查看評價
9.9 內容實用
9.8 簡潔易懂
9.7 邏輯清晰
  • ObjectaAnimator.ofFloat(imageView,"translationX",0f,200f).setDuration(1000).start(); 屬性: translationX 偏移量 translationY X 絕對值 rotation 多個動畫同時進行(start(),異步進行) PropertyValuesHolder pl = PropertyValuesHolder.ofFloat("rotation",0,360); PropertyValuesHolder p2 = PropertyValuesHolder.ofFloat("rotation",0,360); ObjectAnimator.ofPropertyValuesHolder(imageView,p1,p2).setDuration(1000).start(); AnimatorSet aset = new AnimationSet(); ObjectAnimator a1 = ObjectAnimator.ofFloat(ImageView,"rotaton",0,200f); ObjectAnimator a2 = ObjectAnimator.ofFloat(ImageView,"rotaton",0,200f); ObjectAnimator a3 = ObjectAnimator.ofFloat(ImageView,"rotaton",0,200f); aset.playTogether(a1,a2,a3); aset.playDuration(1000); aset.start(); aset.playSequentially();//按順序執行動畫 aset.start(); aset.play(a1).with(a2); aset.play(a2).after(a2); aset.start();
    查看全部
  • ObjectAnimator animator = ObjectAnimator.ofFloat(view,"alpha",0,1f).setDuration(1000); animator.addListener(new Animator.AnimatorListener() { public void onAnimationStart(Animator animation) { } public void onAnimationEnd(Animator animation) { } public void onAnimationCancel(Animator animation) { } public void onAnimationRepeat(Animator animation) { } }); //選擇監聽事件 animator.addListener(new AnimatorListenerAdapter(){ }); //差值器(均速度,加速度,拋物線)內置九種差值器 animator,setInterpolator(new BounceInterpolator());
    查看全部
  • 動畫屬性記錄
    查看全部
  • 為動畫增加監聽事件 animitor.addListenner(new Animator);
    查看全部
  • 先左右平移 再旋轉 別哭 我親愛的人
    查看全部
  • 動畫集合 幾個動畫放一塊 同時執行 別哭 我親愛的人
    查看全部
  • 別哭 我親愛的人
    查看全部
  • 留作備用
    查看全部
  • Animation只能改變Ui顯示而不能改變控件實際位置,不適合做有交互得動畫效果
    查看全部
  • 常用屬性
    查看全部
  • ·先截張圖,明天繼續,跑步去~
    查看全部
  • ·使用AnimatorSet來完成 { AnimatorSet set = new AnimatorSet(); ObjectAnimator animator1 = ObjectAnimator.offloat(imageView, "rotation", 0f, 200f); ObjectAnimator animator2 = ObjectAnimator.offloat(imageView, "translationX", 0f, 200f); ObjectAnimator animator3 = ObjectAnimator.offloat(imageView, "translationY", 0f, 200f); set.playTogether(animator1,animator2,animator3); // 動畫一起播放 // set.playSequentially(animator1,animator2,animator3); // 順序播放動畫 // 控制動畫之間的播放順序 // set.play(animator2).with(animator3); // 先X和Y一起平移 // set.play(animator1).after(animator3); // 平移完成之后旋轉 set.setDuration(1000); set.start(); }
    查看全部
  • // 這里是指偏移量 ·ObjectAnimator.offloat(imageView, "translationX", 0f, 200f).setDuration(1000).start(); ·ObjectAnimator.offloat(imageView, "translationY", 0f, 200f).setDuration(1000).start(); // 這里是指絕對位置 ·ObjectAnimator.offloat(imageView, "X", 0f, 200f).setDuration(1000).start(); ·ObjectAnimator.offloat(imageView, "Y", 0f, 200f).setDuration(1000).start(); // 旋轉 ·ObjectAnimator.offloat(imageView, "rotation", 0f, 360f).setDuration(1000).start(); // 只要屬性具有Getter和Setter方法,就可以使用屬性動畫 ·可以多條語句,最后會一起執行(start方法是異步執行的) ·也可以通過PropertyValuesHolder來完成組合屬性動畫 { PropertyValuesHolder pvh1 = PropertyValuesHolder.offloat("rotation", 0, 360F); PropertyValuesHolder pvh2 = PropertyValuesHolder.offloat("X", 0f, 200f); PropertyValuesHolder pvh3 = PropertyValuesHolder.offloat("Y", 0f, 200f); ObjectAnimator.offPropertyValuesHodler(imageView, pvh1, pvh2, pvh3).setDuration(1000).start(); } -> 另外Google對PropertyValuesHolder對動畫進行了優化
    查看全部
  • ·Android 3.0之后添加的屬性動畫框架 ·屬性動畫Animator & 傳統動畫Animation ·Sample { TranslateAnimation animation = new TranslateAnimation(0, 200, 0, 0); // x從0->200 animation.setDuration(1000); // 持續時間1s animation.setFillAfter(true); // 動畫運行完成后停留在原處 imageView.startAnimation(animation); // 開始動畫 } ·如果給控件點擊事件,動畫結束之后,事件的響應就會詭異了,啊啊啊,這是一個Bug呀,詭異詭異 -> { Animation動畫只是進行了重繪控件,但是響應位置卻沒有改變,不適合帶交互的動畫 Animator動畫則是onDraw不斷重繪,而且只支持四種動畫 } -> 這里的表述有點小問題
    查看全部
  • 常用方法
    查看全部

舉報

0/150
提交
取消
老師告訴你能學到什么?
通過本課程,你將學到: 1、3.0之后新增的屬性動畫介紹 2、舊動畫框架的局限性 3、實際演示屬性動畫的基本用法 4、介紹關于動畫的高級技巧:插值器、估值器等 5、各種動畫的使用場景

微信掃碼,參與3人拼團

微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復購買,感謝您對慕課網的支持!