Skip to content

Instantly share code, notes, and snippets.

@teddokano
Created January 19, 2015 13:35
Show Gist options
  • Save teddokano/0d85d2ad74d45f2dfc06 to your computer and use it in GitHub Desktop.
Save teddokano/0d85d2ad74d45f2dfc06 to your computer and use it in GitHub Desktop.
sample of making 3D animated-GIF file
set size ratio 0.2
set samples 1000
set isosamples 8
set xrange [0:7]
set yrange [0:7]
set zrange [0:1]
set nokey
#set parametric
set grid
set xlabel "vertical"
set ylabel "horizontal"
set zlabel "PWM\n(ratio)"
DISPLAY_OFFSET = 0
SIZE = 0.3
CYCLE = (1 * 10)
speed = 3.0
set view 45, 100, 1.0, 1.0
set terminal gif animate optimize size 640, 480
set output "anm.gif"
set tics font 'Times,9'
load "hat.gp"
n = 0
if (exist("n")==0 || n<0) n=0 #変数の初期化
func( x, y, n ) = cos( ( (((x - DISPLAY_OFFSET) * SIZE) ** 2) + (((y - DISPLAY_OFFSET) * SIZE) ** 2) ) ** 0.5 - n * 0.05 * pi ) ** 4
splot [0:7][0:7][0:1] func( x, y, n )
if (n<100) ; n=n+1; reread
@teddokano
Copy link
Author

clone this repo and execute next command : gnuplot nam_main.gp
it will generate an animated gif file "anm.gif".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment