Difference between revisions of "RENDER Examples"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with " =ZCubes Render Examples== ==Example 1== <pre> x=500..0..-10 a=x.mergerows(0..0); b=x.mergerows(0..0).m(r=>r.reverse()).reverse(); c=a.mergerows(b) d=c.m(r=>["...")
 
Line 4: Line 4:
 
==Example 1==
 
==Example 1==
 
<pre>
 
<pre>
x=500..0..-10
+
RENDER(
a=x.mergerows(0..0);
+
[
b=x.mergerows(0..0).m(r=>r.reverse()).reverse();
+
["type","size"],
c=a.mergerows(b)
+
["circle",100],
d=c.m(r=>["line",r])
+
["circle",200]
ab=RENDER(d)
+
]
e=d.map(r=>[r[0],[r[1][0],500-r[1][1],500-r[1][2],r[1][3]]])
+
)
RENDER(e,ab)
 
""
 
 
</pre>
 
</pre>
  
Line 59: Line 57:
 
]
 
]
 
);
 
);
 +
""
 +
</pre>
 +
 +
==Example 5==
 +
<pre>
 +
x=500..0..-10
 +
a=x.mergerows(0..0);
 +
b=x.mergerows(0..0).m(r=>r.reverse()).reverse();
 +
c=a.mergerows(b)
 +
d=c.m(r=>["line",r])
 +
ab=RENDER(d)
 +
e=d.map(r=>[r[0],[r[1][0],500-r[1][1],500-r[1][2],r[1][3]]])
 +
RENDER(e,ab)
 
""
 
""
 
</pre>
 
</pre>

Revision as of 12:19, 1 October 2020

ZCubes Render Examples=

Example 1

RENDER(
				[
					["type","size"],
					["circle",100],
					["circle",200]
				]
			)


Example 2

			RENDER(
				[
					["type","size","count"],
					["circle",(i)=>100+i*10,10]
				]
			)
			""

Example 3

American Flag

// american flag 4 final
			RENDER(
				[
					["type","x","y",		"width","height","fill",				"count","shape","id","href","sides","size"],
					["rect",10,(i)=>i*20,	400,	20, 	(i)=>(i%2)?"white":"red"	,13,,,,,],
					["rect",10,	0,			200,	140,	"blue"						,1,,,,,],
					["star",50,	0,			200,	140,	"white"						,1,true,"star11","","12",10],
					["use",(i)=>((i)%6)*30+30,	(i)=>((i).intdiv(6))*25+15,			300,	140,	"white"						,6*5,false,"","star11","",300],
					["use",(i)=>((i)%5)*30+20+25,	(i)=>((i).intdiv(5))*25+20+10,			300,	140,	"white"						,4*5,false,"","star11","",300]
				]
			)			
			""

Example 4

Indian Flag

// american flag 4 final
RENDER(
				[
					["type","x","y",		"width","height","fill",				"count","shape","id","href","sides","size","cx","cy","r","stroke","stroke-width","points","transform"],
					["rect",10,(i)=>i*90,	400,	90, 	["orange","white","green"]	,3,,,,,,],
					["circle",,,,,		,1,,,,,,200,135,40,"blue",5,],
					["circle",,,,,		,1,,,,,,200,135,5,"blue",10,],
					["polyline",,,,,	"blue"	,24,,,,,,,,,"blue",1,i=>[200,135,199,120, 200,95,201,120,200,135],(i=>({"rotation":(i+1)/24*360,"cx":200,"cy":135})) ],
				]
			);
			""

Example 5

			x=500..0..-10
			a=x.mergerows(0..0);
			b=x.mergerows(0..0).m(r=>r.reverse()).reverse();
			c=a.mergerows(b)
			d=c.m(r=>["line",r])
			ab=RENDER(d)
			e=d.map(r=>[r[0],[r[1][0],500-r[1][1],500-r[1][2],r[1][3]]])
			RENDER(e,ab)
			""