<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ลายผ้า Archives - KarnLab</title>
	<atom:link href="https://karnlab.com/tag/%e0%b8%a5%e0%b8%b2%e0%b8%a2%e0%b8%9c%e0%b9%89%e0%b8%b2/feed/" rel="self" type="application/rss+xml" />
	<link>https://karnlab.com/tag/ลายผ้า/</link>
	<description>Blog รีวิว หนังสือ เขียนโปรแกรม นานาสาระ</description>
	<lastBuildDate>Mon, 01 Oct 2018 11:33:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>

<image>
	<url>https://karnlab.com/wp-content/uploads/2017/12/Logo-150x150.png</url>
	<title>ลายผ้า Archives - KarnLab</title>
	<link>https://karnlab.com/tag/ลายผ้า/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>วาดรูปด้วยภาษาโลโก้ : ตอนที่ 14 – ลายผ้า</title>
		<link>https://karnlab.com/logo-tutorial-ep14-textile/</link>
					<comments>https://karnlab.com/logo-tutorial-ep14-textile/#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Sat, 11 Aug 2018 10:02:02 +0000</pubDate>
				<category><![CDATA[สอนเขียนโปรแกรม]]></category>
		<category><![CDATA[LOGO]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[ภาษาโลโก้]]></category>
		<category><![CDATA[ลายผ้า]]></category>
		<category><![CDATA[วาดรูป]]></category>
		<category><![CDATA[เขียนโปรแกรม]]></category>
		<guid isPermaLink="false">http://karnlab.com/?p=1163</guid>

					<description><![CDATA[<p>ในตอนนี้เราจะมาวาดลายผ้าด้วยภาษาโลโก้กันครับ โดยเราแค่วาดเส้นธรรมดาๆ แล้วคะเนระยะห่างให้พอดีกับหน้าจอ เราก็จะได้ลายผ้าสวยๆ ครับ คำสั่งที่น้องๆ จะเจอในบทนี้ คำสั่ง ความสามารถ ตัวอย่าง fd ระยะทาง bk ระยะทาง forward = เดินหน้า backward = ถอยหลัง [&#8230;]</p>
<p>The post <a href="https://karnlab.com/logo-tutorial-ep14-textile/">วาดรูปด้วยภาษาโลโก้ : ตอนที่ 14 – ลายผ้า</a> appeared first on <a href="https://karnlab.com">KarnLab</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>ในตอนนี้เราจะมาวาดลายผ้าด้วยภาษาโลโก้กันครับ โดยเราแค่วาดเส้นธรรมดาๆ แล้วคะเนระยะห่างให้พอดีกับหน้าจอ เราก็จะได้ลายผ้าสวยๆ ครับ</p>
<p>คำสั่งที่น้องๆ จะเจอในบทนี้</p>
<table>
<tbody>
<tr>
<td width="198"><strong>คำสั่ง</strong></td>
<td width="227"><strong>ความสามารถ</strong></td>
<td width="227"><strong>ตัวอย่าง</strong></td>
</tr>
<tr>
<td width="198">fd ระยะทาง<br />
bk ระยะทาง</td>
<td width="227">forward = เดินหน้า<br />
backward = ถอยหลัง</td>
<td width="227">fd 100 = เดินหน้า 100 pixel<br />
bk 50 = ถอยหลัง 50 pixel</td>
</tr>
<tr>
<td width="198">rt องศา<br />
lt องศา</td>
<td width="227">right turn = หมุนขวา<br />
left turn = หมุนซ้าย</td>
<td width="227">rt 90 = หมุนไปทางขวา 90 องศา<br />
lt 45 = หมุนไปทางซ้าย 45 องศา</td>
</tr>
<tr>
<td width="198">repeat จำนวนครั้ง [ คำสั่ง ]</td>
<td width="227">repeat = ทำคำสั่งต่อไปนี้ ซ้ำ n ครั้ง</td>
<td width="227">repeat 3 [ fd 100 rt 120 ]<br />
repeat 4 [ fd 100 rt 90 ]<br />
repeat 6 [ fd 100 rt 60 ]</td>
</tr>
<tr>
<td width="198">TO ชื่อฟังก์ชัน :ตัวแปร<br />
คำสั่ง<br />
END</td>
<td width="227">function = สร้างชุดคำสั่ง</td>
<td width="227">TO square :size<br />
repeat 4 [ fd :size rt 90 ]<br />
END</td>
</tr>
<tr>
<td width="198">cs<br />
clean</td>
<td width="227">clear screen = ล้างหน้าจอ<br />
clean = ล้างหน้าจอ</td>
<td width="227"></td>
</tr>
<tr>
<td width="198">pu<br />
pd</td>
<td width="227">pen up = ยกปากกา<br />
pen down = วางปากกา</td>
<td width="227"></td>
</tr>
<tr>
<td width="198">ht<br />
st</td>
<td width="227">hide turtle = ซ่อนเต่าโลโก้<br />
show turtle = แสดงเต่าโลโก้</td>
<td width="227"></td>
</tr>
<tr>
<td width="198">setxy พิกัดx พิกัดy</td>
<td width="227">set (x,y) = กำหนดตำแหน่งเต่าโลโก้</td>
<td width="227">setxy 200 100</td>
</tr>
<tr>
<td width="198">setpensize ขนาด<br />
setpencolor รหัสสี<br />
fill<br />
setscreencolor รหัสสี</td>
<td width="227">set pen size = กำหนดขนาดปากกา<br />
set pen color = กำหนดสีปากกา<br />
fill = ระบายสี<br />
set screen color = กำหนดสีพื้นหลัง</td>
<td width="227">setpensize 5<br />
setpencolor 10<br />
fill<br />
setscreencolor 10</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>*** การวาดรูปลายผ้า ขนาดหน้าจอ (Resolution) ของคอมพิวเตอร์ที่น้องๆ ใช้ มีความสำคัญมากนะครับ โดยโปรแกรมในบทนี้ทดสอบกับหน้าจอขนาด 1366 x 768 นะครับ หากน้องๆ ต้องการวาดลวดลายผ้าให้เต็มจอ ต้องปรับขนาดให้เหมาะกับหน้าจอคอมพิวเตอร์ที่ต้องๆ ใช้นะครับ</p>
<p>&nbsp;</p>
<p>โปรแกรมที่ 14-1</p>
<figure id="attachment_1151" aria-describedby="caption-attachment-1151" style="width: 962px" class="wp-caption alignleft"><img fetchpriority="high" decoding="async" class="size-full wp-image-1151" src="https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-1.png" alt="LOGO EP14 - Textile 1" width="962" height="608" srcset="https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-1.png 962w, https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-1-300x190.png 300w, https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-1-768x485.png 768w" sizes="(max-width: 962px) 100vw, 962px" /><figcaption id="caption-attachment-1151" class="wp-caption-text">LOGO EP14 &#8211; Textile 1</figcaption></figure>
<table>
<tbody>
<tr>
<td width="387">TO setup<br />
cs ht<br />
setscreencolor &#8220;#795548<br />
setpencolor &#8220;#FFEB3B<br />
setpensize 3<br />
END</p>
<p>setup<br />
pu setxy -470 -220 pd<br />
repeat 28 [<br />
rt 30 fd 510<br />
pu bk 510<br />
rt 60 fd 34<br />
lt 90 pd<br />
]<br />
pu setxy -470 220 pd<br />
repeat 28 [<br />
rt 150 fd 510<br />
pu bk 510<br />
lt 60 fd 34<br />
lt 90 pd<br />
]</td>
</tr>
</tbody>
</table>
<p>อธิบายการทำงานของโปรแกรม</p>
<ul>
<li>ฟังก์ชัน setup ใช้สำหรับกำหนดสีของพื้นหลัง สีของปากกา และขนาดของปากกา</li>
<li>คำสั่ง pu setxy -470 -220 pd คือ การย้ายตำแหน่งเต่าโลโก้ ไปที่มุมซ้ายล่างของหน้าจอ</li>
<li>repeat 28 คือ การทำซ้ำ 28 ครั้ง</li>
<li>rt 30 fd 510 คือ การวาดเส้นตรง (เอียงและยาว)</li>
<li>pu bk 510 คือ การยกปากกากลับมาที่เดิม</li>
<li>rt 60 fd 34 lt 90 pd คือ การยกปากกาไปที่ตำแหน่งถัดไป</li>
<li>&#8230;..</li>
</ul>
<p>&nbsp;</p>
<p>โปรแกรมที่ 14-2A</p>
<figure id="attachment_1152" aria-describedby="caption-attachment-1152" style="width: 966px" class="wp-caption alignleft"><img decoding="async" class="size-full wp-image-1152" src="https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-2A.png" alt="LOGO EP14 - Textile 2A" width="966" height="610" srcset="https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-2A.png 966w, https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-2A-300x189.png 300w, https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-2A-768x485.png 768w" sizes="(max-width: 966px) 100vw, 966px" /><figcaption id="caption-attachment-1152" class="wp-caption-text">LOGO EP14 &#8211; Textile 2A</figcaption></figure>
<table>
<tbody>
<tr>
<td width="387">TO setup<br />
cs ht<br />
setscreencolor &#8220;#FFF9C4<br />
setpencolor &#8220;#4FC3F7<br />
setpensize 3<br />
END</p>
<p>TO h_line<br />
repeat 19 [<br />
fd 1000<br />
pu rt 90 fd 50 lt 90 pd<br />
]<br />
END</p>
<p>TO v_line<br />
repeat 9 [<br />
fd 1200<br />
pu rt 90 fd 50 lt 90 pd<br />
]<br />
END</p>
<p>setup<br />
pu setxy -450 0 pd<br />
h_line<br />
rt 90<br />
pu setxy -450 200 pd<br />
v_line</td>
</tr>
</tbody>
</table>
<p>อธิบายการทำงานของโปรแกรม</p>
<ul>
<li>ฟังก์ชัน setup ใช้สำหรับกำหนดสีของพื้นหลัง สีของปากกา และขนาดของปากกา</li>
<li>คำสั่ง pu setxy -450 0 pd คือ การย้ายตำแหน่งเต่าโลโก้ไปที่มุมซ้าย</li>
<li>ฟังก์ชัน h_line มีหน้าที่วาดเส้นยาวแนวตั้ง (19 ครั้ง)
<ul>
<li>แต่ละครั้งจะวาดเส้นตรง และย้ายเต่าโลโก้ไปที่ตำแหน่งถัดไป</li>
</ul>
</li>
<li>ฟังก์ชัน v_line มีหน้าที่วาดเส้นยาวแนวนอน (9 ครั้ง)
<ul>
<li>แต่ละครั้งจะวาดเส้นตรง และย้ายเต่าโลโก้ไปที่ตำแหน่งถัดไป</li>
</ul>
</li>
</ul>
<p>&nbsp;</p>
<p>โปรแกรมที่ 14-2B</p>
<figure id="attachment_1153" aria-describedby="caption-attachment-1153" style="width: 963px" class="wp-caption alignleft"><img decoding="async" class="size-full wp-image-1153" src="https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-2B.png" alt="LOGO EP14 - Textile 2B" width="963" height="609" srcset="https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-2B.png 963w, https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-2B-300x190.png 300w, https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-2B-768x486.png 768w" sizes="(max-width: 963px) 100vw, 963px" /><figcaption id="caption-attachment-1153" class="wp-caption-text">LOGO EP14 &#8211; Textile 2B</figcaption></figure>
<table>
<tbody>
<tr>
<td width="387">TO setup<br />
cs ht<br />
setscreencolor &#8220;#FFF9C4<br />
setpensize 3<br />
END</p>
<p>TO h_line :s<br />
if ( :s &lt; 1 ) [ stop ]<br />
if ( :s % 2 = 0 ) [ setpencolor &#8220;#F06292 ]<br />
if ( :s % 2 = 1 ) [ setpencolor &#8220;#4FC3F7 ]<br />
fd 1000<br />
pu rt 90 fd 50 lt 90 pd<br />
h_line :s-1<br />
END</p>
<p>TO v_line :s<br />
if ( :s &lt; 1 ) [ stop ]<br />
if ( :s % 2 = 0 ) [ setpencolor &#8220;#F06292 ]<br />
if ( :s % 2 = 1 ) [ setpencolor &#8220;#4FC3F7 ]<br />
fd 1200<br />
pu rt 90 fd 50 lt 90 pd<br />
v_line :s-1<br />
END</p>
<p>setup<br />
pu setxy -450 0 pd<br />
h_line 19<br />
rt 90<br />
pu setxy -450 200 pd<br />
v_line 9</td>
</tr>
</tbody>
</table>
<p>อธิบายการทำงานของโปรแกรม</p>
<ul>
<li>ฟังก์ชัน setup ใช้สำหรับกำหนดสีของพื้นหลัง สีของปากกา และขนาดของปากกา</li>
<li>คำสั่ง pu setxy -450 0 pd คือ การย้ายตำแหน่งเต่าโลโก้ไปที่มุมซ้าย</li>
<li>ฟังก์ชัน h_line มีหน้าที่วาดเส้นยาวแนวตั้ง (19 ครั้ง)
<ul>
<li>แต่ละครั้งจะวาดเส้นตรง และย้ายเต่าโลโก้ไปที่ตำแหน่งถัดไป</li>
<li>เพิ่มเติม คือ เราจะวาดเส้นด้วยสีฟ้าและสีชมพูสลับกัน ดังนั้น เราจึงประยุกต์ใช้ Recursive Function มาใช้งานครับ</li>
<li>โดยตัวแปร :s ทำหน้าที่เป็นตัวนับ
<ul>
<li>ถ้า :s เป็นเลขคู่ ( :s หาร 2 เหลือเศษ 0 ) ตั้งค่าสีชมพู</li>
<li>ถ้า :s เป็นเลขคี่ ( :s หาร 2 เหลือเศษ 1 ) ตั้งค่าสีฟ้า</li>
</ul>
</li>
<li>และถ้าตัวแปร :s มีค่าเป็น 0 (น้อยกว่า 1) หยุดการทำงาน</li>
</ul>
</li>
<li>ฟังก์ชัน v_line มีหน้าที่วาดเส้นยาวแนวนอน (9 ครั้ง)
<ul>
<li>แต่ละครั้งจะวาดเส้นตรง โดยใช้สีฟ้าและสีชมพูสลับกัน และย้ายเต่าโลโก้ไปที่ตำแหน่งถัดไป</li>
</ul>
</li>
</ul>
<p>&nbsp;</p>
<p>โปรแกรมที่ 14-3</p>
<figure id="attachment_1154" aria-describedby="caption-attachment-1154" style="width: 962px" class="wp-caption alignleft"><img loading="lazy" decoding="async" class="size-full wp-image-1154" src="https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-3.png" alt="LOGO EP14 - Textile 3" width="962" height="607" srcset="https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-3.png 962w, https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-3-300x189.png 300w, https://karnlab.com/wp-content/uploads/2018/08/LOGO-EP14-Textile-3-768x485.png 768w" sizes="auto, (max-width: 962px) 100vw, 962px" /><figcaption id="caption-attachment-1154" class="wp-caption-text">LOGO EP14 &#8211; Textile 3</figcaption></figure>
<table>
<tbody>
<tr>
<td width="387">TO setup<br />
cs ht<br />
setscreencolor &#8220;#FFF9C4<br />
setpencolor &#8220;#8D6E63<br />
setpensize 3<br />
END</p>
<p>setup<br />
pu setxy -460 0 pd<br />
repeat 10 [<br />
fd 1000<br />
pu rt 90 fd 20 lt 90 pd<br />
fd 1000<br />
pu rt 90 fd 80 lt 90 pd<br />
]</p>
<p>rt 90<br />
pu setxy -450 210 pd<br />
repeat 5 [<br />
fd 1200<br />
pu rt 90 fd 20 lt 90 pd<br />
fd 1200<br />
pu rt 90 fd 80 lt 90 pd<br />
]</td>
</tr>
</tbody>
</table>
<p>อธิบายการทำงานของโปรแกรม</p>
<ul>
<li>ฟังก์ชัน setup ใช้สำหรับกำหนดสีของพื้นหลัง สีของปากกา และขนาดของปากกา</li>
<li>คำสั่ง pu setxy -460 0 pd คือ การย้ายตำแหน่งเต่าโลโก้ไปที่มุมซ้าย</li>
<li>repeat 10 คือ การทำซ้ำ 10 ครั้ง</li>
<li>fd 1000 pu rt 90 fd 20 lt 90 pd<br />
fd 1000 pu rt 90 fd 80 lt 90 pd<br />
คือ การวาดเส้นตรง 2 เส้น (ที่อยู่ใกล้กัน) จากนั้นย้ายตำแหน่งเต่าโลโก้</li>
</ul>
<ul>
<li>&#8230;..</li>
</ul>
<p>&nbsp;</p>
<p>และนี่คือเรื่องราวของเทคนิคการวาดรูปจากหมุนที่นำมาฝากกันในวันนี้ครับ สามารถติดตามตอนต่อไปได้ที่นี่ครับ <a href="https://karnlab.com/tag/ภาษาโลโก้">https://karnlab.com/tag/ภาษาโลโก้</a></p>
<p>&nbsp;</p>
<p>The post <a href="https://karnlab.com/logo-tutorial-ep14-textile/">วาดรูปด้วยภาษาโลโก้ : ตอนที่ 14 – ลายผ้า</a> appeared first on <a href="https://karnlab.com">KarnLab</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://karnlab.com/logo-tutorial-ep14-textile/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 

Served from: karnlab.com @ 2026-08-26 05:48:11 by W3 Total Cache
-->