欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

android圖形圖像-創(chuàng)新互聯(lián)


android圖形圖像
Tween動(dòng)畫和Frame動(dòng)畫

為樂業(yè)等地區(qū)用戶提供了全套網(wǎng)頁(yè)設(shè)計(jì)制作服務(wù),及樂業(yè)網(wǎng)站建設(shè)行業(yè)解決方案。主營(yíng)業(yè)務(wù)為網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、樂業(yè)網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠(chéng)的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!1、Android平臺(tái)提供了兩類動(dòng)畫,分別是Tween動(dòng)畫和Frame動(dòng)畫。

Tween通過場(chǎng)景里的對(duì)象不斷的進(jìn)行圖片的變換,比如平移、漸變、縮放、
旋轉(zhuǎn)等來(lái)產(chǎn)生動(dòng)畫效果;
Frame動(dòng)畫叫做順序播放實(shí)現(xiàn)做好的圖像和電影類似。另外加上gif動(dòng)畫,
因?yàn)槿绻苯邮褂肂itmap或其他方法直接調(diào)用gif圖片資源的話,顯示的
是靜態(tài)的,如果要做成動(dòng)態(tài)的,就需要一些其他的方法來(lái)實(shí)現(xiàn)。

Tween動(dòng)畫分類:

Alpha:漸變透明度動(dòng)畫
Scale:漸變尺寸伸縮動(dòng)畫
Translate:畫面轉(zhuǎn)換位置移動(dòng)動(dòng)畫
Rotate:畫面轉(zhuǎn)移旋轉(zhuǎn)動(dòng)畫

有兩種方式(java,xml):
java:

AlphaAnimation anim = new AlphaAnimation(0,1);
anim.setDuration(3000);
imageView.startAnimation(anim);

xml:
res/anim

<?xml version="1.0" encoding="utf-8"?><alphaxmlns:android="http://schemas.android.com/apk/res/android"
    android:fromAlpha="0.0"
    android:toAlpha="1.0"
    android:duration="2000"  ></alpha>
Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.alpha);
imageView.startAnimation(animation);

2)scale
ScaleAnimation(float fromX, float toX, float fromY,
float toY, int pivotXType, floatXValue,
int pivotYType, float pivotYValue)
   功能:創(chuàng)建一個(gè)漸變尺寸伸縮動(dòng)畫
   參數(shù):fromX,toX分別是起始和結(jié)束時(shí)x坐標(biāo)上的伸縮尺寸。
   fromY,toY分別是起始和結(jié)束時(shí)ye坐標(biāo)上的伸縮尺寸。
   pivotXValue,pivotYValue分別為伸縮動(dòng)畫相對(duì)于x,y坐標(biāo)開始的位置,
   pivotXType,pivotYType分別為x,y的伸縮模式。
2.1)、直接在程序中實(shí)現(xiàn)的方式j(luò)ava代碼:

Animation scale = new ScaleAnimation(0f, 1f, 0f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);?
    scale.setDuration(5000);?//設(shè)置動(dòng)畫持續(xù)時(shí)間?    img.startAnimation(scale); //開始動(dòng)畫

ps:

相對(duì)于(0,0)位置

Animation anim = new ScaleAnimation(0, 1, 0, 1);

相對(duì)與自身中心位置

Animation anim = new ScaleAnimation(1.0f,0.0f,1.0f,0.0f,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);

是否保持動(dòng)畫后的狀態(tài),true表示保持

anim.setFillAfter(true);

消失在(300,300)的位置

Animation anim = new ScaleAnimation(1.0f,0.0f,1.0f,0.0f,Animation.ABSOLUTE,300,Animation.ABSOLUTE,300);

*****重點(diǎn)理解
00……………………………………………………………………………………………………………………………..

2.2).xml

<?xml version="1.0" encoding="utf-8"?><scalexmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="2000"
    android:fromXScale="0.0"
    android:toXScale="1.0"
    android:fromYScale="0.0"
    android:toYScale="1.0"
    android:pivotX="300"
    android:pivotY="300"  ></scale>

以指定位置(300,300)為中心點(diǎn)

