Scale object from center not from right

Hi, I have a group of image objects and i want to scale this group from center (this means that the group grow from all directions, not just right side). But its grows just from right side. Here is my code :

function up() transition.to(group, {time=2000,xScale=1.4,yScale=1.4,onComplete=down}) end function down() transition.to(group, {time=2000,xScale=1,yScale=1,onComplete=up}) end

Thanks.

Can you post your object creation code?

Rob

base\_body = display.newImage( "body.png" ) base\_body.x = centerX base\_body.y = centerY base\_body:setFillColor( 1, 0.6, 0, 1 ) foot\_left = display.newImage( "foot.png") foot\_left.x = centerX -22 foot\_left.y = centerY +70 foot\_left.xScale = 0.85 foot\_left.yScale = 0.85 foot\_right = display.newImage( "foot.png") foot\_right.x = centerX +80 foot\_right.y = centerY +70 foot\_right:scale( 0.85, 0.85 ) local group = display.newGroup() group:insert(base\_body) group:insert(foot\_left) group:insert(foot\_right)

Hi @emaadghorbani,

By default, display groups don’t obey the concept of anchor points. However, you may be able to achieve exactly what you want by using the “.anchorChildren” property. Please read through the following guide for a better understanding of this concept:

https://docs.coronalabs.com/guide/graphics/group.html

Best regards,

Brent

Can you post your object creation code?

Rob

base\_body = display.newImage( "body.png" ) base\_body.x = centerX base\_body.y = centerY base\_body:setFillColor( 1, 0.6, 0, 1 ) foot\_left = display.newImage( "foot.png") foot\_left.x = centerX -22 foot\_left.y = centerY +70 foot\_left.xScale = 0.85 foot\_left.yScale = 0.85 foot\_right = display.newImage( "foot.png") foot\_right.x = centerX +80 foot\_right.y = centerY +70 foot\_right:scale( 0.85, 0.85 ) local group = display.newGroup() group:insert(base\_body) group:insert(foot\_left) group:insert(foot\_right)

Hi @emaadghorbani,

By default, display groups don’t obey the concept of anchor points. However, you may be able to achieve exactly what you want by using the “.anchorChildren” property. Please read through the following guide for a better understanding of this concept:

https://docs.coronalabs.com/guide/graphics/group.html

Best regards,

Brent