From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/112198 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jeroen Newsgroups: gmane.comp.tex.context Subject: Metapost Animation of Sine Date: Wed, 21 Jul 2021 16:08:26 +0200 Message-ID: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8842690770353685317==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16772"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Jul 21 16:09:10 2021 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m6CuM-0004BY-L7 for gctc-ntg-context-518@m.gmane-mx.org; Wed, 21 Jul 2021 16:09:10 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 452C3284BB4; Wed, 21 Jul 2021 16:08:40 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6kKdn_vr7aLm; Wed, 21 Jul 2021 16:08:38 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 73B70285CF1; Wed, 21 Jul 2021 16:08:38 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 6B876285C64 for ; Wed, 21 Jul 2021 16:08:36 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1Zv2iGyECIH9 for ; Wed, 21 Jul 2021 16:08:35 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.166.177; helo=mail-il1-f177.google.com; envelope-from=contextntg@gmail.com; receiver= Original-Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 98A68284BB4 for ; Wed, 21 Jul 2021 16:08:35 +0200 (CEST) Original-Received: by mail-il1-f177.google.com with SMTP id m20so2390368ili.9 for ; Wed, 21 Jul 2021 07:08:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=FzagRd65RmYRiu2x7c9qeFgcfqsL68bLqaoRHREoutc=; b=pQcBw/X4HFaa+fEiUyoX5oNXeiLdS1irOXUkrXi90PP/1qR9lkmOeylgdxkVmXz8u8 GpDs2tzU/9sbOdEPY9hyIsu5TFGmaFCjv00Y+sZ2qwkquI+mXxrcCniPaoU1BUzpZFaA qF/LIaInGyNdAJOX2W8fY+z2CYugTeRJbK3WlCLg7f/FxZsoFy0SJh4ubn+WoZ7wqaKi 2bTRXzmrCn9v2gC5tK98MN5+D4g7KBrJhjvQF+VLxSi9VEWawKRrDZxmstb6o14OLdoE b7Ggd/AwWJte2OX/MSmXzEQMOlaF2x5CBgyBFSWK/Ta6h0kZdrGpn8G6t2dMtNw4pMuQ YwGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=FzagRd65RmYRiu2x7c9qeFgcfqsL68bLqaoRHREoutc=; b=ng1zzqDS6OUEQbxvuS3B4msaVPBe5eTn0Hd9zBs0Rk/8or/QRlZfAUGefIQwwqLFie i5j2QIyATLwXwsmnq/nGuxD+0wsCE4hYUz3lIemEwHiMnYKN/yLay0UW3iC1SVLWJpAU U2QnOZO/QCFAMhHeZJLFBLjtBnUwwS1dxIcyfkiUU/7NnbMrxMwz3OQcaYntdq+SF9kE wJltqie8LwpnmScYP1rZGVpzJ/BC9YNPU5jyQnFeToWp/ENCUsMXYfmjvhGiNo2yH3CA /ZdUHCfNb66/i1BcQtzmx86wBxX3Ieca8gD8mXR1c8pxaELsAth3PIxLhLsrZrbAADX4 lbAA== X-Gm-Message-State: AOAM530rYwprBN/NVuHRieRhhCexoxYQzMAJ7aqEdeGRdqd9miDIXUzO dk5cf8ZJJvY/6FAiW3eeG0uJfeisbx7ZaybOEyGbV1BT9h7ORQ== X-Google-Smtp-Source: ABdhPJz4tWskiwGl8NMlx6Kjd3fyQ0ncOVypP92yz5pFqm6ihjueTufo/xjTWucZBGBCZKPcsWbwtwpwaxRGO1KNvHk= X-Received: by 2002:a05:6e02:1a28:: with SMTP id g8mr24510530ile.128.1626876513889; Wed, 21 Jul 2021 07:08:33 -0700 (PDT) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 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" Xref: news.gmane.io gmane.comp.tex.context:112198 Archived-At: --===============8842690770353685317== Content-Type: multipart/alternative; boundary="000000000000b4380a05c7a2b4f1" --000000000000b4380a05c7a2b4f1 Content-Type: text/plain; charset="UTF-8" I use this small animation to enlarge a circle \usemodule[animation] \setupinteraction[state=start] \starttext \startanimation[menu=yes,framerate=10] \dorecurse{7}{\expanded {\startframe \startMPcode path p; numeric n, u; u := 1cm; n:=\recurselevel*u; p := fullcircle scaled n; draw p; \stopMPcode \stopframe}} \stopanimation \stoptext This I use to draw a sine \starttext \startMPcode draw(-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. (i/360*1.5cm,0.9cm*(sind(i)))endfor; \stopMPcode \stoptext When I put it together to animate the sine as following, it does not entirely create the sine animation I am looking for \usemodule[animation] \setupinteraction[state=start] \starttext \startanimation[menu=yes,framerate=10] \dorecurse{7}{\expanded {\startframe \startMPcode path p; numeric n, u; u := 1cm; n:=\recurselevel*u; p := (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. (i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0); draw p; \stopMPcode \stopframe}} \stopanimation \stoptext What better way can I create a sine animation with Metapost? --000000000000b4380a05c7a2b4f1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

I use this small animation to enlarge a circle


\usemodule[animation]
\setupinteraction[state=3Dstart]
\starttext
\startanimation[menu=3Dyes,framerate=3D10]
\dorecurse{7}{\expanded
=C2=A0 {\startframe
=C2=A0 =C2=A0 \startMPcode
=C2=A0 =C2=A0 path p;
=C2=A0 =C2=A0 numeric n, u;
=C2=A0 =C2=A0 u :=3D 1cm;
=C2=A0 =C2=A0 n:=3D\recurselevel*u;
=C2=A0 =C2=A0 p :=3D fullcircle scaled n;
=C2=A0 =C2=A0 draw p;
=C2=A0 =C2=A0 \stopMPcode
=C2=A0 \stopframe}}
\stopanimation
\stoptext


This I use to draw a sine


\starttext
\startMPcode
=C2=A0 draw(-90/360*1.5cm,-0.9cm) for i =3D -90 upto 630: .. (i/360*1.5cm,0.9cm*(sind(i)))endfor;
\stopMPcode
\stoptext


When I put it together to animate the sine as following, it does not entire= ly create the sine animation I am looking for


\usemodule[animation]
\setupinteraction[state=3Dstart]
\starttext
\startanimation[menu=3Dyes,framerate=3D10]
\dorecurse{7}{\expanded
=C2=A0 {\startframe
=C2=A0 =C2=A0 \startMPcode
=C2=A0 =C2=A0 path p;
=C2=A0 =C2=A0 numeric n, u;
=C2=A0 =C2=A0 u :=3D 1cm;
=C2=A0 =C2=A0 n:=3D\recurselevel*u;
=C2=A0 =C2=A0 p :=3D (-90/360*1.5cm,-0.9cm) for i =3D -90 upto 630: .. (i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0);
=C2=A0 =C2=A0 draw p;
=C2=A0 =C2=A0 \stopMPcode
=C2=A0 =C2=A0 \stopframe}}
\stopanimation
\stoptext


What better way can I create a sine animation with Metapost?

=C2=A0

--000000000000b4380a05c7a2b4f1-- --===============8842690770353685317== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============8842690770353685317==--