<?xml version="1.0" encoding="utf-8"?><scalexmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="2000"
    android:fromXScale="0.0"
    android:toXScale="1.0"
    android:fromYScale="0.0"
    android:toYScale="1.0"
    android:pivotX="50%"
    android:pivotY="50%"  ></scale>

通過%來(lái)表示相對(duì)于自身什么位置

<scalexmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="2000"
    android:fromXScale="0.0"
    android:toXScale="1.0"
    android:fromYScale="0.0"
    android:toYScale="1.0"
    android:pivotX="50%p"
    android:pivotY="100%p"  >  </scale>

通過p表示相對(duì)于父控件什么位置

android:interpolator="@android:anim/accelerate_decelerate_interpolator"

指定速度變化過程

3)translate
TranslateAnimation(float fromXDelta, float toXDelta, float YDelta, float toYDelta)
   功能:創(chuàng)建一個(gè)移動(dòng)畫面位置的動(dòng)畫
   參數(shù):fromXDelta,fromYDelta分別是其實(shí)坐標(biāo);toXDelta,toYDelta分別是結(jié)束坐標(biāo)
1、直接在程序中實(shí)現(xiàn)java代碼:

Animation translate = new TranslateAnimation(10, 100, 10, 100);
translate.setDuration(3000);?//設(shè)置動(dòng)畫持續(xù)時(shí)間?img.startAnimation(translate); //開始動(dòng)畫?

2、在XML中創(chuàng)建動(dòng)畫
<?xml version="1.0" encoding="utf-8"?><translatexmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="10"
android:toXDelta="100"
android:fromYDelta="10"
android:toYDelta="100"
android:duration="5000"/>

   java調(diào)用

Animation translate = AnimationUtils.loadAnimation(TweenActivity.this, R.anim.translate_anim);?
    img.startAnimation(translate);//開始動(dòng)畫

4)rotate
Rotate(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType,float pivotYValue)
   功能:創(chuàng)建一個(gè)旋轉(zhuǎn)畫面的動(dòng)畫
   參數(shù):fromDegrees為開始的角度;toDegrees為結(jié)束的角度。pivotXValue、pivotYType分別為x,y的伸縮模式。pivotXValue,pivotYValue分別為伸縮動(dòng)畫相對(duì)于x,y的坐標(biāo)開始位置
1、直接在程序中創(chuàng)建動(dòng)畫java代碼:

Animation rotate = new RotateAnimation(0f,+360f,?
Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF, 0.5f);?
rotate.setDuration(3000);
img.startAnimation(rotate);

5)AnimationSet
是一個(gè)動(dòng)畫集合
java:

AnimationSet as = new AnimationSet(true);
as.setDuration(2000);//給每一個(gè)Animation指定持續(xù)時(shí)間as.setInterpolator(new LinearInterpolator());//指定AnimationSet中所有的Animation都是勻速Animation rotateAnim = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF,0.5f);
//rotateAnim.setDuration(2000);rotateAnim.setStartOffset(1000);//在下邊startAnimation之后,過多長(zhǎng)時(shí)間開始執(zhí)行動(dòng)畫AlphaAnimation alphaAnim = new AlphaAnimation(0, 1);
//alphaAnim.setDuration(2000);as.addAnimation(rotateAnim);
as.addAnimation(alphaAnim);
imageView.startAnimation(as);

xml:

<?xml version="1.0" encoding="utf-8"?><setxmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="true"
    android:interpolator="@android:anim/decelerate_interpolator"
    android:duration="2000"  >  <rotate 
android:fromDegrees="0"
        android:toDegrees="-360"
        android:pivotX="50%"
        android:pivotY="50%"
        android:startOffset="2000"   />  <scale
android:fromXScale="1"
        android:toXScale="3"
        android:fromYScale="1"
        android:toYScale="3"
        android:pivotX="0"
        android:pivotY="0"   /></set>
Animation anim = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.set);
imageView.startAnimation(anim);

ps:1.監(jiān)聽Animation狀態(tài)的事件AnimationListener

anim.setAnimationListener(new AnimationListener() {
    @Override
public void onAnimationStart(Animation animation) {
        
    }
    @Override
public void onAnimationRepeat(Animation animation) {
        
    }
    @Override
public void onAnimationEnd(Animation animation) {
        
    }
});
ps.2.啟動(dòng)Animation兩種方式
imageView.startAnimation(anim);

