- 浏览: 5779419 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (890)
- WindowsPhone (0)
- android (88)
- android快速迭代 (17)
- android基础 (34)
- android进阶 (172)
- android高级 (0)
- android拾遗 (85)
- android动画&效果 (68)
- Material Design (13)
- LUA (5)
- j2me (32)
- jQuery (39)
- spring (26)
- hibernate (20)
- struts (26)
- tomcat (9)
- javascript+css+html (62)
- jsp+servlet+javabean (14)
- java (37)
- velocity+FCKeditor (13)
- linux+批处理 (9)
- mysql (19)
- MyEclipse (9)
- ajax (7)
- wap (8)
- j2ee+apache (24)
- 其他 (13)
- phonegap (35)
最新评论
-
Memories_NC:
本地lua脚本终于执行成功了,虽然不是通过redis
java中调用lua脚本语言1 -
ZHOU452840622:
大神://处理返回的接收状态 这个好像没有监听到 遇 ...
android 发送短信的两种方式 -
PXY:
拦截部分地址,怎么写的for(int i=0;i<lis ...
判断是否登录的拦截器SessionFilter -
maotou1988:
Android控件之带清空按钮(功能)的AutoComplet ...
自定义AutoCompleteTextView -
yangmaolinpl:
希望有表例子更好。。。,不过也看明白了。
浅谈onInterceptTouchEvent、onTouchEvent与onTouch
点击图中的星星开始翻转
源码:
使用方法:
生动的喜欢与收藏按钮MaterialFavoriteButton
http://www.jcodecraeer.com/a/opensource/2015/1009/3555.html
源码:
import android.content.Context; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.Camera; import android.graphics.Matrix; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.View; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; import android.view.animation.Transformation; import android.widget.ImageView; import fr.castorflex.android.flipimageview.R; /** * Created with IntelliJ IDEA. User: castorflex Date: 30/12/12 Time: 16:25 */ public class FlipImageView extends ImageView implements View.OnClickListener, Animation.AnimationListener { private static final int FLAG_ROTATION_X = 1 << 0; private static final int FLAG_ROTATION_Y = 1 << 1; private static final int FLAG_ROTATION_Z = 1 << 2; private static final Interpolator fDefaultInterpolator = new DecelerateInterpolator(); private static int sDefaultDuration; private static int sDefaultRotations; private static boolean sDefaultAnimated; private static boolean sDefaultFlipped; public interface OnFlipListener { public void onClick(boolean flipped); public void onFlipStart(); public void onFlipEnd(); } private OnFlipListener mListener; private boolean mIsFlipped; private boolean mIsDefaultAnimated; private Drawable mDrawable; private Drawable mFlippedDrawable; private FlipAnimator mAnimation; private boolean mIsRotationXEnabled; private boolean mIsRotationYEnabled; private boolean mIsRotationZEnabled; public FlipImageView(Context context) { super(context); init(context, null, 0); } public FlipImageView(Context context, AttributeSet attrs) { super(context, attrs); init(context, attrs, 0); } public FlipImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(context, attrs, defStyle); } private void init(Context context, AttributeSet attrs, int defStyle) { sDefaultDuration = context.getResources().getInteger(R.integer.default_fiv_duration); sDefaultRotations = context.getResources().getInteger(R.integer.default_fiv_rotations); sDefaultAnimated = context.getResources().getBoolean(R.bool.default_fiv_isAnimated); sDefaultFlipped = context.getResources().getBoolean(R.bool.default_fiv_isFlipped); TypedArray a = context .obtainStyledAttributes(attrs, R.styleable.FlipImageView, defStyle, 0); mIsDefaultAnimated = a.getBoolean(R.styleable.FlipImageView_isAnimated, sDefaultAnimated); mIsFlipped = a.getBoolean(R.styleable.FlipImageView_isFlipped, sDefaultFlipped); mFlippedDrawable = a.getDrawable(R.styleable.FlipImageView_flipDrawable); int duration = a.getInt(R.styleable.FlipImageView_flipDuration, sDefaultDuration); int interpolatorResId = a.getResourceId(R.styleable.FlipImageView_flipInterpolator, 0); Interpolator interpolator = interpolatorResId > 0 ? AnimationUtils .loadInterpolator(context, interpolatorResId) : fDefaultInterpolator; int rotations = a.getInteger(R.styleable.FlipImageView_flipRotations, sDefaultRotations); mIsRotationXEnabled = (rotations & FLAG_ROTATION_X) != 0; mIsRotationYEnabled = (rotations & FLAG_ROTATION_Y) != 0; mIsRotationZEnabled = (rotations & FLAG_ROTATION_Z) != 0; mDrawable = getDrawable(); mAnimation = new FlipAnimator(); mAnimation.setAnimationListener(this); mAnimation.setInterpolator(interpolator); mAnimation.setDuration(duration); setOnClickListener(this); setImageDrawable(mIsFlipped ? mFlippedDrawable : mDrawable); a.recycle(); } public boolean isRotationXEnabled() { return mIsRotationXEnabled; } public void setRotationXEnabled(boolean enabled) { mIsRotationXEnabled = enabled; } public boolean isRotationYEnabled() { return mIsRotationYEnabled; } public void setRotationYEnabled(boolean enabled) { mIsRotationYEnabled = enabled; } public boolean isRotationZEnabled() { return mIsRotationZEnabled; } public void setRotationZEnabled(boolean enabled) { mIsRotationZEnabled = enabled; } public FlipAnimator getFlipAnimation() { return mAnimation; } public void setInterpolator(Interpolator interpolator) { mAnimation.setInterpolator(interpolator); } public void setDuration(int duration) { mAnimation.setDuration(duration); } public boolean isFlipped() { return mIsFlipped; } public boolean isAnimated() { return mIsDefaultAnimated; } public void setAnimated(boolean animated) { mIsDefaultAnimated = animated; } public void setFlipped(boolean flipped) { setFlipped(flipped, mIsDefaultAnimated); } public void setFlipped(boolean flipped, boolean animated) { if (flipped != mIsFlipped) { toggleFlip(animated); } } public void toggleFlip() { toggleFlip(mIsDefaultAnimated); } public void toggleFlip(boolean animated) { if (animated) { mAnimation.setToDrawable(mIsFlipped ? mDrawable : mFlippedDrawable); startAnimation(mAnimation); } else { setImageDrawable(mIsFlipped ? mDrawable : mFlippedDrawable); } mIsFlipped = !mIsFlipped; } public void setOnFlipListener(OnFlipListener listener) { mListener = listener; } @Override public void onClick(View v) { toggleFlip(); if (mListener != null) { mListener.onClick(mIsFlipped); } } @Override public void onAnimationStart(Animation animation) { if (mListener != null) { mListener.onFlipStart(); } } @Override public void onAnimationEnd(Animation animation) { if (mListener != null) { mListener.onFlipEnd(); } } @Override public void onAnimationRepeat(Animation animation) { } /** * Animation part All credits goes to coomar */ public class FlipAnimator extends Animation { private Camera camera; private Drawable toDrawable; private float centerX; private float centerY; private boolean forward = true; private boolean visibilitySwapped; public void setToDrawable(Drawable to) { toDrawable = to; visibilitySwapped = false; } public FlipAnimator() { setFillAfter(true); } @Override public void initialize(int width, int height, int parentWidth, int parentHeight) { super.initialize(width, height, parentWidth, parentHeight); camera = new Camera(); this.centerX = width / 2; this.centerY = height / 2; } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { // Angle around the y-axis of the rotation at the given time. It is // calculated both in radians and in the equivalent degrees. final double radians = Math.PI * interpolatedTime; float degrees = (float) (180.0 * radians / Math.PI); // Once we reach the midpoint in the animation, we need to hide the // source view and show the destination view. We also need to change // the angle by 180 degrees so that the destination does not come in // flipped around. This is the main problem with SDK sample, it does not // do this. if (interpolatedTime >= 0.5f) { degrees -= 180.f; if (!visibilitySwapped) { setImageDrawable(toDrawable); visibilitySwapped = true; } } if (forward) { degrees = -degrees; } final Matrix matrix = t.getMatrix(); camera.save(); camera.translate(0.0f, 0.0f, (float) (150.0 * Math.sin(radians))); camera.rotateX(mIsRotationXEnabled ? degrees : 0); camera.rotateY(mIsRotationYEnabled ? degrees : 0); camera.rotateZ(mIsRotationZEnabled ? degrees : 0); camera.getMatrix(matrix); camera.restore(); matrix.preTranslate(-centerX, -centerY); matrix.postTranslate(centerX, centerY); } } }
使用方法:
import android.app.Activity; import android.os.Bundle; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.AccelerateInterpolator; import android.view.animation.AnticipateOvershootInterpolator; import android.view.animation.BounceInterpolator; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; import android.view.animation.OvershootInterpolator; import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.SeekBar; import android.widget.Spinner; import android.widget.TextView; import fr.castorflex.android.flipimageview.R; import fr.castorflex.android.flipimageview.library.FlipImageView; public class SampleActivity extends Activity implements FlipImageView.OnFlipListener, SeekBar.OnSeekBarChangeListener { private static final String[] fData = new String[]{ "Decelerate", "Accelerate", "AccelerateDecelerate", "Bounce", "Overshoot", "AnticipateOvershoot" }; private static final Interpolator[] fInterpolators = new Interpolator[]{ new DecelerateInterpolator(), new AccelerateInterpolator(), new AccelerateDecelerateInterpolator(), new BounceInterpolator(), new OvershootInterpolator(), new AnticipateOvershootInterpolator() }; private SeekBar mSeekBar; private Spinner mSpinner; private TextView mTextViewDuration; private FlipImageView mFlipImageView; private CheckBox mCheckBoxX; private CheckBox mCheckBoxY; private CheckBox mCheckBoxZ; private TextView mTextViewAnimationListener; /** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mTextViewAnimationListener = (TextView) findViewById(R.id.textview); mFlipImageView = (FlipImageView) findViewById(R.id.imageview); mSpinner = (Spinner) findViewById(R.id.spinner); mTextViewDuration = (TextView) findViewById(R.id.textview_duration); mSeekBar = (SeekBar) findViewById(R.id.seekbar); mCheckBoxX = (CheckBox) findViewById(R.id.checkedtextview_x); mCheckBoxY = (CheckBox) findViewById(R.id.checkedtextview_y); mCheckBoxZ = (CheckBox) findViewById(R.id.checkedtextview_z); mSpinner.setAdapter( new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, fData)); mSeekBar.setOnSeekBarChangeListener(this); mFlipImageView.setOnFlipListener(this); } /////////////////////FLIP IMAGE VIEW/////////////////// @Override public void onClick(boolean flipped) { mFlipImageView.setInterpolator(fInterpolators[mSpinner.getSelectedItemPosition()]); mFlipImageView.setDuration(mSeekBar.getProgress()); mFlipImageView.setRotationXEnabled(mCheckBoxX.isChecked()); mFlipImageView.setRotationYEnabled(mCheckBoxY.isChecked()); mFlipImageView.setRotationZEnabled(mCheckBoxZ.isChecked()); } @Override public void onFlipStart() { mTextViewAnimationListener.setText("OnFlipStart"); } @Override public void onFlipEnd() { mTextViewAnimationListener.setText("OnFlipEnd"); } ////////////////////////SEEK BAR///////////////////////// @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { mTextViewDuration.setText("" + progress); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }
生动的喜欢与收藏按钮MaterialFavoriteButton
http://www.jcodecraeer.com/a/opensource/2015/1009/3555.html
发表评论
-
ViewPager引导页根据滑动渐变背景色
2017-03-31 09:38 28161、主要依赖: compile'com.android.su ... -
Android 新推出基于物理的动画库SpringAnimation,完全诠释什么叫做弹簧效果
2017-03-30 10:38 2572Android 最近推出一个新的基于物理学的动画支持库,命名为 ... -
一个比较强大的提供各种形状的ImageView
2016-12-26 09:54 2934github上比较老的项目了,但是还是比较好用的。 各种形状总 ... -
PhotoView点击放大图片效果
2016-12-21 10:13 6052使用的PhotoView是这个版本的,比较小巧,很好用,比gi ... -
仿微信页面切换图标颜色渐变效果
2015-11-23 14:54 4420主要是提供一种思路,一般来书,类似效果无非就是在Canvas, ... -
把任意Drawable转换成基于progress填充的drawable
2015-11-11 16:29 2749把任意Drawable转换成基于progress填充的draw ... -
一个用来设置警示View 的呼吸式背景颜色的工具类BreathingViewHelper
2015-10-10 14:03 3038一个简单的小工具类,用来设置警示 View 的呼吸式背景颜色 ... -
单手操作图片控件 镜像、置顶、缩放、移动:StickerView
2015-10-08 11:21 3167单手操作图片控件 镜像、置顶、缩放、移动 impo ... -
图片浏览zoom效果
2015-10-08 11:05 1794不仅实现了Lollipop中打开新的activity 的zoo ... -
Android App状态栏变色:ColorfulStatusBar
2015-09-24 12:38 9910适用于版本大于等于19以上。 import android ... -
PathView实现炫酷SVG动画
2015-08-25 09:23 4403解析SVG,需要将一个androidsvg.jar包含进lib ... -
LinearLayout增加divider分割线
2015-08-13 14:58 11054在android3.0及后面的版本在LinearLayout里 ... -
Android换肤白天/夜间模式的框架
2015-07-29 15:36 2935Android换肤/夜间模式的Android框架,配合them ... -
使用ActivityOptions做Activity切换动画
2015-04-10 11:02 6576不知道大家有没有注意到startActivity(Intent ... -
一个不错的ArcMenu
2015-01-23 10:34 3906ArcMenu这种效果现在很多人都实现了 而且代码质量也 ... -
使用ScheduledExecutorService延时关闭一个全屏的对话框
2014-12-29 16:38 4371自定义style,设置全屏属性 <resources ... -
让View只显示下边框
2014-10-23 17:13 3965下面的代码是实现一个带边框的xml,很常见 <?xm ... -
让一张图片从模糊慢慢变清晰动画过程
2014-01-27 16:38 9251import java.io.IOExcepti ... -
ListView,GridView之LayoutAnimation特殊动画的实现
2013-05-24 11:23 34369LayoutAnimation干嘛用的?不知道的话网上搜一下。 ... -
食神摇摇中图片的晃动效果
2013-04-27 11:45 5453可以是这样子实现滴: btn_shake=(Image ...
相关推荐
项目使用网上的框架,将左右翻转的效果做成了ImageView,方便使用。
android卡片翻转效果,使用view的draw方法直接绘制,节省性能,如果放到liestview或者recycleview中的话,请自行稍加修改,不要使用bitmap来做存储即可,本想0分,但是目前至少要选1分,没法办
LZBFocusScrollViewScrollStyle_oglFlip, //上下翻转效果 }; 两个imageView实现轮播滚动,支持多种滚动动画 简书地址:http://www.jianshu.com/p/bcd246096984 github地址:...
继承自 ImageView ,能够实现 ImageView 的翻转效果,一般用于勾选某个 ImageView 之后的变化等。 引入方法 Gradle 在应用的build.gradle文件中: allprojects { repositories { ... maven { url '...
然后实现翻转动画,在翻转的时候将imageview移除,添加另一个imageview作为正面。 核心代码: 方法一: 翻转动画,内部实现还是方法二 + (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)...
本文实例为大家分享了android实现3D垂直翻转动画的具体代码,供大家参考,具体内容如下 需求 对ImageView进行类似于翻纸牌的动画 解决 各种Animator的组合 第一步动画: 动画代码文件1,card_flip_left_out....
作者castorflex,源码FlipImageView,这是一款实现了可以翻转改变图片的动画Animation,实现翻转改变图片的动画效果,图片在翻转过程中发生改变。可以设置翻转的动画效果,翻转的速度,以及翻转的对称轴(x轴、y轴...
先来看看效果: 下面进入正题,是时候展现真正的技术了: 首先在控制器里添加一个scrollView,再在scrollView上的对应位置上添加要展示的imageView(立方体视图组),当然也可以放上其它子控制器的view实现更多功能这...
PS:在开发中我们会遇到一些图片处理问题,比如说缓存图片了、限制图片大小了、查看图片了等。上一篇文章介绍了图片的全景效果... 结合其他设置可实现翻转 效果图 1:本地图片加载 <ImageView android:layout_
// 在Z轴上正向移动camera的视角,实际效果为放大图片。 // 如果在Y轴上移动,则图片上下移动;X轴上对应图片左右移动。 mCamera.translate(0.0f, 0.0f, 100.0f); // As the angle of the view gets less, zoom...
IconFont介绍 IconFont 意在基于矢量...灵活性:文字效果可以很容易地应用到你的图标上,包括颜色,阴影和翻转等效果。他们还可以在任何背景下显示。兼容性:图标字体支持Android平台和Ios平台,以及所有浏览器。目
//设置动画的效果,慢入慢出 [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; //只有设置了context,并且设置代理和动画结束后调用的方法,系统会将context传过去 [UIView beginAnimations:nil context...