开发工具:
文件大小: 26mb
下载次数: 0
上传时间: 2017-09-25
详细说明:
从2阶到7阶的贝赛尔曲线 private static final int MAX_COUNT = 7; // 贝塞尔曲线最大阶数 private static final int REGION_WIDTH = 30; // 合法区域宽度 private static final int FINGER_RECT_SIZE = 60; // 矩形尺寸 private static final int BEZIER_WIDTH = 10; // 贝塞尔曲线线宽 privat e static final int TANGENT_WIDTH = 6; // 切线线宽 private static final int CONTROL_WIDTH = 12; // 控制点连线线宽 private static final int CONTROL_RADIUS = 12; // 控制点半径 private static final int TEXT_SIZE = 40; // 文字画笔尺寸 private static final int TEXT_HEIGHT = 60; // 文本高度 private static final int RATE = 10; // 移动速率 private static final int HANDLER_WHAT = 100; private static final int FRAME = 1000; // 1000帧 private static final String[] TANGENT_COLORS = {"#7fff00", "#7a67ee", "#ee82ee", "#ffd700", "#1c86ee", "#8b8b00"}; // 切线颜色 private static final int STATE_READY = 0x0001; private static final int STATE_RUNNING = 0x0002; private static final int STATE_STOP = 0x0004; private static final int STATE_TOUCH = 0x0010; private Path mBezierPath = null; // 贝塞尔曲线路径 private Paint mBezierPaint = null; // 贝塞尔曲线画笔 private Paint mMovingPaint = null; // 移动点画笔 private Paint mControlPaint = null; // 控制点画笔 private Paint mTangentPaint = null; // 切线画笔 private Paint mLinePaint = null; // 固定线画笔 private Paint mTextPointPaint = null; // 点画笔 private Paint mTextPaint = null; // 文字画笔 private ArrayList mBezierPoints = null; // 贝塞尔曲线点集 private PointF mBezierPoint = null; // 贝塞尔曲线移动点 private ArrayList mControlPoints = null; // 控制点集 private ArrayList>> mTangentPoints; // 切线点集 private ArrayList> mInstantTangentPoints; private int mR = 0; // 移动速率 private int mRate = RATE; // 速率 private int mState; // 状态 private boolean mLoop = false; // 设置是否循环 private boolean mTangent = true; // 设置是否显示切线 private int mWidth = 0, mHeight = 0; // 画布宽高 private PointF mCurPoint; // 当前移动的控制点 private Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { if (msg.what == HANDLER_WHAT) { mR += mRate; if (mR >= mBezierPoints.size()) { removeMessages(HANDLER_WHAT); mR = 0; mState &= ~STATE_RUNNING; mState &= ~STATE_STOP; mState |= STATE_READY | STATE_TOUCH; if (mLoop) { start(); } return; } if (mR != mBezierPoints.size() - 1 && mR + mRate >= mBezierPoints.size()) { mR = mBezierPoints.size() - 1; } // Bezier点 mBezierPoint = new PointF(mBezierPoints.get(mR).x, mBezierPoints.get(mR).y); // 切线点 if (mTangent) { int size = mTangentPoints.size(); ArrayList instantpoints; mInstantTangentPoints = new ArrayList<>(); for (int i = 0; i < size; i++) { int len = mTangentPoints.get(i).size(); instantpoints = new ArrayList<>(); for (int j = 0; j < len; j++) { float x = mTangentPoints.get(i).get(j).get(mR).x; float y = mTangentPoints.get(i).get(j).get(mR).y; instantpoints.add(new PointF(x, y)); } mInstantTangentPoints.add(instantpoints); } } if (mR == mBezierPoints.size() - 1) { mState |= STATE_STOP; } invalidate(); } } }; ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.