How can I create objects that are placed along the circumference of a circle,and then expand and contract the circle

I’m just starting to learn unity2d and I’m trying to create rotating obstacles that expand and contract.The obstacles are supposed to be in the pattern of a circle,which needs to keep rotating.
I first created multiple objects and then added the following code to each,with each object having a different angle.
Here is the code I’ve got for rotation and the expansion.But there is something wrong with it that makes the looping go wrong.

	void Update()
	{
		if (radius < 1) {
			angle += speed * Time.deltaTime;     
			radius += speed * Time.deltaTime; 
		} 
		if (radius > 5) {
			angle -= speed * Time.deltaTime;     
			radius -= speed * Time.deltaTime; 
		} 


		x = Mathf.Cos (angle) * radius;
		y = Mathf.Sin (angle) * radius;
		transform.position = new Vector3 (x,y, -5);
		
			

	}

You probably want to use different speed values when computing your angle, and radius changes.

I’m not sure what the if(radius<0) is supposed to detect- don’t you always want to have a (radius >0)? If this is to check the minimal size of the circle, I don’t see where you check for the maximum size of the circle radius?

May I suggest, that instead of if-statements, you use another SIN function to add/subtract a cycling amount from your radius.

e.g.

 angle += speed * Time.deltaTime;
 float sin_value = Mantf.Sin(radius_speed * Time.time);
 float current_radius = base_radius + (radius_flux_size * sin_value);
 float x = Mathf.Cos (angle) * current_radius ;
 float y = Mantf.Sin(angle);  * current_radius ;
 transform.position = new Vector3 (x,y, -5);

public float angleOffset = 0;

float rotateSpeed = 5f;
float maxRadius = 0.5f;
float minRadius = 0.25f;
float oscillateSpeed = 0.1f;

float radius = 0.5f;
float angle;
float t = 0;

void FixedUpdate () 
{
    t += oscillateSpeed;
    var v = Mathf.Sin(t); //gives you a value between -1 and 1
    v = (v + 1) / 2; //v is now between 0 and 1
    v = minRadius + v * (maxRadius - minRadius); //
    radius = v;
    print(v);
    

    angle += rotateSpeed;
    var rotation = Quaternion.AngleAxis(angle + angleOffset, Vector3.forward);
    transform.position = rotation * (Vector3.right * radius);
}