黄色网页视频 I 影音先锋日日狠狠久久 I 秋霞午夜毛片 I 秋霞一二三区 I 国产成人片无码视频 I 国产 精品 自在自线 I av免费观看网站 I 日本精品久久久久中文字幕5 I 91看视频 I 看全色黄大色黄女片18 I 精品不卡一区 I 亚洲最新精品 I 欧美 激情 在线 I 人妻少妇精品久久 I 国产99视频精品免费专区 I 欧美影院 I 欧美精品在欧美一区二区少妇 I av大片网站 I 国产精品黄色片 I 888久久 I 狠狠干最新 I 看看黄色一级片 I 黄色精品久久 I 三级av在线 I 69色综合 I 国产日韩欧美91 I 亚洲精品偷拍 I 激情小说亚洲图片 I 久久国产视频精品 I 国产综合精品一区二区三区 I 色婷婷国产 I 最新成人av在线 I 国产私拍精品 I 日韩成人影音 I 日日夜夜天天综合

食神搖搖中圖片的晃動效果

系統 2089 0
食神搖搖中圖片的晃動效果

可以是這樣子實現滴:
    
btn_shake=(ImageView)findViewById(R.id.btn_shake);
startShakeAnimation(btn_shake);

  


    
private void startShakeAnimation(View v){
		int pivot = Animation.RELATIVE_TO_SELF;
		CycleInterpolator interpolator = new CycleInterpolator(3.0f);
		RotateAnimation animation = new RotateAnimation(0, 15, pivot, 0.5f,pivot, 0.5f);
		animation.setStartOffset(4000);
		animation.setDuration(2000);
		animation.setRepeatCount(Animation.INFINITE);
		animation.setInterpolator(interpolator);
		v.startAnimation(animation);
	 }

  


知道CycleInterpolator是干嘛用的就簡單了,Api demo里有它的用法,是個搖頭效果!

//////////////////////////////////////////////////////////////////////////////

抖動:
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
??? android:duration="180"
??? android:fromDegrees="-2"
??? android:pivotX="100%"
??? android:pivotY="100%"
??? android:repeatCount="infinite"
??? android:repeatMode="reverse"
??? android:toDegrees="2" />

Animation shake = AnimationUtils.loadAnimation(context, R.anim.shake);
shake.reset();
shake.setFillAfter(true);
image.startAnimation(shake);

搖頭效果:
shake.xml
    
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
  
          http://www.apache.org/licenses/LICENSE-2.0
  
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromXDelta="0" android:toXDelta="10" android:duration="800" android:interpolator="@anim/cycle_7" />

  


cycle_7.xml
    
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
  
          http://www.apache.org/licenses/LICENSE-2.0
  
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android" android:cycles="5" />

  


代碼實現:
    
/** 
     * 晃動動畫 
     * @param counts 1秒鐘晃動多少下 
     * @return 
     */  
    public static Animation shakeAnimation(int counts){  
        Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);  
        translateAnimation.setInterpolator(new CycleInterpolator(counts));  
        translateAnimation.setDuration(1000);  
        return translateAnimation;  
    }

  

食神搖搖中圖片的晃動效果


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!??!

發表我的評論
最新評論 總共0條評論