Advertisement
Guest User

Source code of the BBQ Intro-2016 by Arkham (G'MIC script).

a guest
Aug 26th, 2015
656
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 24.17 KB | None | 0 0
  1. #
  2. #  File        : bbq_intro.gmic
  3. #                ( G'MIC commands file )
  4. #
  5. #  Description : Source code of the Arkham BBQ Party 2016 - Invitation intro.
  6. #                This source file has been written in less than 3 days, and
  7. #                is not intended to use optimized tricks of course :)
  8. #
  9. #  Copyright   : David Tschumperle
  10. #                ( http://tschumperle.users.greyc.fr/ )
  11. #
  12. #  License     : CeCILL v2.0
  13. #                ( http://www.cecill.info/licences/Licence_CeCILL_V2-en.html )
  14. #
  15. #  This software is governed by the CeCILL  license under French law and
  16. #  abiding by the rules of distribution of free software.  You can  use,
  17. #  modify and/ or redistribute the software under the terms of the CeCILL
  18. #  license as circulated by CEA, CNRS and INRIA at the following URL
  19. #  "http://www.cecill.info".
  20. #
  21. #  As a counterpart to the access to the source code and  rights to copy,
  22. #  modify and redistribute granted by the license, users are provided only
  23. #  with a limited warranty  and the software's author,  the holder of the
  24. #  economic rights,  and the successive licensors  have only  limited
  25. #  liability.
  26. #
  27. #  In this respect, the user's attention is drawn to the risks associated
  28. #  with loading,  using,  modifying and/or developing or reproducing the
  29. #  software by the user in light of its specific status of free software,
  30. #  that may mean  that it is complicated to manipulate,  and  that  also
  31. #  therefore means  that it is reserved for developers  and  experienced
  32. #  professionals having in-depth computer knowledge. Users are therefore
  33. #  encouraged to load and test the software's suitability as regards their
  34. #  requirements in conditions enabling the security of their systems and/or
  35. #  data to be ensured and,  more generally, to use and operate it in the
  36. #  same conditions as regards security.
  37. #
  38. #  The fact that you are presently reading this means that you have had
  39. #  knowledge of the CeCILL license and that you accept its terms.
  40. #
  41.  
  42. # The main run() function.
  43. #--------------------------
  44. run : -skip ${1=0}
  45.   -v -
  46.   _output_video=$1
  47.   -if $1
  48.     -v + -e[] "\n  > Run 'BBQ Intro 2016' demo, by ARKHAM (video output mode)." -v -
  49.     -_run
  50.   -else
  51.     -if ${-path_tmp}/bbq_intro2016.mp3 -else -l[]
  52.       -v + -e[] "\n  > Retrieve music from the G'MIC server..." -v -
  53.       -i raw:http://gmic.eu/bbq_intro2016.mp3,uchar -o raw:${-path_tmp}/bbq_intro2016.mp3,uchar
  54.       -v + -e[] "  > ... done!" -v -
  55.     -onfail
  56.       -v + -e[] "  > ... failed!" -v -
  57.     -endl -endif
  58.     -v + -e[] "\n  > Run 'BBQ Intro 2016' demo, by ARKHAM (live mode)." -v -
  59.     -rm
  60.     -parallel "-x \"cvlc "${-path_tmp}"bbq_intro2016.mp3\"","-_run"
  61.   -endif
  62.  
  63. _run :
  64.   -v -
  65.   -w 640,400,0,"BBQ Party 2016 - Intro (Arkham)"
  66.   -bbq_intro_notice
  67.   -bbq_intro_intro
  68.   -bbq_intro1
  69.   -bbq_intro2
  70.   -bbq_intro3
  71.   -bbq_intro4
  72.   -bbq_intro5
  73.   -bbq_intro6
  74.   -bbq_intro7
  75.   -bbq_intro8
  76.   -bbq_intro_final
  77.   -o[] "bbq_intro2016.avi",25,mp4v,0
  78.   -v +
  79.  
  80. outvideo :
  81.   --l
  82.     -if $_output_video
  83.       0 -t[-1] "Arkham",0,0,14,1,1 -expand_xy[-1] 1,0 -f[-1] 'if(x<0.45*w,i,1-i)' -frame[-1] 1,1,1
  84.       -*[-1] 255 -to_rgb[-1]
  85.       -j[-2] [-1],{{-2,w}-w-2},2,0,0,0.25 -rm[-1]
  86.       -r 400%,400%,1,3
  87.       -frame 2,2,128 -frame 20,20,64
  88.       -w[-1]
  89.       -o "bbq_intro2016.avi",25,mp4v,1
  90.     -else
  91.     -w[-1] -wait 40
  92.     -endif
  93.     -if {!{*}} -v + -quit -endif
  94.   -rm -endl
  95.  
  96. # Notice.
  97. #---------
  98. bbq_intro_notice :
  99.   0 -t[-1] \
  100. "The intro you are about to watch:"\n\n\
  101. "  - Fits in a 320x200 screen"\n\
  102. "    (eq. to. Atari ST lowres)."\n\
  103. "  - ...But uses more than 16 colors :)."\n\
  104. "  - Uses our own 3D routines (no OpenGL)."\n\
  105. "  - Has a source code of less than 750 loc."\n\
  106. "  - Is open-source."\n\
  107. "  - Has been written in the G'MIC"\n\
  108. "    script language."\n\n\
  109. "       [ More info at http://gmic.eu ]"\n\
  110. ,0,0,15,1,255
  111.   320,200 -j[-1] [-2],{(w-{-2,w})/2},{(h-{-2,h})/2} -rm[-2]
  112.   -to_rgb[-1]
  113.   -repeat 220
  114.     -if {$><150} --f[-1] 'y<1.8*$>' -b[-1] y,12% -*[-1] [-2]
  115.     -elif {$>>170} --*[-1] {max(0,1-($>-170)/20)}
  116.     -else [-1] -endif
  117.     -outvideo[-1] -rm[-1]
  118.   -done
  119.   -rm
  120.  
  121. # Title page.
  122. #------------
  123. bbq_intro_intro :
  124.   -l[]
  125.     ({'ARKHAM'}) -s x
  126.     x=0 N=$! -repeat $N 0 -t[-1] {$>,t},0,0,48,1,1 x$>=$x y$>=0 z$>={-3200-150*$>} x={$x+w+8} -done -k[50%--1]
  127.     -expand_xy 6,0 -dilate_circ 5 -b 0.5 -expand_z 1,0 -isosurface3d 10% -*3d 1,1,5 -rv3d
  128.     -repeat $N -col3d[$>] ${-RGB} -done
  129.   -endl
  130.   0 -t[-1] "invites you to",0,0,48,1,1 -r2dy[-1] 18 --f[-1] 255 -to_rgb[-1]
  131.   -random3d 2500 -col3d[-1] 255 -*3d[-1] 320,200,1000 --3d[-1] 160,100
  132.   -l3d 0,0,-600
  133.   t=0
  134.   -do
  135.     320,200,1,3
  136.  
  137.     # Starfield.
  138.     -l[-2] -s3d
  139.       -r[2] 3,{2,h/3},1,1,-1 -s[2] x -%[4] 1000
  140.       --/[4] 1000 -*[-1] -1 -n[-1] 0,2 -c[-1] 0,1 -sqr[-1] -j[-2] [-1] -rm[-1]
  141.       -a[2-4] x
  142.       -y -a y
  143.     -endl
  144.     -j3d[-1] [-2],50%,50%,-600,1,0,0,0,240 --3d[-2] 0,0,{min(12,$t/10-10)}
  145.  
  146.     # Torus.
  147.     -torus3d 100,30 -col3d[-1] 255,64,255
  148.     --col3d[-1] 64,64,255 -r3d[-1] 1,0,0,90 -+3d[-1] 65,0,0
  149.     -+3d[-2,-1] -c3d[-1]
  150.     -r3d[-1] 1,1,0,{6*$t} -r3d[-1] 0,0,1,{-2*$t}
  151.     -j3d[-2] [-1],{($t-200)*2}%,50%,0,0.25,3,0,0 -rm[-1]
  152.  
  153.     # Letters.
  154.     -repeat $N
  155.       --r3d[$>] 1,{$>%4},1,{${z$>}/2}
  156.       -j3d[-2] [-1],{50+${x$>}},{60+${y$>}},${z$>},1,4,0,0 -rm[-1]
  157.       z$>={tl=280+6*$<;if($t<tl,min(0,${z$>}+20),-20*($t-tl))}
  158.     -done
  159.  
  160.     # Presents.
  161.     -if {$t<280} op={max(0,min(1,($t-200)/20))}
  162.     -else op={max(0,1-($t-280)/20)}
  163.     -endif
  164.     -j[-1] [-3],{(w-{-3,w})/2},120,0,0,$op,[-4]
  165.  
  166.     -*[-1] {if($t<330,min(1,$t/30),max(0,1-($t-330)/30))} # Fade from/to black.
  167.     -outvideo[-1]
  168.     -rm[-1]
  169.     t={$t+1}
  170.   -while {$t<370}
  171.   -rm
  172.  
  173. # Fire effect
  174. #-------------
  175. bbq_intro1 :
  176.  
  177.   # Init image data.
  178.   s=" The BBQ\nParty 2016"
  179.   -i[0] 100,32
  180.   -i[1] (0,255,255,255,255^0,0,255,255,255^0,0,0,128,255) -r[1] 256,1,1,3,3
  181.   -i[2] (0,0,0;0,0,0;1,1,1;0,1,0) -*[2] 0.21
  182.   -text3d $s,33,3,1
  183.   -mv[-1] 3 -c3d[3] -n3d[3] -*3d[3] 320 -col3d[3] 255,205,130 -db3d 0 -f3d 300
  184.   100,100 -rand[-1] 0,255 -ellipse[-1] 50%,50%,5,5,0,1,300 -b[-1] 10
  185.   -sharpen[-1] 1000 -shrink_xy[-1] 1 -n[-1] 0,255 -to_rgb[-1] -light3d [-1] -rm[-1]
  186.  
  187.   # Start animation loop.
  188.   angle=0 t=0
  189.   -do
  190.     -correlate[0] [2]                                                # Apply fire effect.
  191.     {0,w},1 -rand[-1] 128,256 -j[0] [-1],0,{{0,h}-1} -rm[-1]       # Add new random values at the bottom line.
  192.     --r[0] 400,200,1,1,3 -map[-1] [1]                                # Map fire palette
  193.  
  194.     y={max(55,200-$t)}
  195.  
  196.     -e "\nY = "$y"\n"
  197.     --r3d[3] 0,1,0,$angle -j3d[-2] [-1],50%,$y%,50,0.8,5,0,0            # Draw 3d object.
  198.  
  199.     -*3d[-1] 0.25,0.16,1 -j3d[0] [-1],50%,$y%,50,0.1,3,0,0
  200.     -rm[-1]
  201.     angle={$angle+3}                                                 # Update 3d angle.
  202.  
  203.     -r[-1] 320,200,1,3,2
  204.     ratio={100-2*($t-300)}
  205.     ratio={max(2/w,min($ratio,100))}
  206.     -r[-1] $ratio%,$ratio%,1,3,1
  207.  
  208.     -*[-1] {if($t<330,min(1,$t/30),max(0,1-($t-330)/30))} # Fade from/to black.
  209.  
  210.     -r[-1] 320,200,1,3
  211.  
  212.     -outvideo[-1]
  213.     -rm[-1]
  214.     t={$t+1}
  215.   -while {$t<370}
  216.   -rm
  217.  
  218.  
  219. # Shade bobs.
  220. #-------------
  221. bbq_intro2 :
  222.   -reset -v -
  223.   t=100
  224.  
  225.   # Start animation loop.
  226.   _t=0
  227.   -do
  228.     t={$t+0.025}
  229.     -if {$t>pi} # Reset motions variables if necessary.
  230.       rx={?(-1,1)} ry={?(-1,1)} rz={?(-1,1)} rt={?(-1,1)} rcx={?(-0.6*0.6)} t=0
  231.       N={120+round(?(80))} R={(2+round(?(10)))*min({*,w},{*,h})/300}
  232.       -if $obj3d -rm[colormap,img,obj3d] -endif
  233.       {10+round(?(12))},1,1,3 -noise[0] 255,2 -r[0] 256,1,1,3,3 -*[0] 255 -shift[0] 1 -nm[-1] colormap
  234.       (67.5;73.5;109.5;103.5;51.5;100.5;{2*$N};$N) 3,{2*$N},1,1,0
  235.       1,$N,1,1,5 2,$N,1,1,'y+x*$N' -a[-2--1] x -z[-1] 0,5
  236.       4,$N,1,1,1 -y[-3--1] -a[-4--1] y -nm[-1] obj3d
  237.       {{*,w}/2},{{*,h}/2} -nm[-1] img
  238.     -endif
  239.  
  240.     # Compute bobs coordinates.
  241.     r={$ry+$rx*cos(6*$rz*$t)+(1-$rx)*sin(6*$rt*$t)}
  242.     (0;{30*$ry*($N-1)}) ($t;{2*pi*($N-1)/$N+$t}) -r[-2,-1] 1,$N,1,1,3
  243.     -+[-2] {360*sin($rz*$t)} -*[-2] {pi/180}
  244.     --sin[-2,-1] -cos[-4,-3] -*[-4,-2] $r -*[-3,-1] $rcx -+[-4,-3] -+[-2,-1]
  245.     -*[-2] {{*,w}/4} -*[-1] {{*,h}/4} -a[-2,-1] x
  246.     --+[-1] $R --[-2] $R -a[-2,-1] y -z[-1] 0,2 -y[-1] -j[obj3d] [-1],0,8 -rm[-1]
  247.  
  248.     # Draw bobs, map colors and display.
  249.     -j3d[img] [obj3d],50%,50%,0,-1,2,0,0
  250.     -&[img] 255 --map[img] [colormap]
  251.     -if {$_t<100} -*[-1] {min(1,$_t/30)} -endif
  252.  
  253.     -plane3d 320,26,1,1 --+3d[-1] 0,25,0
  254.     d={max(0,1.6*(545-$_t))}
  255.     --3d[-2] $d,0,0 -+3d[-1] $d,0,0
  256.     -+3d[-2,-1]
  257.     --+3d[-1] 0,50,0 --+3d[-2,-1] 0,100,0
  258.     -+3d[-4--1] -col3d[-1] 0 --3d[-1] 160,100,0
  259.     -r3d[-1] 0,0,1,$_t
  260.     -j3d[-2] [-1],50%,50%,-320,1,2,0,0 -rm[-1]
  261.  
  262.     -if {!($_t%2)} -outvideo[-1] -endif
  263.     -rm[-1]
  264.     _t={$_t+1}
  265.   -while {$_t<550}
  266.   -rm
  267.  
  268. # Landscape.
  269. #-----------
  270. bbq_intro3 :
  271.   W=150 H=350
  272.  
  273.   # Generate global map + colors.
  274.   900,900 -plasma[-1] 1,1,6 -b[-1] 0.07% -n[-1] 0,255 -nm[-1] map
  275.   --g[-1] -*[-1] 0.5 -+[-2,-1] -n[-1] 0,1 -^[-1] 2 -n[-1] -150,330
  276.   -equalize[map] 256 -n[map] -400,160 -c[map] 0,100% # Add water.
  277.   (0,102,51;149,175,124;102,42,0;255,255,255) -permute[-1] yzcx -srgb2rgb[-1] -r[-1] 256,1,1,3,3 -rgb2srgb[-1] --n[map] 0,255 -map[-1] [-2] -rm[-2]
  278.   -+[-1] [-2] -rm[-2] -c[-1] 0,255 -nm[-1] colors # Colors.
  279.  
  280.   # Pre-compute some images used on each frame.
  281.   $W,$H,1,1,'x' -y[-1] x -nm[-1] x # Increasing x.
  282.   $W,$H,1,1,'1+x+y*w' -y[-1] x -nm[-1] offsets # Offsets (+1).
  283.   $W,$H,1,1,'0.5*y' -nm[-1] gmap Mgmap={iM} # Z-increment for altitude map.
  284.   $W,$H,1,3 -fc[-1] 60,80,135 -nm[-1] ccolors # Color for the horizon.
  285.   $W,$H,1,1,'(y/$H)^2' -nm[-1] mcolors # Mask for the horizon.
  286.   $W,400,1,1,'b=h-1-$Mgmap;if(y>=b,256+(y-b)*255/(h-1-b),y*255/b)' -round[-1] # Background.
  287.   (96^16^128) (0^200^255) -a[-2,-1] x -r[-1] 256,1,1,3,3
  288.   (0^32^0) (0^64^128) -a[-2,-1] x -r[-1] 256,1,1,3,3
  289.   -a[-2,-1] x -map[-2] [-1] -rm[-1]
  290.   -nm[-1] background
  291.   -quadrangle3d[] -0.45,0,0,0.45,0,0,0.55,1,0,-0.55,1,0 -*3d[-1] {$W/2},{$H/2} -nm[-1] viewrange3d # View range.
  292.   (64^16^0) -r[-1] $W -nm[-1] groundcolor # Ground color.
  293.  
  294.   _t=0
  295.   -do
  296.     dt={$_t/20}
  297.  
  298.     # Get part of the map to display.
  299.     t={$dt*0.03}
  300.     xm={map,w/2+(w-$H/2)/2*cos(3.1*$t)}
  301.     ym={map,h/2+(h-$H/2)/2*sin(2.8*$t)}
  302.     u={map,(w-$H/2)*cos(2.5*$t)}
  303.     v={map,(h-$H/2)*sin(9.7*$t)}
  304.     a={atan2($v,$u)*180/pi}
  305.     --r3d[viewrange3d] 0,0,1,$a -y[-1] x
  306.     ({$xm+i[8]},{$xm+i[11]};{$xm+i[17]},{$xm+i[14]}^{$ym+i[9]},{$ym+i[12]};{$ym+i[18]},{$ym+i[15]}) -rm[-2]
  307.     -r[-1] $W,$H,1,2,3 --warp[map,colors] [-1],0,1,0 -rm[-3]
  308.     -nm[-2] lmap -nm[-1] lcolors
  309.  
  310.     # Add color shading and altitude to local maps.
  311.     --!=[lmap] 0 -nm[-1] ground
  312.     -+[lmap] [gmap]
  313.     -j[lcolors] [ccolors],0,0,0,0,1,[mcolors]
  314.     -j[lcolors] [groundcolor]
  315.     --round[lmap] -f[-1] '>m=abs(j(0,-1));if(i>m,i,-m)' -nm[-1] y0  # Compute visible top points.
  316.     --shift[-1] 0,1 -abs[-1] -+[-1] 1 -nm[-1] y1 # Compute visible bottom points.
  317.     -*[y0,y1] [ground] -rm[ground]
  318.     -r[lcolors,y0,y1] {$W*$H},1,1,100%,-1
  319.  
  320.     # Keep only visible primitives.
  321.     -->[y0] 0 -*[-1] [offsets] -discard[-1] 0
  322.     -if {h} # There is something to display (ground).
  323.       --[-1] 1 --warp[x] [-1],0,0,0 -nm[-1] lx
  324.       -warp[lcolors,y0,y1] [-2],0,0,0 -rm[-2]
  325.  
  326.       # Generate 3d object.
  327.       N={h} ({'CImg3d'},{2*$N},$N)
  328.       --a[lx] [y0],x -rm[y0] --a[lx] [y1],x -rm[lx,y1] -a[-2,-1] y -z[-1] 0,2
  329.       1,$N,1,1,2 --f[-1] y --+[-1] $N -a[-3--1] x
  330.       -mv[lcolors] $! -permute[-1] cyzx
  331.       1,$N,1,1,1
  332.       -y[-5--1] y -a[-5--1] y -*3d[-1] -1,-1
  333.       --j3d[background] [-1],{background,w-1},{background,h},0,1,1,0,0,0 -rm[-3,-2]
  334.  
  335.     -else # Case of nothing to display (only water).
  336.       -rm[-5--1] [background]
  337.     -endif
  338.  
  339.     -r[-1] {*,w},{*,h},1,3
  340.     -r[-1] 320,200,1,3,2
  341.  
  342.     op={if($_t<130,($_t-100)/20,1-($_t-130)/10)}
  343.     op={max(0,min(1,$op))}
  344.     -text_outline[-1] "Code : Tchoom",10,10,24,1,$op,255
  345.  
  346.     op={if($_t<230,($_t-200)/20,1-($_t-230)/10)}
  347.     op={max(0,min(1,$op))}
  348.     -text_outline[-1] "Music : Kane Wood",120,20,24,1,$op,255
  349.  
  350.     op={if($_t<330,($_t-300)/20,1-($_t-330)/10)}
  351.     op={max(0,min(1,$op))}
  352.     -text_outline[-1] "Moral support : Faxe",10,20,24,1,$op,255
  353.  
  354.     -b[-1] {if($_t<440,max(0,(30-$_t*0.7)),$_t-440)}
  355.  
  356.     -*[-1] {if($_t<460,min(1,$_t/40),max(0,1-($_t-460)/30))} # Fade from/to black.
  357.     -outvideo[-1]
  358.     -rm[-1]
  359.     _t={$_t+1}
  360.   -while {$_t<500}
  361.   -rm
  362.  
  363.  
  364. # Bouncing balls.
  365. #-----------------
  366. bbq_intro4 :
  367.   -reset -v -
  368.   520,320,1,3 -plasma 1,1,9 -n 0,220
  369.   N=12
  370.   -repeat $N
  371.     -ball[] {round(?(32,80))},${-RGB}
  372.     t$>={?(200)} x$>={0,?(10,w-10)} h$>={?(150,300)} vx$>={if(?<0.5,1,-1)*?(1,8)}
  373.   -done
  374.   -mv[0] $!
  375.   (0;0.7;1) -r[-1] {-2,w},70,1,1,3
  376.  
  377.   _t=0
  378.   -do
  379.     [$N]
  380.     -repeat $N
  381.       bw={$>,w} bh={$>,h}
  382.       y={${h$>}*abs(cos(${t$>}*pi/60))-$bh/2}
  383.       dt=1
  384.       -if {$y<0} d={-$y} y=0 bh={$bh-$d} bw={$bw+$d} dt={max(0.2,1-($d/$bh)^2)} -else dt=1 -endif
  385.       -if {${x$>}+$bw/2>w}
  386.         d={${x$>}+$bw/2-w} bw={$bw-$d} bh={$bh+0.5*$d}
  387.         -if {${x$>}+$bw/4>w} vx$>={-${vx$>}} -endif
  388.       -endif
  389.       -if {${x$>}-$bw/2<0}
  390.         d={$bw/2-${x$>}} bw={$bw-$d} bh={$bh+0.5*$d}
  391.         -if {${x$>}-$bw/4<0} vx$>={-${vx$>}} -endif
  392.       -endif
  393.       --r[$>] $bw,$bh,1,4,3 -s[-1] c,-3
  394.       -j[-3] [-2],{max(0,min({$N,w-$bw},${x$>}-$bw/2))},{{$N,h}-{h}-$y-70},0,0,1,[-1],255 -rm[-2,-1]
  395.       t$>={${t$>}+$dt}
  396.       x$>={${x$>}+$dt*${vx$>}}
  397.     -done
  398.  
  399.     --rows[-1] {h-2*70},{h-1-70} -mirror[-1] y -*[-1] [{$N+1}]
  400.     -j[-2] [-1],0,{-2,h-71},0,0,0.5 -rm[-1]
  401.     -r[-1] 320,200,1,3,2
  402.  
  403.     -if {$_t<90}
  404.       -box3d[-1] 30 -c3d[-1] -col3d[-1] 255 -r3d[-1] 1,0,1,{5*$_t} -j3d[-2] [-1],{40+$_t}%,50%,{-650+4*$_t},1,3,0,0 -rm[-1]
  405.       -*[-1] {min(1,$_t/10)}
  406.     -endif
  407.     -if {$_t>430} -l[-1]
  408.       -s y,8 s={$_t-430}
  409.       -repeat $! -shift[$>] {if($>%2,1,-1)*2*$s}%,0,0,0,0 -done
  410.       -a y
  411.       -water $s
  412.     -endl -endif
  413.  
  414.     -if {!($_t%2)} -outvideo[-1] -endif
  415.     -rm[-1]
  416.     _t={$_t+1}
  417.   -while {$_t<500}
  418.   -rm
  419.  
  420. # Plasma scroll
  421. #---------------
  422. bbq_intro5 :
  423.  
  424.   # Init plasma backgrounds.
  425.   N=8
  426.   -repeat $N
  427.     320,200,1,3 -rand[-1] 0,255 -plasma[-1] 1,0,7 -n[-1] 0,255
  428.     amp={?(-40,40)} freq={round(?(2,6))} dir$>={if(?<0.5,-1,1)*round(?(1,2))}
  429.     100%,100%,1,1,'$amp*cos(y*2*pi*$freq/h)'
  430.   -done
  431.  
  432.   {w+2},100%,1,1,'x' 100%,100%,1,1,'Y=(y-80+15*cos(x/30)+10*sin(x/22));if(Y<0||Y>=50,-1,Y)' -a[-2,-1] c
  433.   0 -t[-1] "** Greetings to all Amstrad CPC / Atari ST / Amiga fans worldwide ! **",0,0,50,1,255
  434.   -b[-1] 0.5 -n[-1] 0,255
  435.   M={w}
  436.  
  437.   # Start animation loop.
  438.   t=0 tt={-1.5*{0,w}} _t=0
  439.   -do
  440.     dt={$t/20}
  441.     tic=$dt
  442.  
  443.     # Render interpolated background between two successive plasmas.
  444.     a={int($t)} a2={2*$a} a21={$a2+1}
  445.     b={($a+1)%$N} b2={2*$b} b21={$b2+1}
  446.     --warp[$a2] [$a21],1,0,2
  447.     --warp[$b2] [$b21],1,0,2
  448.     -j[-2] [-1],0,0,0,0,{$t-$a} -rm[-1]
  449.  
  450.     -shift[$a21] 0,${dir$a},0,0,2  # Animate plasma background.
  451.     -shift[$b21] 0,${dir$b},0,0,2
  452.     -if {int($t+0.005)>int($t)} dir$a={if(?<0.5,-1,1)*round(?(1,3))} -endif
  453.     t={($t+max(0.005,($dt-$tic))%$N)}
  454.  
  455.     # Render text scrolling.
  456.     --z[-2] $tt,{$tt+w-1+2}
  457.     -warp[-1] [-4],0,0,0
  458.     -r[-1] 100%,100%,1,3
  459.     --*[-1] -1 -+[-1] 255
  460.     -j[-3] [-1],0,0,0,0,1,[-2],255 -rm[-1]
  461.     -j[-2] [-1],-2,-2,0,0,1,[-1],255 -rm[-1]
  462.     tt={$tt+5} # Animate scrolling.
  463.  
  464.     # Display rendered frame.
  465.     -r[-1] 320,200,1,3,2
  466.     -if {$_t<100} -*[-1] {min(1,$_t/100)} -endif
  467.     -if {$_t>850} -*[-1] {max(0,1-($_t-850)/40)} -endif
  468.  
  469.     -outvideo[-1]
  470.     -rm[-1]
  471.     _t={$_t+2}
  472.   -while {$_t<900}
  473.   -rm
  474.  
  475. # 3D Metaballs
  476. #---------------
  477. bbq_intro6 :
  478.   100,100 -noise[-1] 100,1 -plasma[-1] 1,0,10 -r[-1] 512,320,1,3 -n[-1] 0,1 -b[-1] 4,0 -n[-1] 0,255
  479.   -mix_channels[-1] (0.7,0,0;0,0.9,0;0,0,1.2) -c[-1] 0,255 -l3d
  480.   0
  481.   24,24,24,1,'X=x-w/2;Y=y-h/2;Z=z-d/2;exp(-(X*X+Y*Y+Z*Z)/100)'
  482.   72,72,72 M=8 mode=3
  483.   -repeat $M fx$>={g} fy$>={g} fz$>={g} -done
  484.   t=0
  485.   -do
  486.     dt={$t/20}
  487.     -repeat $M
  488.       x$>={w/2+0.5*(w-{2,w}-4)*cos(${fx$>}*2.2*$dt)}
  489.       y$>={h/2+0.5*(h-{2,h}-4)*sin(${fy$>}*2.2*$dt)}
  490.       z$>={d/2+0.5*(d-{2,d}-4)*sin(${fz$>}*2.2*$dt)}
  491.     -done
  492.     -f[3] 0 -repeat $M -j[3] [2],{${x$>}-{2,w/2}},{${y$>}-{2,h/2}},{${z$>}-{2,d/2}},0,-1 -done
  493.     --r[3] 24,24,24,1,2 -isosurface3d[-1] 0.4 --3d[-1] 12,12,12 -*3d[-1] 13 -rv3d[-1]
  494.     -r3d[-1] 1,2,1,{50*$dt}
  495.     N={i[7]} (255,255,150;200,96,164;50,150,230) -r[-1] 3,$N,1,1,3 -y[-1] -j[-2] [-1],0,{{-2,h}-4*$N} # Do some color tweaks.
  496.     -if {!$mode} -circles3d[-2] 4 -endif
  497.     -if {!{1,w}}
  498.       0 -t[-1] "Flat-Shading\nRules The\nWorld!",5,185,43,0.5,255,255,255 -b[-1] 0.7 -n[-1] 0,255
  499.       --dilate[-1] 3 --j[0] [-2],5,3,0,0,0.75,[-1],255 -mv[-1] 1 -rm[2,-2,-1]
  500.     -endif
  501.     --j3d[1] [-2],50%,50%,0,1,{if(!$mode,3,$mode)},0,0,300,0,0,-500,0.1,1.5
  502.     -r[-1] 320,200,1,3,2
  503.  
  504.     -if {$t<100} -*[-1] {min(1,$t/15)} -endif
  505.     -if {$t>400}
  506.       -rotate[-1] {(($t-400)/3)^2},0,0,{50+($t-400)}%,{50-($t-400)/3}%,{min(1,10/($t-400))}
  507.       -*[-1] {max(0,1-($t-400)/50)}
  508.     -endif
  509.  
  510.     -outvideo[-1]
  511.     -rm[-3--1]
  512.     t={$t+1}
  513.   -while {$t<470}
  514.   -rm
  515.  
  516.  
  517. # Rotozoom + Bump light.
  518. #-----------------------
  519. bbq_intro7 :
  520.  
  521.   # Create warping and color images.
  522.   0 -t[-1] "Demomakers\n  Forever !",0,0,80,1,255 -expand_xy[-1] 15,0 -b[-1] 3
  523.   [-1] -n[-2] 0,1 -r[-2] 100%,100%,1,3
  524.   -sh[-2] 0,0 -*[-1] 120 -rm[-1]
  525.   -sh[-2] 1,1 -*[-1] 70 -rm[-1]
  526.   -sh[-2] 0,50%,0,2 -*[-1] 120 -rm[-1]
  527.   25%,25%,1,1 -rand[-1] -20,20 -smooth[-1] 10,0,1,1,4 -r[-1] [-2],3 -b[-1] 3 -n[-1] -100,100
  528.   -+[-2,-1] -g[-1] xy -a[-2,-1] c -n[-1] -150,150
  529.   -cursor[0] 0
  530.  
  531.   # Create a large light image.
  532.   light=70
  533.   640,640 -gaussian[-1] $light -n[-1] 0,255
  534.   t=0
  535.  
  536.   # Start animation.
  537.   _t=0
  538.   -do
  539.  
  540.     # Manage light position and intensity.
  541.     X={round((w-{-2,w}*(1+cos(2*$t)))/2)}
  542.     Y={round((h-{-2,h}*(1+sin(2.5*$t)))/2)}
  543.     t={$t+0.02}
  544.  
  545.     # Render lightened image.
  546.     --z[-1] $X,$Y,{$X+{-2,w}-1},{$Y+{-2,h}-1}
  547.     -warp[-1] [-3],1,0,1
  548.     -r[-1] 100%,100%,1,3 -+[-1] [-4] -c[-1] 0,255
  549.     -r[-1] 320,200,1,3,2
  550.  
  551.     -if {$_t<100} -*[-1] {min(1,$_t/100)} -endif
  552.     -if {$_t>450} -*[-1] {max(0,1-($_t-450)/20)} -endif
  553.  
  554.     zoom={1.6+1.2*sin($_t/20)}
  555.     -if {$_t>450} zoom={$zoom/(1+0.3*($_t-450))} -endif
  556.     -rotate[-1] {180+1.7*$_t},0,2,{50+$_t/5}%,50%,$zoom
  557.  
  558.     -outvideo[-1]
  559.     -rm[-1]
  560.     _t={$_t+1}
  561.   -while {$_t<500}
  562.   -rm
  563.  
  564. # Image waves.
  565. #--------------
  566. bbq_intro8 :
  567.   -if {!$!} -l[] # Generate fractal image
  568.     200,200 x={-1.06-?*0.1} y={-0.26-?*0.1}
  569.     -mandelbrot $x,$y,{$x+0.1},{$y+0.1},256
  570.     16,1,1,3,? -r[-1] 256,1,1,3,3 -shift[-1] 1
  571.     -map[0] [-1] -rm[-1] -r2dx 100
  572.     --mirror y --mirror x -+ -n 0,255
  573.   -endl -else -k[0] -r[0] 100,100,1,3,2 -endif
  574.   -i[0] (20;80;0^20;80;0^20;80;0) -r[0] 400,300,1,3,3 -water[0] 100,2
  575.   w={w} -elevation3d[-1] 0 -rv3d[-1]
  576.   -sh[-1] 8,{7+3*i[6]},0,0 -r[-1] 3,{h/3},1,1,-1
  577.   (0,1,0;1,0,1;0,1,0) -/[-1] 2
  578.   -ball[] 20,200,255,128,1,0.7,3.5
  579.   0 $w,$w [-1]
  580.   -l3d {$w/2},-200,-1000 -sl3d 0.4 -ss3d 0.8 -f3d 500 time0=3
  581.   t=0
  582.   -do
  583.     dt={$t/20}
  584.     --convolve[-1] [3],1 --[-1] [-3] -rm[-3] -b[-1] 0.8 --[-1] {ia} # Update height map.
  585.     -r[-1] 1,{$w*$w},1,1,-1 -j[2] [-1],2,0 -r[-1] $w,$w,1,1,-1      # Set 3d object coordinates.
  586.     [1]
  587.     -if {5,h} --l[5] -rows 0,2
  588.       nb={w}
  589.       -i[0] ({'CImg3d'}) -i[1] ($nb,$nb) -transpose[2]
  590.       (1,0;1,{$nb-1}) -r[-1] 2,$nb,1,1,3 -round[-1]
  591.       1,{4*$nb},1,1,1 -y -a y
  592.     -endl [4] -sprites3d[-2] [-1],1 -rm[-1] -+3d[-2,-1] -endif
  593.     --3d[-1] {$w/2},{$w/2} -*3d[-1] {0,0.9*max(w,h)/$w} # Center and scale 3d object.
  594.     -r3d[-1] 0,0,1,{if({*,b}&2,-{*,x}*360/{*,w},$dt*30)} -r3d[-1] 1,0,0,-120 # Get rotated 3d object.
  595.     --j3d[0] [-1],50%,65%,30,1,3,0,0
  596.     -r2dy[-1] 190 -frame[-1] 1,1,255 -drop_shadow[-1] 3,3
  597.     -r[-1] 320,200,1,4,0,0,0.5,0.5 -i[-2] 100%,100%,1,1,200 -blend[-2,-1] alpha
  598.  
  599.     -if {$t>400}
  600.       --[-1] 200 -rotate[-1] {$t-400},1,0,{50-2*($t-400)}%,50%,{max(0.1,1-($t-400)/40)} -+[-1] 200
  601.     -endif
  602.  
  603.     0 -t[-1] "Arkham",0,0,24,1,1 -rotate[-1] -90 100%,100%,1,3,0 -j[-3] [-1],2,{-3,max(5,h-7*$t)},0,0,1,[-2] -rm[-2,-1]
  604.     0 -t[-1] "BBQ Party - 2016",0,0,24,1,1 -rotate[-1] 90 100%,100%,1,3,0 -fc[-1] 128,32,16 -j[-3] [-1],292,{-3,min(h-180,7*$t-200)},0,0,1,[-2] -rm[-2,-1]
  605.  
  606.     -if {$t>400} -*[-1] {max(0,1-($t-400)/40)} -endif
  607.     -if {$t<100} -*[-1] {min(1,$t/40)} -endif
  608.     -to_rgb[-1]
  609.  
  610.     -outvideo[-1]
  611.  
  612.     -rm[-2,-1]
  613.     -if {($dt-$time0)>0.3} ({?*$w};{?*$w};70;0) -a[5,-1] x time0={$dt-?} -endif # Insert new ball.
  614.     -if {5,h} -l[5,-1] # Manage ball motion and collision.
  615.       -sh[0] 2,2,0,0 -sh[0] 3,3,0,0 --[-2] [-1] -+[-1] 0.2 -rm[-2,-1]
  616.       -s[0] x -repeat {$!-1} coords={$<,[0-1]} -if {{$<,[2]}<i($coords)} -=[-1] {80+{i($coords)}},$coords -rm[$<] -endif -done
  617.       -if {$!==1} -i[0] 0 -else -a[0--2] x -endif
  618.       -endl
  619.     -endif
  620.     t={$t+1}
  621.   -while {$t<450}
  622.  
  623. # 3d reflection
  624. #---------------
  625. bbq_intro_final :
  626.  
  627.   # Render background.
  628.   128,256,1,3 -rand[-1] 0,255 -plasma[-1] 1,100 -blur_xy[-1] 30,2
  629.   -sh[-1] 0,0 -n[-1] 0,90 -rm[-1] -sh[-1] 1,1 -n[-1] 0,60 -rm[-1] -sh[-1] 2,2 -n[-1] 0,180 -rm[-1]
  630.   --mirror[-1] x [-2,-1] -a[-4--1] x
  631.   --luminance[-1] -mirror[-1] x -b[-1] 2 -n[-1] 0,255
  632.  
  633.   # Create 3d objects.
  634.   -torus3d 30,10 -col3d[-1] 255,200,0
  635.   -spherical3d 47,34,"80+20*abs(cos(2*theta))" -s3d[-1] -rm[-2] -i[-2] 3,{h},1,1,150,220,255,200,255,255 -y[-2] -a[-6--1] y
  636.   -spherical3d 47,34,"100*abs(1+0.6*cos(3*phi)*sin(4*theta))"
  637.   -r3d[-2,-1] 0,1,0,90 -db3d 0
  638.  
  639.   # Generate scrolling data.
  640.   0 -t[-1] "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"\
  641. "BBQ Party - 2016"\n\
  642. " Invitation intro"\n\n\
  643. "   by ARKHAM"\n\
  644. "   (ST section)"\n\n\
  645. "Code : Tchoom"\n\
  646. "Music : Kane Wood"\n\
  647. "Support : Faxe"\n\n\
  648. " This intro has"\n\
  649. " been coded to"\n\
  650. "announce the BBQ"\n\
  651. " that will take"\n\
  652. "place in Grisy"\n\
  653. "(at Kane Wood's"\n\
  654. "     house)"\n\
  655. "in summer 2016."\n\n\
  656. "Some members of"\n\
  657. "  the fantastic"\n\
  658. "   demo crew"\n\
  659. "  * ARKHAM *"\n\
  660. "  will be there!"\n\n\
  661. "We are a team of"\n\
  662. "friends who were"\n\
  663. "doing demos on"\n\n\
  664. " - Amstrad CPC"\n\
  665. " - Atari ST"\n\
  666. " - Amiga 1200"\n\n\
  667. "during our young"\n\
  668. "age (in the 90's)."\n\
  669. " We are still"\n\
  670. "loving those old"\n\
  671. "8/16-bits looking"\n\
  672. "demos. This was"\n\
  673. "the golden age"\n\
  674. "of demoscene and"\n\
  675. " we feel lucky to"\n\
  676. " have lived this"\n\
  677. "  piece of the"\n\
  678. "computer science"\n\
  679. "     history."\n\n\
  680. "This intro is a"\n\
  681. "small tribute to"\n\
  682. "this blessed era."\n\n\
  683. "Greetings to all"\n\
  684. "people who did"\n\
  685. "incredible things"\n\
  686. "  on these"\n\
  687. "  incredible"\n\
  688. "  machines!"\n\n\n\
  689. "  ----------------"\n\
  690. "  (c) Arkham"\n\
  691. "  August 2015"\n\
  692. "  ----------------"\n\
  693. ,0,0,12,1,1
  694.   100%,100%,1,3,255
  695.   -mv[-2,-1] 0
  696.  
  697.   # Start animation loop.
  698.   t=0 xb=0 xl=0 anim=0 y=0
  699.   -do
  700.  
  701.     dt={$t/20}
  702.     tic=$dt
  703.     # Recreate 3d interpolated background object.
  704.     --rows[-1] 8,{8+3*i[6]-1} --j[-3] [-1],0,8,0,0,{if($anim<250,0,0.5-0.5*cos(($anim-250)/100))} -rm[-2]
  705.  
  706.     # Render 3d background object (with flat colors).
  707.     xo={max(75,150-$t/2)}
  708.     --z[-6] $xb,0,{$xb+255},255 -j3d[-1] [-2],$xo%,50%,0,1,3,0,0
  709.  
  710.     # Render light reflection map.
  711.     --z[-6] $xl,0,{$xl+255},255
  712.     xf={min(30,$anim-370)+20*cos(0.8*$dt)}
  713.     yf={50+20*sin(1.7*$dt)}
  714.     -j3d[-1] [-6],{20+$xf}%,$yf%,0,1,4,0,0
  715.  
  716.     # Add light reflection to 3d background object.
  717.     -l3d [-1] -rm[-1] --j3d[-1] [-2],$xo%,50%,0,1,5,0,0 -j[-2] [-1],0,0,0,0,0.6 -rm[-3,-1]
  718.  
  719.     # Add 3d foreground object.
  720.     -j3d[-1] [-4],$xf%,$yf%,0,1,4,0,0
  721.  
  722.     # Display frame and update animation variables.
  723.     -r2dy[-1] 200
  724.     --f[-1] 'w-x' -c[-1] 0,50 -/[-1] 50 -*[-2,-1]
  725.  
  726.     -r[-1] 320,200,1,3,0,0
  727.  
  728.     # Add text scrolling.
  729.     -j[-1] [1],203,0,0,0,1,[0]
  730.     -if {!($t%3)} -shift[0] 0,-1,0,0,0 -endif
  731.  
  732.     -*[-1] {min(1,$t/40)} # Fade in
  733.     -if {$t>2620} -*[-1] {max(0,1-($t-2620)/30)} -endif # Fade out.
  734.  
  735.     -if {!($t%2)} -outvideo[-1] -endif
  736.     -rm[-1]
  737.  
  738.     xb={($xb+3)&255}
  739.     xl={($xl-3)&255}
  740.     anim={$anim+2}
  741.     -r3d[-2,-1] {sin(0.5*$dt)},{cos($dt)},1,1
  742.     -r3d[-3] -1,0.3,0.8,1
  743.     t={$t+1}
  744.   -while {$t<2700}
  745.   -rm
  746.  
  747.  
  748. # Local Variables:
  749. # mode: sh
  750. # End:
  751. #
  752. # (End of G'MIC custom commands)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement