2013年8月27日

animation动画应用--android游戏开发

摘要: 主要函数: /** * AlphaAnimation * float 起始透明度 * float 结束透明度 */ alphaAnimation=new AlphaAnimation(0.0f, 1.0f);// 渐变透明度动画效果 alphaAnimation.setAnimationListener(this); alphaAnimation.setDuration(10000); thi... 阅读全文

posted @ 2013-08-27 17:27 clarenceV1 阅读(355) 评论(0) 推荐(0)

可视区域应用-android游戏开发

摘要: 主要方法: //----设置矩形可视区域 canvas.save(); canvas.clipRect(20,20,50,50); canvas.drawBitmap(bmp, 0, 0, paint); canvas.restore(); //----利用Path设置可视区域 canvas.save(); Path path=new Path(); path.addCircle(100+30, 100+30, 30, Direction.CCW); canvas.clipPath(path); canvas.drawBitma... 阅读全文

posted @ 2013-08-27 16:36 clarenceV1 阅读(380) 评论(0) 推荐(0)

Bitmap位图渲染与操作(图片移动,放大,缩小,旋转,镜像发转)--android游戏开发

摘要: 位图操作主要有2中方式:1.使用canvas 画布操作:canvas.drawColor(Color.BLACK); // ----------旋转位图(方式1) canvas.save(); canvas.rotate(30, bmp.getWidth() / 2, bmp.getHeight() / 2);// 旋转弧度,旋转中心点x,旋转中心点y canvas.drawBitmap(bmp, bmp.getWidth() / 2 + 20,bmp.getHeight() + 10, paint); canvas.restore(); // ------... 阅读全文

posted @ 2013-08-27 16:15 clarenceV1 阅读(4347) 评论(1) 推荐(0)

canvas画笔函数介绍--android游戏开发

摘要: 函数介绍:canvas.drawColor(Color.WHITE); Paint paint1 = new Paint(); canvas.drawCircle(40, 30, 20, paint1); paint1.setAntiAlias(true); //-----设置画笔无锯齿 canvas.drawCircle(100, 30, 20, paint1); canvas.drawText("无透明度", 100, 70, new Paint()); Paint paint2 = new Paint(); paint2.setAlpha... 阅读全文

posted @ 2013-08-27 14:52 clarenceV1 阅读(895) 评论(0) 推荐(0)

画布函数介绍-android游戏开发

摘要: 主要函数介绍://----设置画布绘图无锯齿 canvas.setDrawFilter(pfd); //----利用填充画布,刷屏 canvas.drawColor(Color.BLACK); //----绘制文本 canvas.drawText("drawtext", 10, 10, paint); //----绘制像素点 canvas.drawPoint(10,20,paint); //----绘制多个像素点 canvas.drawPoints(new float[]{10,30,30,30}, paint); //----绘制... 阅读全文

posted @ 2013-08-27 14:39 clarenceV1 阅读(397) 评论(0) 推荐(0)

贝塞尔曲线-android游戏开发

摘要: 案例简介:通过贝塞尔曲线手指点击屏幕划出曲线来主要内容: path.reset();// 重置path path.moveTo(x[0], y[0]);// 贝赛尔曲线的起始点 path.quadTo(x[i-1], y[i-1], x[i], y[i]);// 设置贝赛尔曲线的操作点以及终止点 canvas.drawPath(path, paint); // 绘制贝赛尔曲线(Path)源码: 1 package caicai.animation; 2 import java.util.Random; 3 4 import android.content.Context; 5 i... 阅读全文

posted @ 2013-08-27 14:15 clarenceV1 阅读(653) 评论(0) 推荐(0)

View游戏框架--android开发

摘要: 主要通过重写@Override public void draw(Canvas canvas) { }然后通过invalidate();或者postInvalidate();重绘画布,不断更新页面坦克图片材料部分源码:MyView 1 package caicai.animation; 2 3 import android.content.Context; 4 import android.graphics.Bitmap; 5 import android.graphics.BitmapFactory; 6 import android.graphics.Canvas; 7 import a. 阅读全文

posted @ 2013-08-27 11:08 clarenceV1 阅读(298) 评论(0) 推荐(0)

SurfaceView游戏框架--android开发

摘要: 案例功能,点击界面图片跟随变化自定义surfaceiew 1 package caicai.animation; 2 3 import android.R.color; 4 import android.content.Context; 5 import android.graphics.Bitmap; 6 import android.graphics.BitmapFactory; 7 import android.graphics.Canvas; 8 import android.graphics.Color; 9 import android.graphics.Pai... 阅读全文

posted @ 2013-08-27 10:42 clarenceV1 阅读(318) 评论(0) 推荐(0)

导航