Tween a groups X / Y position

Hi Guys

So, I have a good understanding of how groups etc. work, but I have a strange problem.

Basically, I have setup a group (character with body parts) and I’m trying to tween its Y position.

My screen is 480x320 and my group is sitting at y 240.

I’m trying to tween the group to y  260 and use -> easing.continuousLoop to move it back and forth.

Now the only way this will work is, if I double the final value!

If I want to tween the group to y 260, I have to put in y=520

I have no idea why this is happening :frowning:

Thank you in advance for any help!

Hi @Ninjadoodle,

Are you using .anchorChildren on the group? Are you doing anything else unconventional with anchor points? We may need to see your basic setup and transition of the group to determine what’s happening.

Take care,

Brent

Hi @Brent Sorrentino

Thank you for your help :slight_smile: I’m posting my basic setup (it’s just a cow group with body parts).

One thing I do know is that the reason I have to put in a double value is because I’m using a continuous loop. If I just tween a to b, then the normal coordinates work fine.

Also rotations work fine without double values, it seems to be the x and y values.

The issue is at the bottom where I tween the cow group (y value).

– SETUP COW

  local rockyLandingActorCow = display.newGroup()

  rockyLandingActorCow.x = 588

  rockyLandingActorCow.y = 232

  local rockyLandingActorCowLeg0 = display.newImage( “images/rockyLanding/rockyLandingActorCowLeg.png”, true )

  rockyLandingActorCowLeg0.x = -6

  rockyLandingActorCowLeg0.y = -6

  rockyLandingActorCowLeg0.anchorX = .5

  rockyLandingActorCowLeg0.anchorY = 0

  local rockyLandingActorCowLeg1 = display.newImage( “images/rockyLanding/rockyLandingActorCowLeg.png”, true )

  rockyLandingActorCowLeg1.x = 6

  rockyLandingActorCowLeg1.y = -6

  rockyLandingActorCowLeg1.anchorX = .5

  rockyLandingActorCowLeg1.anchorY = 0

  local rockyLandingActorCowTail = display.newImage( “images/rockyLanding/rockyLandingActorCowTail.png”, true )

  rockyLandingActorCowTail.x = 10

  rockyLandingActorCowTail.y = -26

  rockyLandingActorCowTail.anchorX = .5

  rockyLandingActorCowTail.anchorY = 1

  local rockyLandingActorCowBody = display.newImage( “images/rockyLanding/rockyLandingActorCowBody.png”, true )

  rockyLandingActorCowBody.x = 0

  rockyLandingActorCowBody.y = -16

  local rockyLandingActorCowHead = display.newImage( “images/rockyLanding/rockyLandingActorCowHead.png”, true )

  rockyLandingActorCowHead.x = -12

  rockyLandingActorCowHead.y = -24

  rockyLandingActorCow:insert( rockyLandingActorCowLeg0 )

  rockyLandingActorCow:insert( rockyLandingActorCowLeg1 )

  rockyLandingActorCow:insert( rockyLandingActorCowTail )

  rockyLandingActorCow:insert( rockyLandingActorCowBody )

  rockyLandingActorCow:insert( rockyLandingActorCowHead )

  transition.to( rockyLandingActorCowLeg0, { time=300, rotation=45, iterations=0, transition=easing.continuousLoop } )

  transition.to( rockyLandingActorCowLeg1, { time=300, rotation=-45, iterations=0, transition=easing.continuousLoop } )

  transition.to( rockyLandingActorCowTail, { time=300, rotation=90, iterations=0, transition=easing.continuousLoop } )

  transition.to( rockyLandingActorCowHead, { time=300, rotation=16, iterations=0, transition=easing.continuousLoop } )

  transition.to( rockyLandingActorCow, { time=300, y=456, iterations=0, transition=easing.continuousLoop} )

Hi @Ninjadoodle,

