fill.x

类型 数值
对象 位图画笔
display.*
修订版 2024.3703 版
另请参阅 位图画笔
fill.y

概述

此值用于根据位图填充的宽度比例偏移重复的位图填充。

此属性不用特定像素值,而需要介于 -11 之间的值。它告知 GPU 按照水平方向重复偏移该图案。因而如果使用 0.5,则会沿 x 轴将图案偏移半个重复距离。

一个重要区别是,设置正值会将图案向左偏移,而设置负值会将对象向右偏移。

示例

-- 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 X axis
rect.fill.x = 1