kopia lustrzana https://github.com/backface/turtlestitch
1 wiersz
14 KiB
XML
1 wiersz
14 KiB
XML
<blocks app="Snap! 4.1, 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><translations>de:drucke _ in Größe _
</translations><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="empty? %'data'" type="predicate" category="lists"><header></header><code></code><translations>de:ist _ leer?
</translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportEquals"><block var="data"/><block s="reportNewList"><list></list></block></block></block></script></block-definition><block-definition s="keep items such that %'pred' from %'data'" type="reporter" category="lists"><header></header><code></code><translations>de:behalte Elemente, die _ aus _
</translations><inputs><input type="%predRing"></input><input type="%l"></input></inputs><script><block s="doIf"><custom-block s="empty? %l"><block var="data"/></custom-block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doIfElse"><block s="evaluate"><block var="pred"/><list><block s="reportListItem"><l>1</l><block var="data"/></block></list></block><script><block s="doReport"><block s="reportCONS"><block s="reportListItem"><l>1</l><block var="data"/></block><custom-block s="keep items such that %predRing from %l"><block var="pred"/><block s="reportCDR"><block var="data"/></block></custom-block></block></block></script><script><block s="doReport"><custom-block s="keep items such that %predRing from %l"><block var="pred"/><block s="reportCDR"><block var="data"/></block></custom-block></block></script></block></script></block-definition><block-definition s="combine with %'function' items of %'data'" type="reporter" category="lists"><header></header><code></code><translations>de:kombiniere mit _ die Elemente von _
</translations><inputs><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doIf"><custom-block s="empty? %l"><block s="reportCDR"><block var="data"/></block></custom-block><script><block s="doReport"><block s="reportListItem"><l>1</l><block var="data"/></block></block></script></block><block s="doReport"><block s="evaluate"><block var="function"/><list><block s="reportListItem"><l>1</l><block var="data"/></block><custom-block s="combine with %repRing items of %l"><block var="function"/><block s="reportCDR"><block var="data"/></block></custom-block></list></block></block></script></block-definition><block-definition s="if %'test' then %'true' else %'false'" type="reporter" category="control"><header></header><code></code><translations>de:wenn _ dann _ sonst _
</translations><inputs><input type="%b"></input><input type="%anyUE"></input><input type="%anyUE"></input></inputs><script><block s="doIfElse"><block var="test"/><script><block s="doReport"><block s="evaluate"><block var="true"/><list></list></block></block></script><script><block s="doReport"><block s="evaluate"><block var="false"/><list></list></block></block></script></block></script></block-definition><block-definition s="for %'i' = %'start' to %'end' %'action'" type="command" category="control"><header></header><code></code><translations>de:für _ = _ bis _ _
</translations><inputs><input type="%upvar"></input><input type="%n">1</input><input type="%n">10</input><input type="%cs"></input></inputs><script><block s="doDeclareVariables"><list><l>step</l><l>tester</l></list></block><block s="doIfElse"><block s="reportGreaterThan"><block var="start"/><block var="end"/></block><script><block s="doSetVar"><l>step</l><l>-1</l></block><block s="doSetVar"><l>tester</l><block s="reifyReporter"><autolambda><block s="reportLessThan"><block var="i"/><block var="end"/></block></autolambda><list></list></block></block></script><script><block s="doSetVar"><l>step</l><l>1</l></block><block s="doSetVar"><l>tester</l><block s="reifyReporter"><autolambda><block s="reportGreaterThan"><block var="i"/><block var="end"/></block></autolambda><list></list></block></block></script></block><block s="doSetVar"><l>i</l><block var="start"/></block><block s="doUntil"><block s="evaluate"><block var="tester"/><list></list></block><script><block s="doRun"><block var="action"/><list></list></block><block s="doChangeVar"><l>i</l><block var="step"/></block></script></block></script></block-definition><block-definition s="join words %'words'" type="reporter" category="operators"><header></header><code></code><translations>de:füge Wörter zusammen _
</translations><inputs><input type="%mult%txt"></input></inputs><script><block s="doIf"><custom-block s="empty? %l"><block s="reportCDR"><block var="words"/></block></custom-block><script><block s="doReport"><block s="reportListItem"><l>1</l><block var="words"/></block></block></script></block><block s="doIf"><block s="reportEquals"><l></l><block s="reportListItem"><l>1</l><block var="words"/></block></block><script><block s="doReport"><custom-block s="join words %mult%txt"><list><l></l></list></custom-block></block></script></block><block s="doIf"><block s="reportEquals"><l></l><block s="reportListItem"><l>2</l><block var="words"/></block></block><script><block s="doReport"><custom-block s="join words %mult%txt"><list><l></l></list></custom-block></block></script></block><block s="doReport"><block s="reportJoinWords"><list><block s="reportListItem"><l>1</l><block var="words"/></block><l> </l><custom-block s="join words %mult%txt"><list><l></l></list></custom-block></list></block></block></script><scripts><script x="229.000003" y="196.77778077777765"><block s="reportJoinWords"><list><l></l><l></l></list></block></script></scripts></block-definition><block-definition s="list $arrowRight sentence %'data'" type="reporter" category="operators"><header></header><code></code><translations>de:Liste $arrowRight Satz _
</translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><custom-block s="join words %mult%txt"><list><l></l></list></custom-block></block></script></block-definition><block-definition s="sentence $arrowRight list %'text'" type="reporter" category="operators"><header></header><code></code><translations>de:Satz $arrowRight Liste _
</translations><inputs><input type="%txt"></input></inputs><script><block s="doReport"><block s="reportTextSplit"><block var="text"/><l><option>whitespace</option></l></block></block></script></block-definition><block-definition s="catch %'tag' %'action'" type="command" category="control"><header></header><code></code><translations>de:fange _ _
</translations><inputs><input type="%upvar"></input><input type="%cs"></input></inputs><script><block s="doCallCC"><block s="reifyScript"><script><block s="doSetVar"><l>tag</l><block var="cont"/></block><block s="doRun"><block var="action"/><list></list></block></script><list><l>cont</l></list></block></block><custom-block s="ignore %s"><l>3</l></custom-block></script></block-definition><block-definition s="throw %'cont'" type="command" category="control"><header></header><code></code><translations>de:wirf _
</translations><inputs><input type="%s">catchtag</input></inputs><script><block s="doRun"><block var="cont"/><list></list></block></script></block-definition><block-definition s="catch %'tag' %'value'" type="reporter" category="control"><header></header><code></code><translations>de:fange _ _
</translations><inputs><input type="%upvar"></input><input type="%anyUE"></input></inputs><script><block s="doCallCC"><block s="reifyScript"><script><block s="doSetVar"><l>tag</l><block var="cont"/></block><block s="doReport"><block s="evaluate"><block var="value"/><list></list></block></block></script><list><l>cont</l></list></block></block></script></block-definition><block-definition s="throw %'tag' %'value'" type="command" category="control"><header></header><code></code><translations>de:wirf _ _
</translations><inputs><input type="%s">catchtag</input><input type="%s"></input></inputs><script><block s="doRun"><block var="tag"/><list><block var="value"/></list></block></script></block-definition><block-definition s="for each %'item' of %'data' %'action'" type="command" category="lists"><header></header><code></code><translations>de:für jedes _ von _ _
</translations><inputs><input type="%upvar"></input><input type="%l"></input><input type="%cs"></input></inputs><script><block s="doUntil"><custom-block s="empty? %l"><block var="data"/></custom-block><script><block s="doSetVar"><l>item</l><block s="reportListItem"><l>1</l><block var="data"/></block></block><block s="doRun"><block var="action"/><list><block s="reportListItem"><l>1</l><block var="data"/></block></list></block><block s="doSetVar"><l>data</l><block s="reportCDR"><block var="data"/></block></block></script></block></script></block-definition><block-definition s="if %'test' do %'action' and pause all $pause-1-255-220-0" type="command" category="control"><header></header><code></code><translations>de:falls _ dann _ und pause $pause-1-255-220-0
</translations><inputs><input type="%boolUE"></input><input type="%cs"></input></inputs><script><block s="doDeclareVariables"><list><l>breakpoint</l></list></block><block s="doIf"><block s="evaluate"><block var="test"/><list></list></block><script><block s="doSetVar"><l>breakpoint</l><block var="test"/></block><block s="doShowVar"><l>breakpoint</l></block><block s="doRun"><block var="action"/><list></list></block><block s="doPauseAll"></block><block s="doHideVar"><l></l></block></script></block></script></block-definition><block-definition s="word $arrowRight list %'word'" type="reporter" category="operators"><header></header><code></code><translations>de:Wort $arrowRight Liste _
</translations><inputs><input type="%txt"></input></inputs><script><block s="doReport"><block s="reportTextSplit"><block var="word"/><l><option>letter</option></l></block></block></script></block-definition><block-definition s="ignore %'x'" type="command" category="control"><header></header><code></code><translations>de:ignoriere _
</translations><inputs><input type="%s"></input></inputs></block-definition><block-definition s="list $arrowRight word %'list'" type="reporter" category="operators"><header></header><code></code><translations>de:Liste $arrowRight Wort _
</translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportJoinWords"><block var="list"/></block></block></script></block-definition><block-definition s="%'x'" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doReport"><block var="x"/></block></script></block-definition><block-definition s="numbers from %'from' to %'to'" type="reporter" category="lists"><header></header><code></code><translations>de:Zahlen von _ bis _
</translations><inputs><input type="%n">1</input><input type="%n">10</input></inputs><script><block s="doIf"><block s="reportGreaterThan"><block var="from"/><block var="to"/></block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doReport"><block s="reportCONS"><block var="from"/><custom-block s="numbers from %n to %n"><block s="reportSum"><block var="from"/><l>1</l></block><block var="to"/></custom-block></block></block></script></block-definition><block-definition s="map %'func' over %'data'" type="reporter" category="lists"><header></header><code></code><translations>de:wende _ an auf _
</translations><inputs><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doIf"><custom-block s="empty? %l"><block var="data"/></custom-block><script><block s="doReport"><block var="data"/></block></script></block><block s="doReport"><block s="reportCONS"><block s="evaluate"><block var="func"/><list><block s="reportListItem"><l>1</l><block var="data"/></block></list></block><custom-block s="map %repRing over %l"><block var="func"/><block s="reportCDR"><block var="data"/></block></custom-block></block></block></script></block-definition></blocks> |