One-liner challenge

And here is the Sierpinski triangle as well:

$ gmic 1024,1024,1,1,">x>y?0:y<2?1:xor(j(0,-1),j(-1,-1))" f. "255*j(-w/2+y/2,0)"

triangle

4 Likes

liking recursive macro expansion

- thanks @myselfhimself for pythonising it!

2 Likes

@jayprich I like that one liner. Reminds me of my own code called Perspective Streak, and that has it own way of doing that.

2 Likes

Reviving this for the end of the year:

gmic sp car +b 0.5% l. g. xy sign g.. x,-1 g. y,-1 abs compose_channels add add boxfilter 3 endl mul

2 Likes

Elephant textures!

Spring is upon us. Green blossoms forth.

gmic repeat 90 256,256,1,2 f. 'ak=$<*0.008726646;if(c==0,cos(ak)*x+sin(ak)*y,cos(ak)*y+sin(ak)*x)' +compose_channels. and +compose_channels.. xor -compose_channels... or a[-3--1] c to_rgb. f. 'rot(vector3(0,1,1),2*$>+1)*I' n 0,255 done rm. animate 60

spring.mkv (135.1 KB)

1 Like

Disappointed that the animation stopped rather abruptly, only to repeat itself. The outside is both cold and warm. Hope the transition doesn’t take too long.

Useful observation. It is abrupt. A bit like a long-drop hanging. Plan to take another whack at this next time I visit the related tutorial. Cheers, thank you for the remarks!

Nice colours - like the sense of budding & expansion.

Here is my go at a hot summer vibe with wet grass. No daisys.

gmic v - "600,400,1,3,[1.001*x-.5,y+sin(x+.4*y),(300-y)*sin(.2*y)]" circle 20,70,110,1,501,130 w do wait 100 +b 1 warp. .. rm.. w. while "{*}&&!{*,ESC}"
1 Like

@afre is right on my effort: the cutoff is brutal. The heart, soul and humor of animation - everything - comes down to timing. I need to visit this, one fine day, when there is nothing to do - sometime mid-century, perhaps.

Got a bit of free time this afternoon, the occasion to revive this thread :slight_smile:
Here is a new one-liner proposal, written here for bash:

$ gmic v - do 300,300,1,3,"begin(R=rot(10*sin((t=$|)%)));Z=80+40*cos(x/230+2*t)*sin(y/50+4*t);P=R*(Z+100)*([x,y]-[w,h]/2)%;(0.4+exp(-Z/60))*(P[0]<-100?[0,0,255]:P[0]<100?[255,255,255]:[255,0,0])*lerp(0.5,1,xor(P[0]%64,P[1]%64)/64)" w. 200%,200%,0 rm. wait 20 while "{*}"

which displays this little animation:

Here is the “unrolled” version to be put in a .gmic file:

french_flag :
  do
  300,300,1,3,"
    const t = "$|";
    begin(R = rot(10*sin(t°)));
    Z = 80 + 40*cos(x/230 + 2*t)*sin(y/50 + 4*t);
    P = R*(Z + 100)*([x,y] - [w,h]/2)%;
    (0.4+exp(-Z/60))*(P[0]<-100?[0,0,255]:P[0]<100?[255,255,255]:[255,0,0])*
    lerp(0.5,1,xor(P[0]%64,P[1]%64)/64)"
  w. 200%,200%,0 rm. wait 20
  while {*}
2 Likes

Liberté, égalité et fraternité ! :fr:

Liberty and equality at France?

Liberty, equality and brotherhood.

Roses.

gmic 512,1,1,1 '(37,17)' eval. 'i(#0,i(x))=1' k.. ifft. a[-2,-1] c n. 0,{2*w#0-16} +. 8 {2*w#0},{2*w#0},1,1 permute.. cyzx  eval. ">begin(PV=crop(#0);polygon(#-1,-s#0,PV,1,0xffffffff,255))" k. expand_xy. 4 dilate_circ 4 r2dx 50%,5 

rose_37-17
rose_37-17.png

rose_19-13-5
rose_19-13-7.png

rose_11-7-3
rose_11-7-3.png

rose_11-7-5
rose_11-7-5.png

  1. The width of the first image sets the sides of the painting canvas. Leave remaining image dimensions at one.
  2. The 2, 3, 4
 numbers comprising the second image shape the rose. The first pattern arises from (37,3). Suggest that these numbers should be no larger than 10% of the width and should not have common factors. (16,8,4) is (4,2,1) in disguise. Order does not matter: (7,5,3) paints the same rose as (5,3,7)
  3. The example images embed their shaping numbers.

Here’s a command file version:

roses.gmic
roses :
   $=a
   {$a1/2},1,1,1
   repeat $#-1,j
      =. 1,${a{$j+2}},0,0,0
   done
   s. c
   -ifft.
   a[-2,-1] c
   n. 0,{2*w#0-16}
   +. 8
   {2*w#0},{2*w#0},1,1
   permute.. cyzx
   eval. ">begin(PV=crop(#0);polygon(#-1,-s#0,PV,1,0xffffffff,255))"
   k.

Try:

gmic roses.gmic roses 4096,37,3 expand_xy. 4 dilate_circ 4 r2dx 50%,5 o. rose_37-7.png

For the first example drawn large. With the command version, the first argument sets the image size, an arbitrary number of shaping numbers follow. Same guidelines apply.

I have a vague notion that something like this was written a long time ago. I can’t find it. @David_Tschumperle’s Hypotrochoid has some resemblance of what is going on here, but what’s going on here is not circles rolling within/without circles. The shaping numbers are spectral coefficients. Temporally Fourier transformed and circular plotted: real provide the x coordinate and imaginary provides the y. Might trace one by happenstance.

2 Likes

What does the $#_-1,j mean?

Note to self: Look at my gmic file for similar confusing syntax.

Adding Custom Commands is your friend.

"$# is substituted by the maximum index of known arguments (either specified by the user or set to a default value in the custom command)."

$# includes the command name in its count, so less one to shorten the iteration to just the arguments following the command line. j is a local variable that aliases $>. See repeat 
 done.

1 Like

Ah, that makes sense now. I use narg($*) instead since it’s a bit more obvious of what it says (n = number, and arg means argument), and there’s a syntax difference involved being outside math parser and inside it. I will explore $# then.

There are so many of those that I forget to use them


@grosgood

Bonjour,

I really like the rendering of your command line from your message One-liner challenge - #54 by afre

It is necessary to replace the character ’ by " so that this line of commands also works under GMIC CLI, GMIC-QT, GMIC-GIMP Windows

It will also work on Linux.

Thank you :o)

gmic 512,1,1,1 "(37,17)" eval. "i(#0,i(x))=1" k.. ifft. a[-2,-1] c n. 0,{2*w#0-16} +. 8 {2*w#0},{2*w#0},1,1 permute.. cyzx eval. ">begin(PV=crop(#0);polygon(#-1,-s#0,PV,1,0xffffffff,255))" k. expand_xy. 4 dilate_circ 4 r2dx 50%,5

1 Like