欧美成人午夜免费全部完,亚洲午夜福利精品久久,а√最新版在线天堂,另类亚洲综合区图片小说区,亚洲欧美日韩精品色xxx

扣丁學(xué)堂Java開發(fā)實(shí)現(xiàn)幀動(dòng)畫的實(shí)例代碼

2018-07-18 14:25:08 1303瀏覽

今天扣丁學(xué)堂給大家講解一下關(guān)于Java培訓(xùn)之實(shí)現(xiàn)幀動(dòng)畫的實(shí)例代碼,有很多游戲網(wǎng)站或者視頻網(wǎng)站會(huì)用到幀動(dòng)畫功能,視頻網(wǎng)站中提供的在線視頻播放功能,播放的都是FLV格式的文件,它是Flash動(dòng)畫文件,可通過Flash制作的播放器來播放該文件.項(xiàng)目中用制作的player.swf播放器,那么下面我們來看一下吧。



效果圖

1、幀動(dòng)畫的簡(jiǎn)要代碼
  privateImageViewbgAnimView;
  privateAnimationDrawablemAnimationDrawable;
  //初始化
  mAnimationDrawable=newAnimationDrawable();
  bgAnimView=newImageView(mContext);
  bgAnimView.setBackgroundDrawable(getAnimationDrawable(mAnimationDrawable));
  params=newFrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
  params.topMargin=Util.Div(176+58);
  params.gravity=Gravity.CENTER_HORIZONTAL;
  addView(bgAnimView,params);
  privateAnimationDrawablegetAnimationDrawable(AnimationDrawablemAnimationDrawable){
  intduration=50;
  mAnimationDrawable.addFrame(mContext.getResources().getDrawable(R.drawable.loading1),duration);
  mAnimationDrawable.addFrame(mContext.getResources().getDrawable(R.drawable.loading2),duration);
  mAnimationDrawable.addFrame(mContext.getResources().getDrawable(R.drawable.loading3),duration);
  mAnimationDrawable.setOneShot(false);
  returnmAnimationDrawable;
  }
  //動(dòng)畫開始
  publicvoidanimLoadingStart(){
  this.setVisibility(View.VISIBLE);
  if(mAnimationDrawable!=null){
  mAnimationDrawable.start();
  }
  }
  //動(dòng)畫結(jié)束
  publicvoidanimLoadingEnd(){
  if(mAnimationDrawable!=null){
  mAnimationDrawable.stop();
  }

2、擴(kuò)展:

  //X軸平移
  publicvoidanimY(inty,intnextY,intduration){
  LinearInterpolatorll=newLinearInterpolator();//勻速
  ObjectAnimatoranimator=ObjectAnimator.ofFloat(yourView,"translationY",0,300);//300若為負(fù)值,就是向上平移
  animator.setDuration(duration);
  animator.setInterpolator(ll);
  animator.start();
  }
  //Y軸平移
  publicvoidanimX(intx,intnextX,intduration){
  LinearInterpolatorll=newLinearInterpolator();
  ObjectAnimatoranimator=ObjectAnimator.ofFloat(yourView,"translationX",x,nextX);
  animator.setDuration(duration);
  animator.setInterpolator(ll);
  animator.start();
  }
  //縱向壓縮0.5倍
  LinearInterpolatorll=newLinearInterpolator();//勻速
  ScaleAnimationscaleAnimation=newScaleAnimation(1,1,1,0.5f);//默認(rèn)從(0,0)
  scaleAnimation.setDuration(500);
  scaleAnimation.setInterpolator(ll);
  scaleAnimation.setFillAfter(true);
  chartView.startAnimation(scaleAnimation);
  //橫向壓縮0.5倍
  LinearInterpolatorll=newLinearInterpolator();
  ScaleAnimationscaleAnimation=newScaleAnimation(1,0.5f,1,1);//默認(rèn)從(0,0)
  scaleAnimation.setDuration(500);
  scaleAnimation.setInterpolator(ll);
  scaleAnimation.setFillAfter(true);
  chartView.startAnimation(scaleAnimation);

以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,扣丁學(xué)堂是專業(yè)的Java培訓(xùn)機(jī)構(gòu),不僅有專業(yè)的老師和與時(shí)俱進(jìn)的課程體系,還有大量的Java視頻教程供學(xué)員觀看學(xué)習(xí)哦,心動(dòng)的小伙伴快快行動(dòng)吧??鄱W(xué)堂Java技術(shù)交流群:670348138。


扣丁學(xué)堂微信公眾號(hào)



【關(guān)注微信公眾號(hào)獲取更多學(xué)習(xí)資料】



查看更多關(guān)于“Java開發(fā)資訊的相關(guān)文章>>


標(biāo)簽: Java培訓(xùn) Java開發(fā)程序員 Java視頻教程

熱門專區(qū)

暫無熱門資訊

課程推薦

微信
微博
15311698296

全國(guó)免費(fèi)咨詢熱線

郵箱:codingke@1000phone.com

官方群:148715490

北京千鋒互聯(lián)科技有限公司版權(quán)所有   北京市海淀區(qū)寶盛北里西區(qū)28號(hào)中關(guān)村智誠(chéng)科創(chuàng)大廈4層
京ICP備2021002079號(hào)-2   Copyright ? 2017 - 2022
返回頂部 返回頂部