I have eight elements distributed in a circle, with a common center.
All of them move along a circular path, just like the poster in this question asked:
Moving an object in a circular path
This solves half of my question, however I also need to oscillate the whole group of units from side to side, with an easing, or linearly, depending on the design.
I've been playing around with it, but I can't figure how to add or modify what I assign to the X and Y value so the objects move like if they were contained inside a Sprite, and I would be moving that Sprite.
Edit.:
I found that this:
var newX:Number = Math.cos(_angle) * 100;
var newY:Number = Math.sin(_angle) * 100;
y = _startingY + newY;
x = _startingX + newX + _incrementX;
_angle += 2 * Math.PI / 180;
_incrementX += 1 + Math.sin(_angle);
Gets close enough to what I need, however it still doesn't work. In theory, if I subtract the sin f the angle it should fix the rotation compensation.
Edit2: The stars moving in circle:
What happens when I just add a linear increment to each element: (it would represent in the code above doing _incrementX++
)