ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henning Hraban Ramm <texml@fiee.net>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] enhancing MetaPost presentation progress graphics
Date: Wed, 19 Jul 2023 12:32:55 +0200	[thread overview]
Message-ID: <36b2de99-972e-fd30-b62c-82855424a789@fiee.net> (raw)

Hi,
I’d like a presentation progress indicator that looks like a boat on 
waves – and if it works, it can also become a bike on hills or a mars 
rover on dunes. But my math skills are lacking.

Below’s a mostly working draft.

* I find the waves not yet very convincing. Would it make sense to use a 
randomized sinus? (How?)

* The boat should sit on the middle wave and be rotated by the current 
slope. I know I need the “time” of the upper curve and get the 1st 
derivation, but how?

"""
\setuppapersize[SW]

\startuseMPgraphic{Waves}
numeric height,stops,yoffset;
stops := 10;
height := OverlayHeight/10;
path wave;

draw (0,0)--(OverlayWidth,0)--(OverlayWidth,OverlayHeight) withcolor 
white withpen pencircle scaled 0.01;

for j=1 upto 3:
   definecolor [name="Sea", y=(j/20), c=2*(j/10), m=(j/20)];
   yoffset := height/(j*2);
   wave := (0,0)--(0,yoffset)...
   for i=1 upto stops:
     (OverlayWidth*i/(stops+1), (yoffset) randomized (height/2)) ...
   endfor
   (OverlayWidth,yoffset)--(OverlayWidth,0)--cycle;
   fill wave withcolor "Sea";
endfor;

pair pos;
pos := (OverlayWidth * RealPageNumber/NOfPages, height/2 randomized 2);
path ship;
ship := (0,10)---(70,10)...(60,0)---(10,0)...cycle;

fill ship xysized (10,5) shifted pos rotatedaround (pos, 15) withcolor red;
\stopuseMPgraphic

\defineoverlay[Waves][\useMPgraphic{Waves}]

\setupbackgrounds[state=repeat]
\setupbackgrounds[page][background={Waves}]

\starttext

\dorecurse{10}{\recurselevel\page}

\stoptext
"""

Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2023-07-19 10:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19 10:32 Henning Hraban Ramm [this message]
2023-07-19 10:49 ` [NTG-context] " Floris van Manen via ntg-context
2023-07-19 12:07 ` Taco Hoekwater
2023-07-19 17:06   ` Henning Hraban Ramm
2023-07-19 18:02     ` Duncan Hothersall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=36b2de99-972e-fd30-b62c-82855424a789@fiee.net \
    --to=texml@fiee.net \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).