2017-09-28 08:48:32 +00:00
<blocks app= "Snap! 4.1, http://snap.berkeley.edu" version= "1" > <block-definition s= "id %'arg'" type= "reporter" category= "operators" > <header > </header> <code > </code> <inputs > <input type= "%n" > </input> </inputs> <script > <block s= "doReport" > <block var= "arg" /> </block> </script> </block-definition> <block-definition s= "if %'test' then %'true' else %'false'" type= "reporter" category= "control" > <header > </header> <code > </code> <inputs > <input type= "%b" > </input> <input type= "%anyUE" > </input> <input type= "%anyUE" > </input> </inputs> <script > <block s= "doIf" > <block var= "test" /> <script > <block s= "doReport" > <block s= "evaluate" > <block var= "true" /> <list > </list> </block> </block> </script> </block> <block s= "doReport" > <block s= "evaluate" > <block var= "false" /> <list > </list> </block> </block> </script> </block-definition> <block-definition s= "-- %'n'" type= "reporter" category= "variables" > <header > </header> <code > </code> <inputs > <input type= "%anyUE" readonly= "true" > </input> </inputs> <script > <block s= "doRun" > <block s= "reifyScript" > <script > <block s= "doChangeVar" > <l > </l> <l > -1</l> </block> </script> <list > </list> </block> <list > <block var= "n" /> </list> </block> <block s= "doReport" > <block s= "evaluate" > <block var= "n" /> <list > </list> </block> </block> </script> </block-definition> <block-definition s= "animate setter %'setter' getter %'getter' delta %'delta' over %'duration' secs easing %'easing'" type= "command" category= "control" > <header > </header> <code > </code> <inputs > <input type= "%cmdRing" > </input> <input type= "%repRing" > </input> <input type= "%n" > 50</input> <input type= "%n" > 1</input> <input type= "%repRing" > </input> </inputs> <script > <block s= "doDeclareVariables" > <list > <l > end time</l> <l > destination</l> </list> </block> <block s= "doSetVar" > <l > end time</l> <block s= "reportSum" > <block s= "reportDate" > <l > <option > time in milliseconds</option> </l> </block> <block s= "reportProduct" > <block var= "duration" /> <l > 1000</l> </block> </block> </block> <block s= "doSetVar" > <l > destination</l> <block s= "reportSum" > <block s= "evaluate" > <block var= "getter" /> <list > </list> </block> <block var= "delta" /> </block> </block> <block s= "doUntil" > <block s= "reportGreaterThan" > <block s= "reportDate" > <l > <option > time in milliseconds</option> </l> </block> <block var= "end time" /> </block> <script > <block s= "doRun" > <block var= "setter" /> <list > <block s= "reportDifference" > <block var= "destination" /> <block s= "reportProduct" > <block var= "delta" /> <block s= "evaluate" > <block var= "easing" /> <list > <block s= "reportQuotient" > <block s= "reportDifference" > <block var= "end time" /> <block s= "reportDate" > <l > <option > time in milliseconds</option> </l> </block> </block> <block s= "reportProduct" > <block var= "duration" /> <l > 1000</l> </block> </block> </list> </block> </block> </block> </list> </block> </script> </block> <block s= "doRun" > <block var= "setter" /> <list > <block var= "destination" /> </list> </block> </script> </block-definition> <block-definition s= "%'a' raised to %'b'" type= "reporter" category= "operators" > <header > </header> <code > </code> <inputs > <input type= "%n" > </input> <input type= "%n" > </input> </inputs> <script > <block s= "doReport" > <block s= "reportMonadic" > <l > <option > e^</option> </l> <block s= "reportProduct" > <block var= "b" /> <block s= "reportMonadic" > <l > <option > ln</option> </l> <block var= "a" /> </block> </block> </block> </block> </script> </block-definition> <block-definition s= "PI" type= "reporter" category= "operators" > <header > </header> <code > </code> <inputs > </inputs> <script > <block s= "doReport" > <l > 3.141592653589793</l> </block> </script> </block-definition> <block-definition s= "degrees %'radians'" type= "reporter" category= "operators" > <header > </header> <code > </code> <inputs > <input type= "%n" > 0.5</input> </inputs> <script > <block s= "doReport" > <block s= "reportQuotient" > <block s= "reportProduct" > <block var= "radians" /> <l > 180</l> </block> <custom-block s= "PI" > </custom-block> </block> </block> </script> </block-definition> <block-definition s= "easing %'choice'" type= "reporter" category= "operators" > <variables > <list id= "143" > <item > <l > table</l> </item> </list> </variables> <header > </header> <code > </code> <inputs > <input
quadratic={
quadratic-in
quadratic-out
quadratic-in-out
}
cubic={
cubic-in
cubic-out
cubic-in-out
}
quart={
quart-in
quart-out
quart-in-out
}
sinusoidal={
sine-in
sine-out
sine-in-out
}
elastic</options> </input> </inputs> <script > <block s= "doIf" > <block s= "reportNot" > <block s= "reportIsA" > <block var= "table" /> <l > <option > list</option> </l> </block> </block> <script > <block s= "doSetVar" > <l > table</l> <block s= "reportNewList" > <list > <block s= "reportNewList" > <list > <l > linear</l> <block s= "reifyReporter" > <autolambda > <custom-block s= "id %n" > <l > </l> </custom-block> </autolambda> <list > </list> </block> </list> </block> <block s= "reportNewList" > <list > <l > quadratic-in</l> <block s= "reifyReporter" > <autolambda > <block s= "reportProduct" > <l > </l> <l > </l> </block> </autolambda> <list > </list> </block> </list> </block> <block s= "reportNewList" > <list > <l > quadratic-out</l> <block s= "reifyReporter" > <autolambda > <block s= "reportProduct" > <l > </l> <block s= "reportDifference" > <l > 2</l> <l > </l> </block> </block> </autolambda> <list > </list> </block> </list> </block> <block s= "reportNewList" > <list > <l > quadratic-in-out</l> <block s= "reifyReporter" > <autolambda > <custom-block s= "if %b then %anyUE else %anyUE" > <block s= "reportLessThan" > <l > </l> <l > .5</l> </block> <block s= "reportProduct" > <l > 2</l> <block s= "reportProduct" > <l > </l> <l > </l> </block> </block> <block s= "reportDifference" > <block s= "reportProduct" > <block s= "reportDifference" > <l > 4</l> <block s= "reportProduct" > <l > 2</l> <l > </l> </block> </block> <l > </l> </block> <l > 1</l> </block> </custom-block> </autolambda> <list > </list> </block> </list> </block> <block s= "reportNewList" > <list > <l > cubic-in</l> <block s= "reifyReporter" > <autolambda > <block s= "reportProduct" > <l > </l> <block s= "reportProduct" > <l > </l> <l > </l> </block> </block> </autolambda> <list > </list> </block> </list> </block> <block s= "reportNewList" > <list > <l > cubic-out</l> <block s= "reifyReporter" > <autolambda > <block s= "reportSum" > <block s= "reportProduct" > <block s= "reportProduct" > <custom-block s= "-- %anyUE" > <block var= "t" /> </custom-block> <block var= "t" /> </block> <block var= "t" /> </block> <l > 1</l> </block> </autolambda> <list > <l > t</l> </list> </block> </list> </block> <block s= "reportNewList" > <list > <l > cubic-in-out</l> <block s= "reifyReporter" > <autolambda > <custom-block s= "if %b then %anyUE else %anyUE" > <block s= "reportLessThan" > <l > </l> <l > .5</l> </block> <block s= "reportProduct" > <l > 4</l> <block s= "reportProduct" > <l > </l> <block s= "reportProduct" > <l > </l> <l > </l> </block> </block> </block> <block s= "reportSum" > <block s= "reportProduct" > <block s= "reportProduct" > <block s= "reportDifference" > <l > </l> <l > 1</l> </block> <block s= "reportDifference" > <block s= "reportProduct" > <l > 2</l> <l > </l> </block> <l > 2</l> </block> </block> <block s= "reportDifference" > <block s= "reportProduct" > <l > 2</l> <l > </l> </block> <l > 2</l> </block> </block> <l > 1</l> </block> </custom-block> </autolambda> <list > </list> </block> </list> </block> <block s= "reportNewList" > <list > <l > quart-in</l> <block s= "reifyReporter" > <autolambda > <block s= "reportProduct" > <l > </l> <block s= "reportProduct" > <l > </l> <block s= "reportProduct" > <l > </l> <l > </l> </block> </block> </block> </autolambda> <list > </list> </block> </list> </block> <block s= "reportNewList" > <list > <l > quart-out</l> <block s= "reifyReporter" > <autolambda > <block s= "reportDifference" > <l > 1</l> <block s= "reportProduct" > <custom-block s= "-- %anyUE" > <block var= "t" /> </custom-block> <block s= "reportProduct" > <block var= "t" /> <block s= "reportProduct" > <block var= "t" /> <block var= "t" /> </block> </block> </block> </block> </autolambda> <list > <l > t</l> </list> </block> </list> </block> <block s= "reportNewList" > <list > <l > quart-in-out</l> <block s= "reifyReporter" > <autolambda > <custom-block s= "if %b then %anyUE else %anyUE" > <block s= "reportLessThan" > <l > </l> <l > .5</l> </block> <block s= "reportProduct" > <l > 8</l> <block s= "reportProduct" > <l > </l> <block s= "reportProduct" > <l > </l> <block s= "reportProduct" > <l > </l> <l > </l> </block> </block> </block> </block> <block s= "evaluate" > <block s= "reifyReporter" > <autolambda > <block s= "reportDifference" > <l > 1</l> <block s= "reportProduct" > <l > 8</l> <block s= "reportProduct" > <custom-block s= "-- %anyUE" > <block var= "t" /> </custom-block> <block s= "reportProduct" > <block var= "t" /> <block s= "reportProduct" > <block var= "t" /> <block var= "t" /> </block> </block> </block> </block> </block> </autolambda> <list > <l > t</l> </list> </block> <list > <l > </l> </list> </block> </custom-block> </autolambda> <list > </list> </block> </list> </block> <b
quadratic={
quadratic-in
quadratic-out
quadratic-in-out
}
cubic={
cubic-in
cubic-out
cubic-in-out
}
quart={
quart-in
quart-out
quart-in-out
}
sinusoidal={
sine-in
sine-out
sine-in-out
}
2017-10-04 14:27:48 +00:00
elastic</options> </input> </inputs> <script > <block s= "doDeclareVariables" > <list > <l > destX</l> <l > destY</l> <l > end time</l> <l > deltaX</l> <l > deltaY</l> <l > func</l> </list> </block> <block s= "forward" > <block var= "steps" /> </block> <block s= "doSetVar" > <l > destX</l> <block s= "xPosition" > </block> </block> <block s= "doSetVar" > <l > destY</l> <block s= "yPosition" > </block> </block> <block s= "forward" > <block s= "reportProduct" > <block var= "steps" /> <l > -1</l> </block> </block> <block s= "doSetVar" > <l > end time</l> <block s= "reportSum" > <block s= "reportDate" > <l > <option > time in milliseconds</option> </l> </block> <block s= "reportProduct" > <block var= "duration" /> <l > 1000</l> </block> </block> </block> <block s= "doSetVar" > <l > deltaX</l> <block s= "reportDifference" > <block var= "destX" /> <block s= "xPosition" > </block> </block> </block> <block s= "doSetVar" > <l > deltaY</l> <block s= "reportDifference" > <block var= "destY" /> <block s= "yPosition" > </block> </block> </block> <block s= "doIfElse" > <block s= "reportIsA" > <block var= "easing" /> <l > <option > reporter</option> </l> </block> <script > <block s= "doSetVar" > <l > func</l> <block var= "easing" /> </block> </script> <script > <block s= "doSetVar" > <l > func</l> <custom-block s= "easing %txt" > <block var= "easing" /> </custom-block> </block> </script> </block> <block s= "doUntil" > <block s= "reportGreaterThan" > <block s= "reportDate" > <l > <option > time in milliseconds</option> </l> </block> <block var= "end time" /> </block> <script > <block s= "setXPosition" > <block s= "reportDifference" > <block var= "destX" /> <block s= "reportProduct" > <block var= "deltaX" /> <block s= "evaluate" > <block var= "func" /> <list > <block s= "reportQuotient" > <block s= "reportDifference" > <block var= "end time" /> <block s= "reportDate" > <l > <option > time in milliseconds</option> </l> </block> </block> <block s= "reportProduct" > <block var= "duration" /> <l > 1000</l> </block> </block> </list> </block> </block> </block> </block> <block s= "setYPosition" > <block s= "reportDifference" > <block var= "destY" /> <block s= "reportProduct" > <block var= "deltaY" /> <block s= "evaluate" > <block var= "func" /> <list > <block s= "reportQuotient" > <block s= "reportDifference" > <block var= "end time" /> <block s= "reportDate" > <l > <option > time in milliseconds</option> </l> </block> </block> <block s= "reportProduct" > <block var= "duration" /> <l > 1000</l> </block> </block> </list> </block> </block> </block> </block> </script> </block> <block s= "gotoXY" > <block var= "destX" /> <block var= "destY" /> </block> </script> </block-definition> <block-definition s= "animate %'attribute' by %'delta' in %'duration' secs easing %'easing'" type= "command" category= "motion" > <header > </header> <code > </code> <inputs > <input type= "%s" readonly= "true" > x position<options > x position
2017-09-28 08:48:32 +00:00
y position
direction
size</options> </input> <input type= "%n" > 50</input> <input type= "%n" > 1</input> <input type= "%s" readonly= "true" > linear<options > linear
quadratic={
quadratic-in
quadratic-out
quadratic-in-out
}
cubic={
cubic-in
cubic-out
cubic-in-out
}
quart={
quart-in
quart-out
quart-in-out
}
sinusoidal={
sine-in
sine-out
sine-in-out
}
2017-10-04 14:27:48 +00:00
elastic</options> </input> </inputs> <script > <block s= "doDeclareVariables" > <list > <l > setter</l> <l > getter</l> <l > func</l> </list> </block> <block s= "doIfElse" > <block s= "reportEquals" > <block var= "attribute" /> <l > x position</l> </block> <script > <block s= "doSetVar" > <l > setter</l> <block s= "reifyScript" > <script > <block s= "setXPosition" > <l > </l> </block> </script> <list > </list> </block> </block> <block s= "doSetVar" > <l > getter</l> <block s= "reifyReporter" > <autolambda > <block s= "xPosition" > </block> </autolambda> <list > </list> </block> </block> </script> <script > <block s= "doIfElse" > <block s= "reportEquals" > <block var= "attribute" /> <l > y position</l> </block> <script > <block s= "doSetVar" > <l > setter</l> <block s= "reifyScript" > <script > <block s= "setYPosition" > <l > </l> </block> </script> <list > </list> </block> </block> <block s= "doSetVar" > <l > getter</l> <block s= "reifyReporter" > <autolambda > <block s= "yPosition" > </block> </autolambda> <list > </list> </block> </block> </script> <script > <block s= "doIfElse" > <block s= "reportEquals" > <block var= "attribute" /> <l > direction</l> </block> <script > <block s= "doSetVar" > <l > setter</l> <block s= "reifyScript" > <script > <block s= "setHeading" > <l > </l> </block> </script> <list > </list> </block> </block> <block s= "doSetVar" > <l > getter</l> <block s= "reifyReporter" > <autolambda > <block s= "direction" > </block> </autolambda> <list > </list> </block> </block> </script> <script > <block s= "doIfElse" > <block s= "reportEquals" > <block var= "attribute" /> <l > size</l> </block> <script > <block s= "doSetVar" > <l > setter</l> <block s= "reifyScript" > <script > <block s= "setScale" > <l > </l> </block> </script> <list > </list> </block> </block> <block s= "doSetVar" > <l > getter</l> <block s= "reifyReporter" > <autolambda > <block s= "getScale" > </block> </autolambda> <list > </list> </block> </block> </script> <script > <custom-block s= "error %s" > <block s= "reportJoinWords" > <list > <l > unknown attribute "</l> <block var= "attribute" /> <l > "</l> </list> </block> </custom-block> </script> </block> </script> </block> </script> </block> </script> </block> <block s= "doIfElse" > <block s= "reportIsA" > <block var= "easing" /> <l > <option > reporter</option> </l> </block> <script > <block s= "doSetVar" > <l > func</l> <block var= "easing" /> </block> </script> <script > <block s= "doSetVar" > <l > func</l> <custom-block s= "easing %txt" > <block var= "easing" /> </custom-block> </block> </script> </block> <custom-block s= "animate setter %cmdRing getter %repRing delta %n over %n secs easing %repRing" > <block var= "setter" /> <block var= "getter" /> <block var= "delta" /> <block var= "duration" /> <block var= "func" /> </custom-block> </script> </block-definition> </blocks>