I did some testing, and it looks like this is a bug specific to the “continuousLoop” method. I’ve reported it to the engineers so they can investigate why this is occurring. In the meantime, perhaps you can convert your project to not use that easing method, but rather, have transition “onComplete” trigger the next transition in line, and so forth.

Best regards,

Brent

Hi @Brent Sorrentino

Thank you for looking into it :slight_smile:

Hi @Ninjadoodle,

Are you using .anchorChildren on the group? Are you doing anything else unconventional with anchor points? We may need to see your basic setup and transition of the group to determine what’s happening.

Take care,

Brent

Hi @Brent Sorrentino

Thank you for your help :slight_smile: I’m posting my basic setup (it’s just a cow group with body parts).

One thing I do know is that the reason I have to put in a double value is because I’m using a continuous loop. If I just tween a to b, then the normal coordinates work fine.

Also rotations work fine without double values, it seems to be the x and y values.

The issue is at the bottom where I tween the cow group (y value).

– SETUP COW

  local rockyLandingActorCow = display.newGroup()

  rockyLandingActorCow.x = 588

  rockyLandingActorCow.y = 232

  local rockyLandingActorCowLeg0 = display.newImage( “images/rockyLanding/rockyLandingActorCowLeg.png”, true )

  rockyLandingActorCowLeg0.x = -6

  rockyLandingActorCowLeg0.y = -6

  rockyLandingActorCowLeg0.anchorX = .5

  rockyLandingActorCowLeg0.anchorY = 0

  local rockyLandingActorCowLeg1 = display.newImage( “images/rockyLanding/rockyLandingActorCowLeg.png”, true )

  rockyLandingActorCowLeg1.x = 6

  rockyLandingActorCowLeg1.y = -6

  rockyLandingActorCowLeg1.anchorX = .5

  rockyLandingActorCowLeg1.anchorY = 0

  local rockyLandingActorCowTail = display.newImage( “images/rockyLanding/rockyLandingActorCowTail.png”, true )

  rockyLandingActorCowTail.x = 10

  rockyLandingActorCowTail.y = -26

  rockyLandingActorCowTail.anchorX = .5

  rockyLandingActorCowTail.anchorY = 1

  local rockyLandingActorCowBody = display.newImage( “images/rockyLanding/rockyLandingActorCowBody.png”, true )

  rockyLandingActorCowBody.x = 0

  rockyLandingActorCowBody.y = -16

  local rockyLandingActorCowHead = display.newImage( “images/rockyLanding/rockyLandingActorCowHead.png”, true )

  rockyLandingActorCowHead.x = -12

  rockyLandingActorCowHead.y = -24

  rockyLandingActorCow:insert( rockyLandingActorCowLeg0 )

  rockyLandingActorCow:insert( rockyLandingActorCowLeg1 )

  rockyLandingActorCow:insert( rockyLandingActorCowTail )

  rockyLandingActorCow:insert( rockyLandingActorCowBody )

  rockyLandingActorCow:insert( rockyLandingActorCowHead )

  transition.to( rockyLandingActorCowLeg0, { time=300, rotation=45, iterations=0, transition=easing.continuousLoop } )

  transition.to( rockyLandingActorCowLeg1, { time=300, rotation=-45, iterations=0, transition=easing.continuousLoop } )

  transition.to( rockyLandingActorCowTail, { time=300, rotation=90, iterations=0, transition=easing.continuousLoop } )

  transition.to( rockyLandingActorCowHead, { time=300, rotation=16, iterations=0, transition=easing.continuousLoop } )

  transition.to( rockyLandingActorCow, { time=300, y=456, iterations=0, transition=easing.continuousLoop} )

Hi @Ninjadoodle,

I did some testing, and it looks like this is a bug specific to the “continuousLoop” method. I’ve reported it to the engineers so they can investigate why this is occurring. In the meantime, perhaps you can convert your project to not use that easing method, but rather, have transition “onComplete” trigger the next transition in line, and so forth.

Best regards,

Brent

Hi @Brent Sorrentino

Thank you for looking into it :slight_smile: