ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] enhancing MetaPost presentation progress graphics
@ 2023-07-19 10:32 Henning Hraban Ramm
  2023-07-19 10:49 ` [NTG-context] " Floris van Manen via ntg-context
  2023-07-19 12:07 ` Taco Hoekwater
  0 siblings, 2 replies; 5+ messages in thread
From: Henning Hraban Ramm @ 2023-07-19 10:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: enhancing MetaPost presentation progress graphics
  2023-07-19 10:32 [NTG-context] enhancing MetaPost presentation progress graphics Henning Hraban Ramm
@ 2023-07-19 10:49 ` Floris van Manen via ntg-context
  2023-07-19 12:07 ` Taco Hoekwater
  1 sibling, 0 replies; 5+ messages in thread
From: Floris van Manen via ntg-context @ 2023-07-19 10:49 UTC (permalink / raw)
  To: ntg-context; +Cc: Floris van Manen



On 19/07/2023 12:32, Henning Hraban Ramm wrote:
> I find the waves not yet very convincing. 

Depending on the intended weather,
I'd rather flatten the amplitudes out with the distance.
Unlike mountains, waves do not get much higher at the horizon.

.F
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: enhancing MetaPost presentation progress graphics
  2023-07-19 10:32 [NTG-context] enhancing MetaPost presentation progress graphics Henning Hraban Ramm
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Taco Hoekwater @ 2023-07-19 12:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

First, find the actual point along the curve of the wave you want, then you can ask for the direction of the wave at that time, and its point:

\startuseMPgraphic{Waves}
numeric height,stops,yoffset;
stops := 10;
height := OverlayHeight/10;
path wave[]; % storing waves

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[j] := (0,0)--(0,yoffset)...
 for i=1 upto stops:
   (OverlayWidth*i/(stops+1), (yoffset) randomized (height/2)) ...
 endfor
 (OverlayWidth,yoffset);
 fill ((0,0)--wave[j]--(OverlayWidth,0)--cycle) withcolor "Sea";
endfor;

xpos := OverlayWidth * RealPageNumber/NOfPages;
path ship;
ship := (0,10)---(70,10)...(60,0)---(10,0)...cycle;

pair itime, iangle, boatpos;

itime = (wave[3] intersectiontimes ((xpos,0)--(xpos,infinity)));
iangle = direction (xpart itime) of wave[3];
boatpos = (point (xpart itime) of wave[3]) shifted (-5,0); % shift to center horizontally

fill ship xysized (10,5) shifted boatpos rotatedaround (boatpos, angle iangle) withcolor red;
\stopuseMPgraph

> On 19 Jul 2023, at 12:32, Henning Hraban Ramm <texml@fiee.net> wrote:
> 
> 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
> ___________________________________________________________________________________


— 
Taco Hoekwater              E: taco@bittext.nl
genderfluid (all pronouns)


___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: enhancing MetaPost presentation progress graphics
  2023-07-19 12:07 ` Taco Hoekwater
@ 2023-07-19 17:06   ` Henning Hraban Ramm
  2023-07-19 18:02     ` Duncan Hothersall
  0 siblings, 1 reply; 5+ messages in thread
From: Henning Hraban Ramm @ 2023-07-19 17:06 UTC (permalink / raw)
  To: ntg-context

[-- Attachment #1: Type: text/plain, Size: 677 bytes --]

Am 19.07.23 um 14:07 schrieb Taco Hoekwater:
> First, find the actual point along the curve of the wave you want, then you can ask for the direction of the wave at that time, and its point:

Thank you!

> pair itime, iangle, boatpos;
> 
> itime = (wave[3] intersectiontimes ((xpos,0)--(xpos,infinity)));
> iangle = direction (xpart itime) of wave[3];
> boatpos = (point (xpart itime) of wave[3]) shifted (-5,0); % shift to center horizontally

There was still an error that I introduced:
The boat on the first page is already way in, while on the last page it 
falls over the edge of the world.

I fixed several other things and drew a nicer boat. Feel free to use it.

Hraban

[-- Attachment #2: boat.tex --]
[-- Type: application/x-tex, Size: 2615 bytes --]

[-- Attachment #3: Type: text/plain, Size: 495 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: enhancing MetaPost presentation progress graphics
  2023-07-19 17:06   ` Henning Hraban Ramm
@ 2023-07-19 18:02     ` Duncan Hothersall
  0 siblings, 0 replies; 5+ messages in thread
From: Duncan Hothersall @ 2023-07-19 18:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1346 bytes --]

I am in awe at this. Thanks for sharing.

On Wed, 19 Jul 2023 at 18:11, Henning Hraban Ramm <texml@fiee.net> wrote:

> Am 19.07.23 um 14:07 schrieb Taco Hoekwater:
> > First, find the actual point along the curve of the wave you want, then
> you can ask for the direction of the wave at that time, and its point:
>
> Thank you!
>
> > pair itime, iangle, boatpos;
> >
> > itime = (wave[3] intersectiontimes ((xpos,0)--(xpos,infinity)));
> > iangle = direction (xpart itime) of wave[3];
> > boatpos = (point (xpart itime) of wave[3]) shifted (-5,0); % shift to
> center horizontally
>
> There was still an error that I introduced:
> The boat on the first page is already way in, while on the last page it
> falls over the edge of the world.
>
> I fixed several other things and drew a nicer boat. Feel free to use it.
>
> 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
>
> ___________________________________________________________________________________

[-- Attachment #1.2: Type: text/html, Size: 2178 bytes --]

[-- Attachment #2: Type: text/plain, Size: 495 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-07-19 18:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-19 10:32 [NTG-context] enhancing MetaPost presentation progress graphics Henning Hraban Ramm
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

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).