fill.y

类型 数字
对象 BitmapPaint
display.*
修订版 2024.3703 版
另请参阅 BitmapPaint
fill.x

概述

此值用于按照位图填充高度的比例来偏移重复位图填充。

对于此属性,需要使用 -11 之间的值,而不是使用特定像素值。这会告知 GPU 按照完整重复方式在垂直方向上偏移模式。因此,使用 0.5 会沿着 y 轴将模式偏移一个重复距离的一半。

一个重要的区别在于,设置正值会向上偏移模式,而设置负值会向下偏移对象。

示例

-- Create a vector rectangle
local rect = display.newRect( 200, 200, 300, 300 )

-- Set the fill (paint) to use the bitmap image
local paint = {
    type = "image",
    filename = "texture1.png"
}

-- Fill the rectangle
rect.fill = paint

-- Offset the fill on the Y axis
rect.fill.y = 1