
在本教程中,我们将学习如何使用 FabricJS 设置椭圆的高度。椭圆形是 FabricJS 提供的各种形状之一。为了创建一个椭圆,我们将创建一个 Fabric.Ellipse 类的实例并将其添加到画布中。我们可以通过改变椭圆对象的位置、不透明度、描边及其尺寸来操纵椭圆对象。 FabricJS 允许我们使用 width 和 height 属性来控制对象的尺寸。
语法
new fabric.Ellipse({ height: Number }: Object)参数
选项(可选)- 此参数是一个对象 为我们的椭圆提供额外的定制。使用此参数,可以更改与高度为属性的对象相关的颜色、光标、描边宽度和许多其他属性。
选项键
高度 - 此属性接受数字 strong> 允许我们指定对象的高度。分配的值决定高度。
示例 1
height 属性的默认行为
让我们举个例子来了解 height 属性的默认行为。
How to set the height of an Ellipse using FabricJS?
Here we have set the dimensions of the ellipse by passing the horizonal and vertical radius, rx and ry. We have not used the height property.
示例 2
将 height 属性作为键传递
由于椭圆的尺寸由其水平和高度决定垂直半径,其大小不会有任何变化。
How to set the height of an Ellipse using FabricJS?
There is no change in the dimensions of the ellipse even though we have used the height property. This is because the dimensions are controlled by the horizontal and vertical radius, rx and ry.










