FORUMS: list search recent posts

non circular spiral

FAQ   •   VIEW ALL
 non circular spiral on May 17, 2012 at 7:20:46 am

Hi CCgurus :) how to create a non-circular spiral position (constant speed) using expressions?

My current clumsy solution is:

loop the null-A around a predefined path(pasted mask on position) using loopOut. and then parent that object to another shrinking/expanding null-B.

and finally attach a writeOn/Particular fx to nullA
-----------------------
is it possible to achieve this in a more elegant way by using expression without for-loop where the shape of spiral could be defined by rotation angle?

 Re: non circular spiralon May 17, 2012 at 1:12:58 pm

I'm not sure what you mean by non-circular spiral. Does something like this work?

t = Math.max(time-inPoint,0);
r = 50*t;
f = 1;
center = [thisComp.width,thisComp.height]/2;
a = f*t*Math.PI*2;
x = Math.cos(angle);
y = Math.sin(angle);
center + [x,y]*r;

Dan

 Re: non circular spiralon May 17, 2012 at 1:48:15 pm

thanks Dan,
below is an expression of a shrinking circular spiral -

====================
what i wanted to achieve is a square (or triangle) kind of spiral movement. which looks like this :)
will best if the shape of the spiral can be controlled by an angle value Or numOfSides
===================
thank you for your time :)

```//circular spiral c=C.layer.position; //center r=linear(time,inPoint,inpoint+3,300,0); //radius x=r*Math.sin(time*20); y=r*Math.cos(time*20); c+[x,y]```

 Re: non circular spiralon May 30, 2013 at 3:00:30 am

how can i make it into triangular?

```///////////////////////////////// TWEAKS /////////////////////////////////////// function ANGLE(t){ // returns an angle in degrees... return t * 60;} function RADIUS(angle){ // angle is in radians ... return angle * 10;} center = [thisComp.width*0.5, thisComp.height*0.5]; angleList = [0,30, 120,150, 240,270] // degrees, in increasing order, from 0 (included) to 360 (excluded) ///////////////////////////////////////////////////////////////////////////////////// last = angleList.length-1; a=ANGLE(time); // use a function as above, or a slider to animate the angle (same for the radius) n=Math.floor(a/360); b=a-n*360; if (b&lt;=angleList[0]){ // &lt; === "less or equal" a1 = (n-1) * 360 +angleList[last]; a2 = n*360+angleList[0]; } else if (angleList[last]&lt;=b){ a1 = n * 360 + angleList[last]; a2 = (n+1)*360+angleList[0]; } else{ idx=0; while (b>angleList[idx+1]){idx++;}; a1 = n * 360 + angleList[idx++]; a2 = n*360+angleList[idx]; } a = degreesToRadians(a); a1 = degreesToRadians(a1); a2 = degreesToRadians(a2); P = RADIUS(a1) * [Math.cos(a1), Math.sin(a1)]; Q = RADIUS(a2) * [Math.cos(a2), Math.sin(a2)]; center + linear(a, a1, a2, P,Q) ;```