From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/80048 Path: news.gmane.org!not-for-mail From: Jeong Dal Newsgroups: gmane.comp.tex.context Subject: Re: MetaPost Animations Date: Sun, 30 Dec 2012 22:19:16 +0900 Message-ID: <5DC206AE-CC64-4254-972E-852ECD92B0DD@me.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1356873573 31953 80.91.229.3 (30 Dec 2012 13:19:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Dec 2012 13:19:33 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Sun Dec 30 14:19:49 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TpInq-0006Oy-Re for gctc-ntg-context-518@m.gmane.org; Sun, 30 Dec 2012 14:19:46 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id CA66310206; Sun, 30 Dec 2012 14:19:31 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id w0bgPRQNa9FO; Sun, 30 Dec 2012 14:19:28 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 169DD101E7; Sun, 30 Dec 2012 14:19:28 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id EA50F101E7 for ; Sun, 30 Dec 2012 14:19:26 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id lrk1tPC0ewPI for ; Sun, 30 Dec 2012 14:19:26 +0100 (CET) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by balder.ntg.nl (Postfix) with ESMTP id 1BA25101E3 for ; Sun, 30 Dec 2012 14:19:26 +0100 (CET) Original-Received: from nk11p03mm-asmtp001.mac.com (nk11p03mm-asmtpout001.mac.com [17.158.232.236]) by filter2-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id qBUDJLNH003880 for ; Sun, 30 Dec 2012 14:19:22 +0100 Original-Received: from [10.0.1.5] (unknown [1.235.87.79]) by nk11p03mm-asmtp001.mac.com (Oracle Communications Messaging Server 7u4-26.01(7.0.4.26.0) 64bit (built Jul 13 2012)) with ESMTPSA id <0MFU00LLIIC5JD60@nk11p03mm-asmtp001.mac.com> for ntg-context@ntg.nl; Sun, 30 Dec 2012 13:19:20 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.9.8327,1.0.431,0.0.0000 definitions=2012-12-30_03:2012-12-28,2012-12-30,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=1 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1203120001 definitions=main-1212300095 X-Mailer: Apple Mail (2.1499) X-Bayes-Prob: 0.0138 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=17.158.232.236; country=US; region=CA; city=Cupertino; postalcode=95014; latitude=37.3042; longitude=-122.0946; metrocode=807; areacode=408; http://maps.google.com/maps?q=37.3042,-122.0946&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0QIFNjlJg - 3701d813f2df - 20121230 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:80048 Archived-At: Dear Troy, The animations are impressive and thank you for sharing the code. In the creation of many pdf for animation, it changes the recurselevel only. I wonder if there is a way to make such kind of animation in ConTeXt using Wolfgang's animation module. Then we can include the animation in PDF output directly. Here is my trial. I modified it as following and got an animation. But it is only good for a few step animation. %%%%%%%%% \startbuffer[base] N:=64;%\N; u:=136; pair f; c:=2/(1+sqrt(5));%\c; if c<1: f:=(1+-+c,0); v:=u/2; else: f:=(0,1+-+(1/c)); v:=u/c/2; fi; % Focus f is defined path p,q; pair z; picture base; numeric L; p:=fullcircle yscaled c; % This is the ellipse L:=length p; draw p scaled (2*v) withpen pencircle scaled (v/260) dashed evenly; % Draw the ellipse dashed (will be traced later) base:= currentpicture; q:=bbox currentpicture enlarged (v/64); % Enlarge the bounding box slightly q:=(llcorner q+(-v/128,-v/128))--(lrcorner q+(v/128,-v/128))--(urcorner q+(v/128,v/128))--(urcorner q+(-v/128,v/128))--cycle; fill fullcircle scaled (v/32) shifted (f*v) withcolor red; % Focus fill fullcircle scaled (v/32) shifted (-f*v) withcolor red; % Focus base:=currentpicture; % Save this picture to draw in every frame setbounds currentpicture to q; % Set the bounding box as described before \stopbuffer \startbuffer[fig1] % \startMPpage n:=1;%\recurselevel%1; draw base; % Draw the common picture saved above draw subpath (0,(n-1)/(N-1)*L) of p scaled (2*v) withpen pencircle scaled (v/130) withcolor blue; % Trace the ellipse in blue z:=point ((n-1)/(N-1)*L) of p scaled v; % The point on the ellipse where we are thusfar fill fullcircle scaled (v/32) shifted (2*z) withcolor blue; % Draw the point draw (-f*v)--(2*z)--(f*v) withpen pencircle scaled (v/260); % Draw the string used to trace the ellipse setbounds currentpicture to q; % Set the bounding box so that it is the same for each frame % \stopMPpage \stopbuffer \startbuffer[fig2] % \startMPpage n:=2; draw base; % Draw the common picture saved above draw subpath (0,(n-1)/(N-1)*L) of p scaled (2*v) withpen pencircle scaled (v/130) withcolor blue; % Trace the ellipse in blue z:=point ((n-1)/(N-1)*L) of p scaled v; % The point on the ellipse where we are thusfar fill fullcircle scaled (v/32) shifted (2*z) withcolor blue; % Draw the point draw (-f*v)--(2*z)--(f*v) withpen pencircle scaled (v/260); % Draw the string used to trace the ellipse setbounds currentpicture to q; % Set the bounding box so that it is the same for each frame % \stopMPpage \stopbuffer \startbuffer[fig3] % \startMPpage n:=3; draw base; % Draw the common picture saved above draw subpath (0,(n-1)/(N-1)*L) of p scaled (2*v) withpen pencircle scaled (v/130) withcolor blue; % Trace the ellipse in blue z:=point ((n-1)/(N-1)*L) of p scaled v; % The point on the ellipse where we are thusfar fill fullcircle scaled (v/32) shifted (2*z) withcolor blue; % Draw the point draw (-f*v)--(2*z)--(f*v) withpen pencircle scaled (v/260); % Draw the string used to trace the ellipse setbounds currentpicture to q; % Set the bounding box so that it is the same for each frame % \stopMPpage \stopbuffer \setupinteraction[state=start] \usemodule[animation] \starttext \startanimation[menu=yes] {\processMPbuffer[base, fig1]} {\processMPbuffer[base, fig2]} {\processMPbuffer[base, fig3]} \stopanimation \stoptext %%%%%%%%%%%%% I also tried to simplify the code as following, but it just draw 10 figures not an animation. Is there a way to combine them as an animation? Thank you. Best regards, Dalyoung %%%%%%%%%%%%%%%%%%%%%%%%% \startbuffer[base] N:=64;%\N; u:=136; pair f; c:=2/(1+sqrt(5));%\c; if c<1: f:=(1+-+c,0); v:=u/2; else: f:=(0,1+-+(1/c)); v:=u/c/2; fi; % Focus f is defined path p,q; pair z; picture base; numeric L; p:=fullcircle yscaled c; % This is the ellipse L:=length p; draw p scaled (2*v) withpen pencircle scaled (v/260) dashed evenly; % Draw the ellipse dashed (will be traced later) base:= currentpicture; q:=bbox currentpicture enlarged (v/64); % Enlarge the bounding box slightly q:=(llcorner q+(-v/128,-v/128))--(lrcorner q+(v/128,-v/128))--(urcorner q+(v/128,v/128))--(urcorner q+(-v/128,v/128))--cycle; fill fullcircle scaled (v/32) shifted (f*v) withcolor red; % Focus fill fullcircle scaled (v/32) shifted (-f*v) withcolor red; % Focus base:=currentpicture; % Save this picture to draw in every frame setbounds currentpicture to q; % Set the bounding box as described before \stopbuffer \startbuffer[fig1] % \startMPpage n:=\recurselevel; draw base; % Draw the common picture saved above draw subpath (0,(n-1)/(N-1)*L) of p scaled (2*v) withpen pencircle scaled (v/130) withcolor blue; % Trace the ellipse in blue z:=point ((n-1)/(N-1)*L) of p scaled v; % The point on the ellipse where we are thusfar fill fullcircle scaled (v/32) shifted (2*z) withcolor blue; % Draw the point draw (-f*v)--(2*z)--(f*v) withpen pencircle scaled (v/260); % Draw the string used to trace the ellipse setbounds currentpicture to q; % Set the bounding box so that it is the same for each frame % \stopMPpage \stopbuffer \setupinteraction[state=start] \usemodule[animation] \starttext \startanimation[menu=yes] \dorecurse{10}{ {\processMPbuffer[base, fig1]}} %{\processMPbuffer[base, fig2]} %{\processMPbuffer[base, fig3]} \stopanimation \stoptext %%%%%%% ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________