imageView.setAnimation(anim);
anim.start();
以上兩者等價(jià)
anim.cancle();

2.Frame動(dòng)畫

2.1 java的實(shí)現(xiàn):

方式一:

private int[] images = {R.drawable.pic1,
    R.drawable.pic2,R.drawable.pic3,
    R.drawable.pic4};
final AnimationDrawable animDrawable = new AnimationDrawable();

for(int i=0;i<4;i++){
    animDrawable.addFrame(getResources().getDrawable(images[i]),80);
}
image.setBackgroundDrawable(animDrawable);
animDrawable.setOneShot(false);
btn1.setOnClickListener(new OnClickListener() {
    @Override
public void onClick(View v) {
        animDrawable.start();
//                animDrawable.stop();    }
});

方式二:
要求是文件命名要遵循一定規(guī)律,方便遞歸查找。
for(int i=0;i<4;i++){
   //參數(shù)1,文件名
   //參數(shù)2,資源類型
   //參數(shù)3,是那個(gè)package的。
   int resId = getResources().getIdentifier("pic"+(i+1), "drawable", "com.anjoyo.animation2");
   animDrawable.addFrame(getResources().getDrawable(resId), 500);
}
image.setBackgroundDrawable(animDrawable);
animDrawable.start();

2.2xml的實(shí)現(xiàn):
定義:

<?xml version="1.0" encoding="utf-8"?><animation-listxmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">  <itemandroid:drawable="@drawable/pic1" android:duration="500"/>  <itemandroid:drawable="@drawable/pic2" android:duration="500"/>  <itemandroid:drawable="@drawable/pic3" android:duration="500"/>  <itemandroid:drawable="@drawable/pic4" android:duration="500"/></animation-list>
使用1:
AnimationDrawable d = (AnimationDrawable) getResources().getDrawable(R.anim.frame);
image.setBackgroundDrawable(d);
d.start();
使用2,在xml中使用:
<ImageView
android:id="@+id/image"
    android:layout_width="300dp"
    android:layout_height="400dp"
    android:background="@anim/frame"  />

AnimationDrawable d = (AnimationDrawable) image.getBackground();
d.start();

當(dāng)前題目:android圖形圖像-創(chuàng)新互聯(lián)
網(wǎng)站網(wǎng)址:http://aaarwkj.com/article18/cogcdp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈、響應(yīng)式網(wǎng)站網(wǎng)站排名、網(wǎng)站營(yíng)銷關(guān)鍵詞優(yōu)化、品牌網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)
国产极品美女视频福利| 国产精品一区二区毛卡片| 麻豆专区一区二区三区| 日韩欧美国产精品福利| 亚洲一区二区三区四区国产| 高清白嫩学生自拍视频| 亚洲国产成在人网站天堂| 日韩av在线不卡一区二区| 亚洲av色男人天堂网| 亚洲午夜一区二区精品| 91精品国产人妻女教师| 性生活视性生活大片日本| 亚洲精品中文字幕乱码三区91| 亚洲国产日韩伦中文字幕| 日韩中文免费av一区| 精品国产一区二区三级四区| 欧美精品色精品免费观看| 午夜性色福利在线播放| 麻豆人妻一区二区三区| 亚洲激情久热中文字幕| 青青草最新网址在线观看视频 | 久久成人日韩电影午夜| 九九六热这里只有精品| 日本在线最新视频一区二区三区| 久久蜜臀av一区三区| 麻豆国产传媒69国产| 精品蜜桃臀91人少妇| 国产饥渴熟女在线三区| 免费草b视频在线观看| 久久精品欧美日韩视频| 国产一区二区三区av在线播放| 草莓午夜视频在线观看| 欧美亚洲另类日韩综合网| 91美女黑丝免费国产视频| 亚洲男人成人性天堂网站| 国产午夜视频在线观看一区| 亚洲av毛片在线免费| 丝袜美腿美女日韩在线| 成人国产精品三上悠亚久久| 亚洲av在线视频免费播放| 亚洲国产欲色有一二欲色|