Fill image offset

Is it possible to adjust the position of the fill image within a shape?

Yes, there are transform properties you can set on the fill.

In the Shape example, you can see these lines:

[lua]

– RoundedRect + Image


local bkgd = display.newRoundedRect( 100, 150, halfW, halfW, 20 )

bkgd.fill = { type=“image”, filename=“aquariumbackgroundIPhone.jpg” }

bkgd.fill.scaleX = 2

bkgd.fill.scaleY = 2

[/lua]

You can also set ‘x’, ‘y’, and ‘rotation’ properties. 

Also, *before* you load the texture for the first time, you can set the wrap modes:

[lua]

– value can be: “clampToEdge” “repeat” “mirroredRepeat”

display.setDefault( “textureWrapX”, value )

display.setDefault( “textureWrapY”, value )

[/lua]

Just be sure to reset them once you’ve loaded the texture.

I was thinking more of

bkgd.fill.x = 100 bkgd.fill.y = 50

to move the fill image within the shape.

Yup, those were the properties I was talking about:

[lua]

– RoundedRect + Image


local bkgd = display.newRoundedRect( 100, 150, halfW, halfW, 20 )

bkgd.fill = { type=“image”, filename=“aquariumbackgroundIPhone.jpg” }

bkgd.fill.scaleX = 2

bkgd.fill.scaleY = 2

bkgd.fill.x = 10

bkgd.fill.y = 20

bkgd.fill.rotation = 20

[/lua]

Yes, there are transform properties you can set on the fill.

In the Shape example, you can see these lines:

[lua]

– RoundedRect + Image


local bkgd = display.newRoundedRect( 100, 150, halfW, halfW, 20 )

bkgd.fill = { type=“image”, filename=“aquariumbackgroundIPhone.jpg” }

bkgd.fill.scaleX = 2

bkgd.fill.scaleY = 2

[/lua]

You can also set ‘x’, ‘y’, and ‘rotation’ properties. 

Also, *before* you load the texture for the first time, you can set the wrap modes:

[lua]

– value can be: “clampToEdge” “repeat” “mirroredRepeat”

display.setDefault( “textureWrapX”, value )

display.setDefault( “textureWrapY”, value )

[/lua]

Just be sure to reset them once you’ve loaded the texture.

I was thinking more of

bkgd.fill.x = 100 bkgd.fill.y = 50

to move the fill image within the shape.

Yup, those were the properties I was talking about:

[lua]

– RoundedRect + Image


local bkgd = display.newRoundedRect( 100, 150, halfW, halfW, 20 )

bkgd.fill = { type=“image”, filename=“aquariumbackgroundIPhone.jpg” }

bkgd.fill.scaleX = 2

bkgd.fill.scaleY = 2

bkgd.fill.x = 10

bkgd.fill.y = 20

bkgd.fill.rotation = 20

[/lua]