## Circle winding animation

If you have a design you're proud of, share the cfdg file here. It's also a good place to ask for feedback and collaborate.

Moderators: MtnViewJohn, chris, mtnviewmark

flembobs
Posts: 47
Joined: Tue Oct 09, 2012 3:00 pm

### Circle winding animation

I made a little animation with context free:

Here is the code:

Code: Select all

``````CF::MaxNatural = 10000000
CF::Time = [time 0 1]

startshape FRAME []

shape FRAME
{
SQUARE [s 22]
POLYGON ( 1000, 10, 30 ) [b 1]
}

sine(t,amp,freq,phase) = amp*sin( (freq*360*t) + phase )

path POLYGON ( natural n, number o, number speed )
{
MOVETO ( o/2, 0 )

loop i=n []
{
t = 1/n*(i+1)
d = o/2+o*sine ( t, 0.5, ftime()*speed, 0 )
LINETO ( d*cos (360*t), d*sin (360*t) )
}

CLOSEPOLY(CF::Align)

STROKE () []
}
``````
It would be neat if we could upload videos directly to the gallery. Something like the .webm format would work well.

flembobs
Posts: 47
Joined: Tue Oct 09, 2012 3:00 pm

### Re: Circle winding animation

Here's another using a similar technique with more variables:

Code: Select all

``````startshape RINGS []

CF::Size = [ s 20 ] //Note:  important to set size for looping
CF::Time = [time 0 1]
CF::Background = [ b -1 ]

sine(t,amp,freq,phase) = amp*sin( (freq*360*t) + (360*phase) )

shape RINGS
{
rings = 8
n = 1+rings+sine ( ftime(), rings, 6, 0 )

loop i=n [ r (360/n) ]
{
paths = sine ( ftime ()*i, 1, 2, 0 )
t1 = sine ( ftime(), 8, 1, paths )

t2 = 0.5+sine ( ftime (), 0.45, 2, (12/n)*i )

col1 = 0.85+sine ( (1/n)*1, 0.25, 2, 0 )
col2 = 320+sine ( (1/n)*i , 30, 2, 0)

CIRCLE [ x t1 s t2 b 1 sat col1 h col2]

}

}``````

flembobs
Posts: 47
Joined: Tue Oct 09, 2012 3:00 pm

### Re: Circle winding animation

Here's another animation made with sine waves:

Sine waves are great for making looping animations.

Code: Select all

``````startshape GRID (1000,1000)[] //( 640, 640 ) []

CF::Time = [time 0 1]
CF::Background = [ b -1 ]
CF::MinimumSize = 0.0001

sine(t,amp,freq,phase) = amp*sin( 360 * (freq*t + phase) )

dist ( n, o ) =  abs ( n - o )
inv2 ( n ) = 1/n^2

para ( n, o, p ) = n^2*o+p

st0 = sine ( ftime(), 1, 3, 0.2 )
st1 = sine ( ftime(), 1, 3, 0.5 )
st2 = sine ( ftime(), 1, 2, 0.9 )

shape GRID ( natural n, natural o )
{
loop i=n []
{
si0 = sine ( i/n, 1, 1, 0 )
si1 = sine ( i/n, 1, 2, 0.2 )
si2 = sine ( i/n, 1, 3, 0.7 )

s0 = sine ( (1/n)*i, o/3*si0, 3, ftime() )+st0
s1 = sine ( (1/n)*i, o/3*si1, 2, ftime() )+st1
s2 = sine ( (1/n)*i, o/3*si2, 1, ftime() )+st2

X = i-(n/2)

loop j=o []
{

Y = j-(o/2)

BC = 0.02
BN = 2/3
BM = 1.4
B0 = BN/para ( BC, dist ( Y, s0 )^2, BM )
B1 = BN/para ( BC, dist ( Y, s1 )^2, BM )
B2 = BN/para ( BC, dist ( Y, s2 )^2, BM )

B =  B0+B1+B2
S =  1.2-(B0+B1+B2)
H =  st0*st1*st2*si0+190

SQUARE  [ x X y Y b B sat S hue H]
}
}

}
``````

Delorenzo
Posts: 1
Joined: Tue Apr 02, 2019 1:59 am

### Re: Circle winding animation

Digging your animations a lot, Flembobs. Are you using them for some project of yours?

flembobs
Posts: 47
Joined: Tue Oct 09, 2012 3:00 pm

### Re: Circle winding animation

Thanks a lot, Delorenzo.

I do sometimes use Context Free Art to make textures for video games.

Mostly though I use it as a way to improve my maths. I have a Computer Science background without much maths. I have been self-studying maths and I find CFA to be a great way to put the theory into practice!