User:Book: Difference between revisions

From LifeWiki
Jump to navigation Jump to search
No edit summary
 
(49 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{EmbedViewer
{|
|rle = 3o$o2bo12bo$3o3b3o2b3o2bobo$o2bo2bobo2bobo2b2o$3o3b3o2b3o2bobo!
|{{EmbedViewer
|rle         = 3o$o2bo12bo$3o3b3o2b3o2bobo$o2bo2bobo2bobo2b2o$3o3b3o2b3o2bobo!
|position    = center
|position    = center
|viewerconfig = #C [[ THUMBSIZE 2 ]]
|viewerconfig = #C [[ THUMBSIZE 2 ]]
|caption      = Lifespan 4700
|caption      = Lifespan 4700
}}
}}
|}


=Under Construction=
[https://catagolue.hatsya.com/object/xp0_book/b3s23 xp0_book]
This is my sandbox.


=Tutorial/LifeViewer Plug-in=
*[[User:Book/Sandbox|My sandbox]]
*[[User:Book/Sandbox/WIP]]
*[[User:Book/Sandbox/WIP2]]


==Getting Started: Download the LifeViewer plug-in==
==Principles for Editing the Wiki==
*Use this link: [http://lazyslug.com/lifeview/plugin/js/release/ download]
*The wiki should be authoritative and substantive
*The javascript code will be displayed in your browser
*The wiki should be welcoming to the uninitiated and casual user as well as the expert
*Do a "Save" or "Save as..." and save lv-plugin.js where you want it
*Err on the side of explaining concepts and terminology
*In this tutorial, we assume the plug-in is in the same folder as your html file
*Err on the side of giving/showing examples
*CGOL is visual: show stuff
*Avoid dead links as much as possible (shed the red)
*Upload missing pattern static images
===Missing image report===
{{Purge}} {{#dpl:category=Pages with broken file links|notnamespace=User|notnamespace=Talk}}


==Lesson 1: Hello World--web page with glider in viewer==
==Toolkit==
[[image:tutoriallvpluginex1.png|framed|350px]]
[https://golhobby.com/ Use these tools here]
*A simple web page with a glider in a LifeViewer
*Pattern Manager (PatMan)
*Paste the code below in your text editor, save it and run it
**Organize your patterns
<pre>
**View them in LifeViewer
&lt;!DOCTYPE html>
*Pattern Lookup
&lt;html>
**Look up a pattern by name and/or apgcode
&lt;head>
**View it in Catagolue
&lt;meta name="LifeViewer" content="viewer textarea"> &lt;!--required tag-->
**View it in LifeWiki
&lt;script src="lv-plugin.js">&lt;/script> &lt;!--assumes plug-in is in the same directory as html file-->
**View it in LifeViewer
&lt;/head>
**Get its RLE
&lt;body>
*Tidy RLE
&lt;!--viewer container-->
**Replaces enhanced RLE characters with o's and b's
&lt;div class="viewer"> &lt;!--class=viewer is required-->
**Removes trailing b's from rows
&lt;textarea>bo$2bo$3o!&lt;/textarea>&lt;br/> &lt;!--textarea required in viewer container, with glider rle-->
**Compresses repeating characters (e.g. 3ooo2o becomes 7o)
&lt;canvas></canvas> &lt;!--canvas required in viewer container-->
**Assures each line is ≤70 characters but as close to 70 as possible and does not end in a number
&lt;/div>
**Calculates bounding box
&lt;!--end viewer container-->
*IMG to RLE - get an RLE from a pattern image
&lt;/body>
*RLE to PNG - get a static png file from an RLE
&lt;/html>
*RLE to SVG - get a static svg file from an RLE
</pre>
*RLE to Plaintext - convert an RLE to plaintext
 
*Plaintext to 2RLE - convert plaintext to an RLE
==Lesson 2: Add some style==
**Also handles 1 and 0 as well as O and .
[[image:tutoriallvpluginex2.png|framed|350px]]
**Also handles Life 1.05 (* and .)
*Size the textarea, change font, make it non-resizable
*Apgcode to PNG - get a static png file from an apgcode
*Size viewer by sizing canvas using inline width and height attributes (not CSS)
*Apgcode to RLE - convert an apgcode to an RLE
*Align viewer and textarea
*Integer to Life Digits RLE - convert an integer to a Life Digits RLE
*Note the textarea needs to be a few pixels narrower to properly align
*Frequency Class Calculator
<pre>
*Frequency Calculator (from FC)
&lt;!DOCTYPE html>
&lt;html>
&lt;head>
&lt;meta name="LifeViewer" content="viewer textarea"> &lt;!--required tag-->
&lt;script src="lv-plugin.js">&lt;/script> &lt;!--assumes plug-in is in the same directory as html file-->
&lt;style>
body{
margin:50px;
}
.lv-rle{
font:12pt arial;
resize:none;
width:594px;
min-height:120px;
max-height:120px;
}
&lt;/style>
&lt;/head>
&lt;body>
&lt;!--viewer container-->
&lt;div class="viewer">
&lt;textarea class="lv-rle">bo$2bo$3o!&lt;/textarea>&lt;br/> &lt;!--added classname for styling-->
&lt;canvas height=400 width=600>&lt;/canvas> &lt;!--added width and height attributes for viewer-->
&lt;/div>
&lt;!--end viewer container-->
&lt;/body>
&lt;/html>
</pre>
 
==Lesson 3: Update viewer with user input==
[[image:tutoriallvpluginex3.png|framed|350px]]
*Add control buttons to clear the textarea and update the viewer with user-entered rle
*The rle may be entered manually or pasted into the textarea
*The element that calls the updateMe function (button, link, whatever) must be in the viewer container
<pre>
&lt;meta name="LifeViewer" content="viewer textarea"> &lt;!--required tag-->
&lt;script src="lv-plugin.js">&lt;/script> &lt;!--assumes plug-in is in the same directory as html file-->
&lt;style>
body{
margin:50px;
}
button{
font:12pt arial;
}
.lv-rle{
resize:none;
width:594px;
min-height:120px;
max-height:120px;
font:12pt arial;
}
.lv-buttons{
margin-bottom:4px;
}
&lt;/style>
&lt;/head>
&lt;body>
&lt;!--viewer container-->
&lt;div class="viewer">
&lt;div class="lv-buttons">
&lt;button onclick="document.getElementById('lv-text').innerHTML=''">Clear&lt;/button>
&lt;button onclick="updateMe(this)">Show in Viewer&lt;/button>
&lt;!--the element that calls updateMe must be in the viewer container-->
&lt;/div>
&lt;textarea class="lv-rle" id="lv-text">o2bo3bo$o2bobobo$4o3bo$o2bobo$o2bobobo!&lt;/textarea>&lt;br/>
&lt;canvas height=400 width=600>&lt;/canvas>
&lt;/div>
&lt;!--end viewer container-->
&lt;/body>
&lt;/html>
</pre>
 
==Lesson 4: Hide the textarea==
[[image:tutoriallvpluginex4.png|framed|350px]]
*Used when you only want to display a specific pattern in a LifeViewer
*This is done my moving the textarea containing the rle off the visible page using absolute positioning and setting the top to a negative number
*The textarea tag must remain inside the viewer container
<pre>
&lt;meta name="LifeViewer" content="viewer textarea"> &lt;!--required tag-->
&lt;script src="lv-plugin.js">&lt;/script> &lt;!--assumes plug-in is in the same directory as html file-->
&lt;style>
body{
margin:50px;
}
.lv-rle{
position:absolute;
top:-1000px;
}
&lt;/style>
&lt;/head>
&lt;body>
&lt;!--viewer container-->
&lt;div class="viewer">
&lt;textarea class="lv-rle">bo$2bo$3o!&lt;/textarea>
&lt;!--hide the textarea by moving it off the visible page with css-->
&lt;!--note the textarea element's tag must stay within the viewer container-->
&lt;canvas height=400 width=600>&lt;/canvas>
&lt;/div>
&lt;!--end viewer container-->
&lt;/body>
&lt;/html>
</pre>
 
==Lesson 5: Tips &amp; Tricks==
*To disable user input in a textarea, add the readonly attribute: &lt;textarea readonly>whatever&lt;/textarea>
*You can put multiple LifeViewers on a single page; each must have its own &lt;div> container with its own &lt;textarea> and <canvas> inside
*RLEs can control the viewer using [[LifeViewer#Scripts|LifeViewer scripts]]

Latest revision as of 20:06, 17 February 2023

3o$o2bo12bo$3o3b3o2b3o2bobo$o2bo2bobo2bobo2b2o$3o3b3o2b3o2bobo! #C [[ THUMBSIZE 2 THEME 6 GRID GRIDMAJOR 0 SUPPRESS THUMBLAUNCH ]] #C [[ THUMBSIZE 2 ]]
Lifespan 4700
(click above to open LifeViewer)

xp0_book

Principles for Editing the Wiki

  • The wiki should be authoritative and substantive
  • The wiki should be welcoming to the uninitiated and casual user as well as the expert
  • Err on the side of explaining concepts and terminology
  • Err on the side of giving/showing examples
  • CGOL is visual: show stuff
  • Avoid dead links as much as possible (shed the red)
  • Upload missing pattern static images

Missing image report

Purge the cache of this page or consider doing a null edit

Toolkit

Use these tools here

  • Pattern Manager (PatMan)
    • Organize your patterns
    • View them in LifeViewer
  • Pattern Lookup
    • Look up a pattern by name and/or apgcode
    • View it in Catagolue
    • View it in LifeWiki
    • View it in LifeViewer
    • Get its RLE
  • Tidy RLE
    • Replaces enhanced RLE characters with o's and b's
    • Removes trailing b's from rows
    • Compresses repeating characters (e.g. 3ooo2o becomes 7o)
    • Assures each line is ≤70 characters but as close to 70 as possible and does not end in a number
    • Calculates bounding box
  • IMG to RLE - get an RLE from a pattern image
  • RLE to PNG - get a static png file from an RLE
  • RLE to SVG - get a static svg file from an RLE
  • RLE to Plaintext - convert an RLE to plaintext
  • Plaintext to 2RLE - convert plaintext to an RLE
    • Also handles 1 and 0 as well as O and .
    • Also handles Life 1.05 (* and .)
  • Apgcode to PNG - get a static png file from an apgcode
  • Apgcode to RLE - convert an apgcode to an RLE
  • Integer to Life Digits RLE - convert an integer to a Life Digits RLE
  • Frequency Class Calculator
  • Frequency Calculator (from FC)