英文:
how to draw number '6' using path with animation in flutter?
问题
需要使用Dart绘制完美的数字6形状,请参考下面的代码:
@override
void paint(Canvas canvas, Size size) {
double ht = size.height;
double wt = size.width;
var path = Path();
path.moveTo(wt / 2 + 5, 5);
path.cubicTo(wt / 2 + 10, 5, wt / 6, ht / 2, wt / 2, ht - 10);
path.cubicTo(wt / 2, ht - 10, wt, ht / 1.8, wt / 2 - 25, ht / 2);
canvas.drawPath(path, _paint);
}
希望对您有所帮助。
英文:
Need to draw perfect 6 shape (ref ima) using dart.
Like this...
tried below code not giving perfect 6
@override
void paint(Canvas canvas, Size size) {
double ht = size.height;
double wt = size.width;
var path = Path();
path.moveTo(wt / 2 + 5, 5);
path.cubicTo(wt / 2 + 10, 5, wt / 6, ht / 2, wt / 2, ht - 10);
path.cubicTo(wt / 2, ht - 10, wt, ht / 1.8, wt / 2 - 25, ht / 2);
canvas.drawPath(path, _paint);
}
答案1
得分: 1
我可以绘制如下图形:
path.moveTo(wt / 1.4, 40);
path.cubicTo(wt / 2 + 10, 20, wt / 4, ht / 4, wt / 2.9, ht / 1.4);
path.addArc(
Rect.fromCenter(
center: Offset(wt / 2 + 8, ht / 1.5),
width: wt / 2.4,
height: wt / 2.3),
math.pi,
(2 * math.pi));
canvas.drawPath(path, paint);
英文:
I can able to draw as below,
path.moveTo(wt / 1.4, 40);
path.cubicTo(wt / 2 + 10, 20, wt / 4, ht / 4, wt / 2.9, ht / 1.4);
path.addArc(
Rect.fromCenter(
center: Offset(wt / 2 + 8, ht / 1.5),
width: wt / 2.4,
height: wt / 2.3),
math.pi,
(2 * math.pi));
canvas.drawPath(path, paint);
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论