flutter - 如何在颤动中使用画布创建宠物爪标志
问题描述
我正在尝试使用颤振动态创建一个爪子宠物画布作为以下徽标:
当我尝试创建一个使用Paint()
Canvas 作为以下代码时:
class PetLogo extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
// TODO: implement paint
Paint paint = Paint();
paint
..color = Colors.white
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round
..strokeWidth = 3;
Paint paint1 = Paint();
paint1
..color = Colors.transparent
..style = PaintingStyle.fill
..strokeWidth = 0;
var paint2 = Paint()
..color = Colors.white
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round
..strokeWidth = 3;
//a circle
canvas.drawCircle(Offset(0, 9), 18, paint2);
var paint3 = Paint()
..color = Colors.white
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round
..strokeWidth = 3;
//a circle
canvas.drawCircle(Offset(50, 0), 22, paint3);
var paint4 = Paint()
..color = Colors.white
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round
..strokeWidth = 3;
//a circle
canvas.drawCircle(Offset(100, 10), 18, paint4);
double width = size.width;
double height = size.height;
Path path = Path();
path.moveTo(0.5 * width, height * 0.45);
path.cubicTo(0.2 * width, height * 0.1, -0.50 * width, height * 0.6,
0.5 * width, height);
path.moveTo(0.5 * width, height * 0.45);
path.cubicTo(0.8 * width, height * 0.1, 1.50 * width, height * 0.6,
0.5 * width, height);
canvas.drawPath(path, paint1);
canvas.drawPath(path, paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return true;
}
}
因为最终输出如下图所示:
那么有没有人可以帮我完成这幅画?
解决方案
推荐阅读
- c - 使用 atoi 函数将字符串转换为整数时出现分段错误
- sql-server - 仅当值为 FALSE 时才运行触发器
- javascript - 如何检测对子 vue/nux 自定义指令的点击
- javascript - 在 javascript 中从 html 获取输入
- apache - 为什么文件指令在 Apache 的 httpd.conf 中不起作用?
- apache-kafka - 记录该消费者ID ****离开组时,kafka是什么意思
- salesforce - 自定义对象查找关系soql查询获取sobject
- javascript - 如何在数组 JavaScript 中找到数组 [i] = i 的元素?
- google-analytics - 谷歌分析自定义事件通过谷歌标签管理器推送
- amazon-web-services - Amazon Firehose 从 Kinesis 转换数据并发布自定义端点