kopia lustrzana https://github.com/backface/turtlestitch
				
				
				
			
							rodzic
							
								
									b633844894
								
							
						
					
					
						commit
						5a8a655aa6
					
				| 
						 | 
				
			
			@ -8,7 +8,6 @@ word-sentence.xml	Words, sentences	One of the big ideas in Logo that they left o
 | 
			
		|||
cases.xml	Multi-branched conditional (switch)	Like "switch" in C-like languages or "cond" in Lisp.  Thanks to Nathan Dinsmore for inventing the idea of a separate block for each branch!
 | 
			
		||||
leap-library.xml	LEAP Motion controller	Report hand positions from LEAP Motion controller (leapmotion.com).
 | 
			
		||||
setrgb.xml	Set RGB or HSV pen color	Set or report pen color as RGB (red, blue, green) or HSV (hue, saturation, value).
 | 
			
		||||
penTrails.xml	Save and restore pictures drawn by pen	Save and restore lines drawn and costumes stamped on the stage, or make a sprite costume from saved pen trails.
 | 
			
		||||
try-catch.xml	Catch errors in a script	Run a script; if an error happens, instead of stopping the script with a red halo, run another script to handle the error. Also includes a block to cause an error with a message given as input. Also includes a block to create a script variable and give it a value.
 | 
			
		||||
multiline.xml	Allow multi-line text input to a block	In general, text inputs allow only a single line.  The MULTILINE block accepts multi-line text input and can be used in text input slots of other blocks.
 | 
			
		||||
Eisenbergification.xml	Provide getters and setters for all GUI-controlled global settings	Eisenberg's Law: Anything that can be done from the GUI should be doable from the programming language, and vice versa.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
<blocks app="Snap! 4.0, http://snap.berkeley.edu" version="1"><block-definition s="label %'text' of size %'size'" type="command" category="pen"><comment x="0" y="0" w="90" collapsed="false">LABEL will stamp text on the stage at the given font size. The direction of the text is the direction the sprite is facing, and color will match the pen color.</comment><header></header><code></code><inputs><input type="%txt">Hello!</input><input type="%n">12</input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>text</l><l>size</l></list><l>var stage = this.parentThatIsA(StageMorph),
    context = stage.penTrails().getContext('2d'),
    rotation = radians(this.direction() - 90),
    trans = new Point(
      this.center().x - stage.left(),
      this.center().y - stage.top()
    ),
    isWarped = this.Warped,
    len,
    pos;

if (isWarped) {endWarp(); }
context.save();
context.font = size + 'px monospace';
context.textAlign = 'left';
context.textBaseline = 'alphabetic';
context.fillStyle = this.color.toString();
len = context.measureText(text).width;
trans = trans.multiplyBy(1 / stage.scale);
context.translate(trans.x, trans.y);
context.rotate(rotation);
context.fillText(text, 0, 0);
context.translate(-trans.x, -trans.y);
context.restore();
pos = new Point(
  len * Math.sin(radians(this.direction())),
  len * Math.cos(radians(this.direction())));
pos = pos.add(new Point(this.xPosition(), this.yPosition()));
this.gotoXY(pos.x, pos.y, false);
this.changed();
if (isWarped) {this.startWarp(); }
stage.changed();</l></block><list><block var="text"/><block var="size"/></list></block></script></block-definition><block-definition s="button %'text'" type="command" category="pen"><comment x="0" y="0" w="176" collapsed="false">Make a new sprite, have it run this block to turn into a button.  This will clear anything drawn on the stage.</comment><header></header><code></code><inputs><input type="%s">Push me!</input></inputs><script><block s="clear"></block><block s="up"></block><block s="gotoXY"><l>0</l><l>0</l></block><block s="setHeading"><l>90</l></block><block s="setColor"><color>3,0,0,1</color></block><custom-block s="label %txt of size %n"><block var="text"/><l>30</l></custom-block><block s="doDeclareVariables"><list><l>width</l></list></block><block s="doSetVar"><l>width</l><block s="xPosition"></block></block><block s="gotoXY"><l>0</l><l>10</l></block><block s="setColor"><color>251,255,13,1</color></block><block s="setSize"><l>30</l></block><block s="down"></block><block s="forward"><block var="width"/></block><block s="up"></block><block s="setSize"><l>1</l></block><block s="setColor"><color>3,0,0,1</color></block><block s="gotoXY"><l>0</l><l>0</l></block><custom-block s="label %txt of size %n"><block var="text"/><l>30</l></custom-block><custom-block s="make costume named %s from pen trail %s"><block var="text"/><custom-block s="pen trails"></custom-block></custom-block><block s="gotoXY"><l>0</l><l>0</l></block><block s="clear"></block></script></block-definition><block-definition s="pen trails" type="reporter" category="pen"><header></header><code></code><inputs></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list></list><l>var cst = new Costume(
  this.parentThatIsA(StageMorph).trailsCanvas
);
cst.shrinkWrap();
return cst;</l></block><list></list></block></block></script></block-definition><block-definition s="set pen trails to: %'costume'" type="command" category="pen"><header></header><code></code><inputs><input type="%s" readonly="true"></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>cst</l></list><l>var stage = this.parentThatIsA(StageMorph);
stage.trailsCanvas = cst.contents;
stage.changed();</l></block><list><block var="costume"/></list></block></script></block-definition><block-definition s="make costume named %'name' from pen trail %'trail'" type="command" category="looks"><header></header><code></code><inputs><input type="%s">pen trail</input><input type="%s"></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>name</l><l>trail</l></list><l>trail.name = this.newCostumeName(name, null);
this.addCostume(trail);
this.wearCostume(trail);</l></block><list><block var="name"/><block var="trail"/></list></block></script></block-definition></blocks>
 | 
			
		||||
		Ładowanie…
	
		Reference in New Issue