ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Colors in lmt_surface and luametafun
@ 2020-04-17 13:33 Otared Kavian
  2020-04-17 13:59 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Otared Kavian @ 2020-04-17 13:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Hans,

On page 36 of luametafun.pdf there is the following example of using lmt_surface:

\startMPcode{doublefun}
	draw lmt_surface [
		preamble  = "local sin, cos = math.sin, math.cos",
		code = "sin(x*x) - cos(y*y)",
		color = "f, f/2, 1-f",
		color = "f, f, 0",
		xstep = .02,
		ystep = .02,
		xvector = {-0.4, -0.4},
		height = 10cm,
		lines = true,
	] xsized .TextWidth ;
\stopMPcode

What is the meaning of « f » in « color = "f, f/5, 1-f" »?
Is it possible to specify other colors and how can it be done?

Thanks for your attention: Otared 
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Colors in lmt_surface and luametafun
  2020-04-17 13:33 Colors in lmt_surface and luametafun Otared Kavian
@ 2020-04-17 13:59 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2020-04-17 13:59 UTC (permalink / raw)
  To: Otared Kavian, ntg-context

On 4/17/2020 3:33 PM, Otared Kavian wrote:
> Hi Hans,
> 
> On page 36 of luametafun.pdf there is the following example of using lmt_surface:
> 
> \startMPcode{doublefun}
> 	draw lmt_surface [
> 		preamble  = "local sin, cos = math.sin, math.cos",
> 		code = "sin(x*x) - cos(y*y)",
> 		color = "f, f/2, 1-f",
> 		color = "f, f, 0",
> 		xstep = .02,
> 		ystep = .02,
> 		xvector = {-0.4, -0.4},
> 		height = 10cm,
> 		lines = true,
> 	] xsized .TextWidth ;
> \stopMPcode
> 
> What is the meaning of « f » in « color = "f, f/5, 1-f" »?
> Is it possible to specify other colors and how can it be done?
f = fraction

you can write some function yourself

\starttext

\startMPcode{doublefun}
	draw lmt_surface [
		preamble = "local sin, cos = math.sin, math.cos",
		code     = "sin(x*x) - cos(y*y)",
		color    = "f, f, 0",
		xstep    = .02,
		ystep    = .02,
		xvector  = {-0.4, -0.4},
		height   = 5cm,
		lines    = true,
	] ysized (TextHeight/4) ;
\stopMPcode

\startluacode
     function MyColor(f) return f/2, f/3, .5 end
\stopluacode

\startMPcode{doublefun}
	draw lmt_surface [
		preamble = "local sin, cos = math.sin, math.cos",
		code     = "sin(x*x) - cos(y*y)",
		color    = "MyColor(f)",
		xstep    = .02,
		ystep    = .02,
		xvector  = {-0.4, -0.4},
		height   = 5cm,
		lines    = true,
	] ysized (TextHeight/4) ;
\stopMPcode

\startMPcode{doublefun}
	draw lmt_surface [
		preamble = "local sin, cos = math.sin, math.cos " &
                    "function MyColor(f) return 0, f/3, .5 end",
		code     = "sin(x*x) - cos(y*y)",
		color    = "MyColor(f)",
		xstep    = .02,
		ystep    = .02,
		xvector  = {-0.4, -0.4},
		height   = 5cm,
		lines    = true,
	] ysized (TextHeight/4) ;
\stopMPcode



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2020-04-17 13:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17 13:33 Colors in lmt_surface and luametafun Otared Kavian
2020-04-17 13:59 ` Hans Hagen

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