当前位置: 首页 > news >正文

做国际贸易用什么网站河北网站优化公司

做国际贸易用什么网站,河北网站优化公司,品牌形象推广,南通动态网站建设ArkTS卡片开放了自定义绘制的能力,在卡片上可以通过Canvas组件创建一块画布,然后通过CanvasRenderingContext2D对象在画布上进行自定义图形的绘制,如下示例代码实现了在画布的中心绘制了一个笑脸。 Entry Component struct Card { private c…

ArkTS卡片开放了自定义绘制的能力,在卡片上可以通过Canvas组件创建一块画布,然后通过CanvasRenderingContext2D对象在画布上进行自定义图形的绘制,如下示例代码实现了在画布的中心绘制了一个笑脸。

@Entry
@Component
struct Card {
private canvasWidth: number = 0;
private canvasHeight: number = 0;
// 初始化CanvasRenderingContext2D和RenderingContextSettings
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);build() {
Column() {
Row() {
Canvas(this.context)
.margin('5%')
.width('90%')
.height('90%')
.onReady(() => {
console.info('[ArkTSCard] onReady for canvas draw content');
// 在onReady回调中获取画布的实际宽和高
this.canvasWidth = this.context.width;
this.canvasHeight = this.context.height;
// 绘制画布的背景
this.context.fillStyle = 'rgba(203, 154, 126, 1.00)';
this.context.fillRect(0, 0, this.canvasWidth, this.canvasHeight);
// 在画布的中心绘制一个红色的圆
this.context.beginPath();
let radius = this.context.width / 3
let circleX = this.context.width / 2
let circleY = this.context.height / 2
this.context.moveTo(circleX - radius, circleY);
this.context.arc(circleX, circleY, radius, 2 * Math.PI, 0, true);
this.context.closePath();
this.context.fillStyle = 'red';
this.context.fill();
// 绘制笑脸的左眼
let leftR = radius / 4
let leftX = circleX - (radius / 2)
let leftY = circleY - (radius / 3.5)
this.context.beginPath();
this.context.arc(leftX, leftY, leftR, 0, Math.PI, true);
this.context.strokeStyle = '#ffff00'
this.context.lineWidth = 10
this.context.stroke()
// 绘制笑脸的右眼
let rightR = radius / 4
let rightX = circleX + (radius / 2)
let rightY = circleY - (radius / 3.5)
this.context.beginPath();
this.context.arc(rightX, rightY, rightR, 0, Math.PI, true);
this.context.strokeStyle = '#ffff00'
this.context.lineWidth = 10
this.context.stroke()
// 绘制笑脸的嘴巴
let mouthR = radius / 2.5
let mouthX = circleX
let mouthY = circleY + (radius / 3)
this.context.beginPath();
this.context.arc(mouthX, mouthY, mouthR, Math.PI, 0, true);
this.context.strokeStyle = '#ffff00'
this.context.lineWidth = 10
this.context.stroke()
})
}
}.height('100%').width('100%')
}
}

 

http://www.mmbaike.com/news/87599.html

相关文章:

  • 营销网站的特征关键词名词解释
  • 科技企业网站如何建设网站建设找哪家好
  • 那些视频网站能用来直接做href企业网站有什么
  • 麻辣烫配方教授网站怎么做网络推广大概需要多少钱
  • 网站防黑客入侵做相关防御推广品牌的策划方案
  • 网站设计岗位的职责与要求主要推广手段免费
  • 效果图网站推荐大全面包砖网上营销
  • 南阳政府做网站推广吗搜索引擎优化的核心是
  • 投票活动网站怎么做朝阳区搜索优化seosem
  • 如何建设网站脱颖而出整站关键词排名优化
  • 济南seo排名搜索网络推广优化seo
  • 建站公司不给源码网络推广技术外包
  • 公司图片seo网站优化专员
  • 无锡网站定制最新seo自动优化软件
  • 重复打开同一个网站怎么做百度推广外包哪家不错
  • 北京医疗网站建设软文代写费用
  • 做网站吗论坛推广平台有哪些
  • 佛山网站建设找千界学电商出来一般干什么工作
  • 平面设计海报作品欣赏排名轻松seo 网站推广
  • 平面设计跟网站建设深圳网站开发
  • 如何制作手机版网站美橙互联建站
  • 怎么做网站盈利seo怎么发外链的
  • 深圳知名网站建设哪家好网站seo快速优化技巧
  • 在日本做色情网站800元做小程序网站
  • 做网站的用处网络推广员为什么做不长
  • 嵌入式和单片机的区别石家庄抖音seo
  • wordpress后台左侧菜单显示东莞seo排名优化
  • 开发工具app长沙seo优化排名
  • 湘潭建网站万能引流软件
  • 百度公司网站怎么建设品牌策划方案模板