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

企业网站为什么做优化重庆seo1

企业网站为什么做优化,重庆seo1,做网站需要下什么软件,如何做网站粘贴广告本篇文章介绍一下如何创建图像的 JSON 表示形式 使用 FabricJS 的对象。我们可以通过创建一个实例来创建一个 Image 对象 织物.图像。由于它是FabricJS的基本元素之一,我们也可以轻松地 通过应用角度、不透明度等属性来自定义它。为了创建 JSON Image 对象的表示&am…

本篇文章介绍一下如何创建图像的 JSON 表示形式 使用 FabricJS 的对象。我们可以通过创建一个实例来创建一个 Image 对象 织物.图像。由于它是FabricJS的基本元素之一,我们也可以轻松地 通过应用角度、不透明度等属性来自定义它。为了创建 JSON Image 对象的表示,我们使用 toJSON 方法。

语法

toJSON(propertiesToInclude: Array): Object

 

参数

  • propertiesToInclude - 此参数接受一个 Array,其中包含任何 我们可能希望在输出中额外包含的属性。这个参数是 可选。

使用toJSON方法

示例

看一个代码示例,看看使用 toJSON 方法时记录的输出。在这种情况下,将返回图像实例的 JSON 表示形式。

<!DOCTYPE html>
<html>
<head><!-- Adding the Fabric JS Library--><script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/510/fabric.min.js"></script>
</head>
<body><h2>Using the toJSON method</h2><p>You can open console from dev tools and see that the logged output contains the JSON representation of the image instance</p><canvas id="canvas"></canvas><img src="https://www.tutorialspoint.com/images/logo.png" id="img1" style="display: none" /><script>// Initiate a canvas instancevar canvas = new fabric.Canvas("canvas");canvas.setWidth(document.body.scrollWidth);canvas.setHeight(250);// Initiating the image elementvar imageElement = document.getElementById("img1");// Initiate an Image objectvar image = new fabric.Image(imageElement, {top: 50,left: 110,});// Add it to the canvascanvas.add(image);// Using the toJSON methodconsole.log("JSON representation of the Image instance is: ",image.toJSON());</script>
</body>
</html>

 

使用toJSON方法添加其他属性

示例

再看一个代码示例,看看如何使用 toJSON 方法。在本例中,我们添加了一个名为“name”的自定义属性。我们可以 将特定属性作为选项中的第二个参数传递给 fabric.Image 实例 对象并将相同的密钥传递给 toJSON 方法。

<!DOCTYPE html>
<html>
<head><!-- Adding the Fabric JS Library--><script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/510/fabric.min.js"></script>
</head>
<body><h2>Using toJSON method to add additional properties</h2><p>You can open console from dev tools and see that the logged output contains added property called name</p><canvas id="canvas"></canvas><img src="https://www.tutorialspoint.com/images/logo.png" id="img1" style="display: none" /><script>// Initiate a canvas instancevar canvas = new fabric.Canvas("canvas");canvas.setWidth(document.body.scrollWidth);canvas.setHeight(250);// Initiating the image elementvar imageElement = document.getElementById("img1");// Initiate an Image object with name key// passed in options objectvar image = new fabric.Image(imageElement, {top: 50,left: 110,name: "Image instance",});// Add it to the canvascanvas.add(image);// Using the toJSON methodconsole.log("JSON representation of the Image instance is: ",image.toJSON(["name"]));</script>
</body>
</html>

 

http://www.wangmingla.cn/news/144760.html

相关文章:

  • 静态网站漏洞哈尔滨最新疫情通报
  • 怎样办网站做宣传外链链接平台
  • iis网站数据库失败市场营销毕业后找什么工作
  • 公司网站首页设计模板北京互联网公司排名
  • 辽宁省住房和城乡建设厅证件查询宁波seo推广哪家好
  • wordpress scripts gzip电商seo搜索优化
  • 网站栏目设计方案百度搜索关键词优化
  • 做网站销售会遇到哪些问题江苏泰州seo网络优化推广
  • 视频网站哪个做的好百度投诉热线中心客服
  • 做网站属于什么科目百度快照收录入口
  • 三站一体网站制作网上推广怎么做
  • 网站建设有哪些基本流程中国企业100强
  • 高端网站设计合肥网站建设营销策略从哪几个方面分析
  • 十堰网站seo方法推广资源整合平台
  • 苏州做网站找哪家好快速排名方案
  • php网站开发权限管理小说榜单首页百度搜索风云榜
  • 淮安汽车集团网站建设拉新推广怎么快速拉人
  • 可以做自媒体的网站海外推广是做什么的
  • 如何修改网站标题免费建网站知乎
  • 衡水网络推广 衡水网站建设长沙做网站推广
  • iis网站服务器安全隐患谷歌google 官网下载
  • 绿色网站模版网络广告图片
  • wordpress 可以提交信息入口南宁seo怎么做优化团队
  • 管理系统的组成廊坊自动seo
  • 免费网站源码推广和竞价代运营
  • 微信做淘宝客 网站打不开当日alexa排名查询统计
  • wordpress企业站爱主题阿里巴巴seo排名优化
  • 没有网站可以做网络推广吗app优化网站
  • 炫酷的电商网站设计seo研究中心vip课程
  • 河北做网站哪家公司好推广神器