代码拉取完成,页面将自动刷新
同步操作将从 HarmonyOS-TPC/BezierMaker 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
通过de Casteljau算法绘制贝塞尔曲线,并计算它的切线,实现1-7阶贝塞尔曲线的形成动画。 德卡斯特里奥算法可以计算出Bezier曲线上的一个点,进而绘制出Bezier曲线。
想深入了解德卡斯特里奥算法的同学可以参考这篇文章《德卡斯特里奥算法——找到Bezier曲线上的一个点》。
方式一: 通过library生成har包,添加har包到libs文件夹内 在entry的gradle内添加如下代码
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
方式二:
allprojects{
repositories{
mavenCentral()
}
}
implementation 'io.openharmony.tpc.thirdlib:BezierMaker:1.0.5'
public class MainAbility extends Ability {
BezierView mBezierView;
@Override
protected void onStart(Intent intent) {
super.onStart(intent);
setUIContent(ResourceTable.Layout_ability_main);
mBezierView = (BezierView) findComponentById(ResourceTable.Id_bezier);
}
public void start(Component component) {
mBezierView.start();
}
public void stop(Component component) {
mBezierView.stop();
}
public void add(Component component) {
mBezierView.addPoint();
}
public void del(Component component) {
mBezierView.delPoint();
}
}
method 方法 | description 描述 |
---|---|
void start() | 开始贝塞尔曲线(required) |
void stop() | 停止贝塞尔曲线(optional) |
boolean addPoint() | 增加控制点(optional) |
boolean delPoint() | 删除控制点(optional) |
int getOrder() | 获取贝塞尔曲线阶数(optional) |
void setRate(int rate) | 设置移动速率(optional) |
void setTangent(boolean tangent) | 设置是否显示切线(optional) |
void setLoop(boolean loop) | 设置是否循环(optional) |
void setOrder(int order) | 设置贝塞尔曲线阶数(optional) |
Copyright (C) 2016 venshine.cn@gmail.com
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.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。