RaspberryPi Stacks

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Tue Sep 01, 2015 10:00 pm

Raspberry Pi stacks collection #53 = jumbleLetters.livecode

The stack is based on a (psycholinguistic) paper *.
The main script fixes the first and last char of each input word and randomizes the order of the chars in between.
If the version of LC is greater LC 7 and above, the script uses "truewords" instead of "words". Look while jumbling at "fully-featured" in 'softline' 7 of the right field to see the difference at once.

The demo input is a blog post by Peter about HTML5.
There is a special button for Malte, in case he's using a foreign kezboard ...
Now I hope, zou have fun with the stack :-)
______
* [See "Raeding wrods with jubmled letetrs: There’s a cost"
by Keith Rayner, Sarah J. White, Rebecca L. Johnson, and Simon P. Liversedge
lra.le.ac.uk/bitstream/2381/3897/1/Rayner_White_Johnson_Liversedge_06_PS.pdf
and see also mrc-cbu.cam.ac.uk/personal/matt.davis/Cmabrigde/
for other languages.]

Tested on desktop Mac/Linux/Win with LC 6 and LC 7, especially latest stable versions.
Tested on RaspberryPi B+ and RaspberryPi 2 running latest avaivalable LC 6 (6.5.1) and LC 7 (7.0.4).
Attachments
jumbleLetters.livecode.zip
(8.07 KiB) Downloaded 246 times
jumbleLetters7.png
Demo input (Peter's HTML5 blog post) and output of LC 7 (truewords)
jumbleLetters.png
Demo input (Peter's HTML5 blog post) and output of LC 6 (words)
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Wed Sep 16, 2015 3:51 pm

Raspberry Pi stacks collection #54 = superEllipse2d.livecode

Description:
What have these shapes (behind the transparent textFields) in common?
SEexamples.png
They all are of type "superellipse".
Here is a good description, if you are interested in the math:
http://en.wikipedia.org/wiki/Superellipse

The attached stack makes it easy to use the shaping procedure (one effective formula) for building non-image-buttons. Such graphic "buttons" are a group of a shape and a transparent (=not filled) textField on top. They "hilite" by changing fore- and backColors.

You may use the stack as a tool for creating such "graphic buttons".
The created objects are also scripted for use in your own stacks.

A complete info/help and several examples are included in the stack.

Tested on desktop Mac/Linux/Win with LC 6 and LC 7, especially latest stable versions.
Tested on RaspberryPi B+ an 2B running latest avaivalable LC 6 (6.5.1) and LC 7 (7.0.4).
Attachments
superEllipse2d.livecode.zip
(17.34 KiB) Downloaded 291 times
Superellipse2d.png
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Wed Oct 28, 2015 4:27 am

Raspberry Pi stacks collection #55 = diceClockXraspi2.livecode

This is a 24h-clock that shows dice-coded decimals of time (hh:mm:ss).

It is similar to #27 (=cubeNine), but displays symbolic text instead of graphics.
The text display uses simply tabbed text in 6 fields (one field for each digit).

A slightly simplified version of this stack is also a HTML5-demo, that runs in Iceweasel on Raspberry 2, so that you can compare the stack in LC-IDE and the HTML5-standalone.

Sadly not yet on RaspberryPi runs the included rawKeydown handler, that sets
= the blendLevel of the stack window or
= (use shift+scrollwheel) set the scalefactor of the stack between 0.4 and 2.0.
RightClick in the window sets the scalefactor to the default value 1.

The grey buttons TL/ TR/ BL/ BR move the stack window to topleft/ topright/ botleft/ botright of the effective working screenRect.

Drag the window by mouseDown using a "20px-border" of the stack window.

The stack runs on Mac/Win/Linux using LC 6-8 and on RaspberryPi using (the only available) LC 6.5.1 or 7.0.4.
The attached zip includes the variable-width-font used. On Raspi and Linux put it into the ".fonts"-folder of your home, where LC will find it.
Attachments
diceClock.png
Displays time 02:03:16 hh:mm:ss
diceX.zip
(45.48 KiB) Downloaded 250 times
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Sat Nov 07, 2015 11:34 pm

Raspberry Pi stacks collection #56 = asciiFontClock2.livecode

This is a 24h-clock that shows with ASCII art fonts the time (hh:mm:ss) or the date (YY:MM:DD).

IMPORTANT: If you don't use the attached font you have to set the textfont of the stack to a fixed-width font (like Courier). The textSizes are set by the script.

I made it in such a way that even young children, with a little help of their (grand)fathers or (grand)mothers, can create new ASCII-art numbers or change the ones currently used.
For this you have simply to edit the script of the topLeft button "AsciiArtClock" and use a fixed width font for the editor. And now you have WYSIWYG.

For example (excerpt from code for the second font "banner"):

Code: Select all

switch k -- cases k=0,1,...,9
--- cases 0 to 3 similar
  case 4
      return "" & \
            "#      "&cr& \
            "#    # "&cr& \
            "#    # "&cr& \
            "#    # "&cr& \
            "#######"&cr& \
            "     # "&cr& \
            "     # "; break
  case 5
     return "" & \
            "#######"&cr& \
            "#      "&cr& \
            "#      "&cr& \
            "###### "&cr& \
            "      #"&cr& \
            "#     #"&cr& \
            " ##### "  
--- cases 6 to 9 similar
end switch
A slightly simplified version of this stack is also a HTML5-demo, that runs (slowly!) in Iceweasel on Raspberry 2, so that you can compare the stack in the LC-IDE and the HTML5-standalone.

The stack runs on Mac/Win/Linux using LC 6-8 and on both RaspberryPi B and RaspberryPi 2 using (the only available) LC 6.5.1 or 7.0.4.
The attached zip includes the FIXED-width-font used for the HTML5-standalone. On Raspi and Linux put it into the ".fonts"-folder of your home, where LC will find it.
Attachments
asciiFontClockplusFont.zip
The stack and a fixed width font
(36.35 KiB) Downloaded 254 times
asciiFontClock.png
Font "banner", a figlet font
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Thu Nov 12, 2015 11:22 pm

Raspberry Pi stacks collection #57 = SundayGameNb1.livecode

This is the first of a series of 'sunday game' stacks.
These are simple projects you can realize (at least change to your needs) within an hour and play (age 8 to 88). Some of the stacks will be specialized for Raspi (using Raspi hardware), I will warn others in that case.

Stack Number 1 is the game "Fit Centroid and Area", based on recent fast methods we found in the use-list for computing the area and centroid of a simple non-selfintersecting polygon.

You don't need any math for that, you simply have to drag the (cyan) handles at the vertices to change the area of your polygon to fit a rectangle and try to do this in such a way that at the same time the (red) loc and the (blue) centroid of the polygon overlap.
[Loc = the center of the enclosing rectangle of the polygon. Centroid = "center" (average position) of all the vertices of the polygon.]

Take the ready made stack, change the limits for "target reached" or the criteria for winning. Or simply think about good strategies. It's not that easy (although there are trivial solutions).
This first 'game' demonstrates also what a great feature of LC we have with the "editmode" for graphics .

Most of these games will also be compiled to HTML5 standalones, see HERE (extern server). These will be sometimes slightly changed/simplified.
The downloads here are always the original unchanged stacks.

The stack runs on Mac/Win/Linux using LC 6-8 and on RaspberryPi using (the only available) LC 6.5.1 or 7.0.4.
Attachments
sundayGameNb1_R2.livecode.zip
Works now on LC 6-8
(4.26 KiB) Downloaded 247 times
SundayGameNb1.png
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Sun Dec 06, 2015 10:34 pm

Raspberry Pi stacks collection #58 = SundayGameNb2.livecode

SundayGame number 2 is "Guess one to four".

Four symbols (or numbers)
1 = clubs, 2 = spades, 3 = hearts and 4 = diamonds.
are sorted randomly. We have 4! = 4*3*2*1 = 24 possible outcomes.

Fix one to four places and guess the outcome of the next sort.
Your chance is 1 out of 24=4*3*2 for four or three fixed places, 1 out of 12=4*3 for two fixed places and 1 out of 4 for one fixed place.

This game was also compiled to a HTML5 standalone, see HERE (extern server).

The (only here) downloadable stack contains also in the card script
  • a short function to generate all possible outcomes for a sort of N objects (indexed as numbers 1 to N). Note that this results in N!=N*(N-1)*...*2*1 lines (for example 9!=362880).
    For more than 9 objects you have to insert a delimiter (comma) between indices and use 'items' instead of 'bytes'!!
  • the points of the symbols which are polygons.
The stack runs on Mac/Win/Linux using LC 6-8 and on RaspberryPi using (the only available) LC 6.5.1 or 7.0.4.
Attachments
sundayGameNb2-R2.livecode.zip
(4.82 KiB) Downloaded 246 times
guessOneToFour.png
The four symbols
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Tue Dec 08, 2015 5:36 am

Raspberry Pi stacks collection #59 = keyhole.livecode

At first I intended to post now the HTML5-kleeClock input stack as Raspi stack (yes, it runs without problems on Raspi), but it's too large for that. So I'll make a Raspi app out of this soon.

Some of you were interested in the technique used there, so I made this tiny stack to demonstrate it:
The kleeClock draws the polygons on the fly (using internet time) and let us "look through" to an image or a beautiful landscape.

Look through like a through a mask? Seems like that only.
The image, as large as the card window, is IN FRONT of the graphics.

How that? The method is this simple one:
We use two objects, nothing more (no grouping is necessary).
  • a graphic, here the keyhole shape (a self-made, filled polygon),
  • an image of cards's size, here the first iPhone, in front of the graphic.
Now set ink of the graphic to "blendDstOut"
and set ink of the image to "blendDstOver" (or "blendDstAtop")
Then the graphic becomes "patterned" by the image.

The darkBlue surrounding of the keyhole is the card's backColor.
keyhole.png
If we disable the image (to be done by script/message box) and script the graphic by
"on mouseDown;grab me;end mouseDown"
then we can drag around the keyhole to see other parts of the image.
In the kleeClock we change, as an alternative, randomly the loc of the front image every 10 seconds.

To see the color of the graphic on top of the card's backColor hide the image and set ink of the graphic to "blendSrcOver".
Using moreover the polygons and shearing from the "brokenLCD"-stack here (HTML5-input) you have now all essential ingredients for the kleeClock.

Have fun to build your own "keyhole"-stacks or similar "look-throughs".
The stack runs on Mac/Win/Linux using LC 6-8 and on RaspberryPi using (the only available) LC 6.5.1 or 7.0.4.

Click in the blue part of the card window (please wait a second for a reaction) to start/ stop randomly influenced movements of the keyhole shape. Click in the keyhole shape to drag it around.
Attachments
keyhole.livecode.zip
(38.65 KiB) Downloaded 255 times
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Mon Dec 14, 2015 4:24 am

Raspberry Pi stacks collection #60 = SundayGameNb3.livecode

SundayGame number 3 is "Lucky Wheel" or "Who (of the LC-staff) cooks the tea?".

It animates a list of (editable) labels that are arranged in a 'circle' and chooses one of these randomly. There is a short help in the stack to available options.

This game was also compiled to a HTML5 standalone, see HERE (extern server). The standalone's animation speed is close to the animation speed on Raspi B.

The labels are snapshots from a field. The (only here) downloadable stack contains the code of how to arrange the label-images along a regular polygon, one vertix for each label.
The code is fast but not optimized --- for such short list this ararangement (and the animation) is even no problem for the Raspi B.

The stack runs on Mac/Win/Linux using LC 6-8 and on RaspberryPi (using the only available) LC 6.5.1 or 7.0.4).
[The attached zip contains also the font I used for the HTML5-standalone. On Raspi put it into the .fonts directory of your home directory where LC will find it.]
Attachments
SundayGameNb3.zip
Updated Dec 14, 14:14 -- Removed a bug with a 'default' setting.
(81.68 KiB) Downloaded 255 times
SundayGameNb3.png
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Tue Dec 22, 2015 6:39 pm

Raspberry Pi stacks collection #61 = accordeon2x2.livecode

This is a stack with four accordeon-like arranged "image slots".
The stack has help (edit: what I forgot to mention there: One can drag an image insisde its group by rightClick).

Techniques that may be interesting for you.
  • The creation of the 'accordeon gutter' (the rectangles).
    This is hopefully simpler/better understandable version of the 4x4 accordeon of Raspi stack #36.
  • The "image handling"
    = Zoom in/out and fitWidth/fitHeight are maximally simplified versions of Raspi stack #7.
    = The "replacing" of the grouped image by using a filePath by "answer file" or "dragDrop". Here the image is imported by setting the text of the existing image (the easy modification to set a new filename is up to you).
Note. The "dragDrop"-handler uses a workaround I found for LC 7 (that doesn't harm if the bug is removed in later versions), see here (Linux-subforum).

The stack runs on Mac/Win/Linux using LC 6-8, especially latest versions, and on RaspberryPi using (the only available) LC 6.5.1 or 7.0.4.
Attachments
accordeon2x2.livecode.zip
(169.49 KiB) Downloaded 245 times
accordeon2x2-0.png
No slot selected/activated
accordeon2x2-2.png
Second slot selected/activated
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Fri Dec 25, 2015 4:51 am

Raspberry Pi stacks collection #62 = hexagonsR.livecode
Raspberry Pi stacks collection #63 = squaresR.livecode
  • #61 is a<Magic Hexagon Clock> that displays time as H:M:S (or date as Y:M:D) in three magic hexagons. Horizontal and diagonal sums add to 38 each.
    I used only one magic hexagon (no rotation/mirroring) to allow faster reading. You have to add the coloured numbers of each. You may concentrate on the 'sum-anchors' 0,19,35 and 50 when reading the display.
    I added also the option to add a "0"-hexagon. This doesn't destroy the sum properties but the 'close-to-hexagonal' shape of the group.
    Note. It is easy to see, that a display of numbers 0 to 18 (with constant sum) is NOT possible in such a shape.
  • #62 is a<Magic Square Clock> that displays time as H:M:S (or date as Y:M:D) in three magic squares. Horizontal, vertical and diagonal sums add to 30 each.
    I used only one magic square (the one used by Duerer (add 1 to each cell)) to allow faster reading. You have to add the coloured numbers of each. You may concentrate on the 'sum-anchors' 0,15,29,42 and 54 when reading the display.
RightClick shows/hides a preferences group.

You may be interested in the technique of displaying the number that are to sum up.
The main handler is rather short and serves all six displays/groups.

Both stacks run on Mac/Win/Linux using LC 6-8, especially latest versions, and on RaspberryPi using (the only available) LC 6.5.1 or 7.0.4.

[The attached zip contains both stacks and also the font I used for the HTML5-standalones. On Raspi put it into the .fonts-directory of your home directory where LC will find it.]
Attachments
magicClocks.zip
(50.25 KiB) Downloaded 240 times
magicSquareClock.jpg
Display is 15/12/25 year/month/day
magicHexagonClock.jpg
Display is 15/12/25 year/month/day
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Sun Dec 27, 2015 9:05 pm

Raspberry Pi stacks collection #64 = PixelsClock2b.livecode

Yet another unusual display of time. The seconds of the current internet day (derived from internet date) are shown, one coloured pixel for each. This may be suitable for small displays (especially a Raspberry Pi may use mini displays). We'll make soon a 'similar' clock for a Raspi mini-display that doesn't has enough pixels.

One line has 300 pixels (5 minutes). The vertical gutter lines separate minutes, the horizontal gutter lines separate hours. RightClick to hide/show the 'prefs' group.

The (only here) downloadable stack contains a 'minimal' non-modal colorChooser (RGB sliders), that makes you independent of system color choosers.

The stack runs on Mac/Win/Linux using LC 6-8, and on RaspberryPi using (the only available) LC 6.5.1 or 7.0.4.
Attachments
pixelsClock2b.livecode.zip
(6.68 KiB) Downloaded 228 times
pixelsClock.png
pixelsClock.png (15.77 KiB) Viewed 4244 times
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Sun Jan 10, 2016 2:56 am

Raspberry Pi stacks collection #65 = progress1of4.livecode [=regularBase]
[Difficulty: easy to handle, easy to understand, scripts: medium]

Shows percentage-progress in percentages of path length along a polygon.
Start here on base of a regular polygon that you can create with several selectable options.

In edit mode (use radio button) change the position of vertices to have any new 7-point-object. Then use this as progress indicator using a slider or by script. Have fun to create new figures (logos, animals, faces, etc. ...)

There is help in the stack (use button"?")

The stack runs on Mac/Win/Linux using LC 6-8, and on RaspberryPi using (the only available) LC 6.5.1 or 7.0.4.
Attachments
hhProgress1of4.livecode.zip
(19.33 KiB) Downloaded 242 times
progress1of4.png
Polygon, edited by a child from a regular 'heptagon' (7 vertices), at 33%.
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Sun Jan 10, 2016 3:02 am

Raspberry Pi stacks collection #66 = progress2of4.livecode [=bezierCurve of order 1-9]
[difficulty: easy to handle, medium to understand, scripts: medium]

Shows percentage-progress in percentages of path length along a curve.
Use here a bezier curve of order 1-9 (1=line, 2=quadratic, 3=cubic,...).

Drag the control points to shape the curve. Then use it as progress indicator controlled by a slider or by script.

This is my favourite display to demo 'roughly' (for non-math people) what control points do, because
dragging control points (you have 1+the order of them) shows kind of an acting 'rubber band'.

There is help in the stack (use button"?")

The stack runs on Mac/Win/Linux using LC 6-8, and on RaspberryPi using (the only available) LC 6.5.1 or 7.0.4.
Attachments
hhProgress2of4.livecode.zip
(19.18 KiB) Downloaded 226 times
progress2of4.png
A bezier curve of order 9 (10 control points) at 26%.
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Sun Jan 10, 2016 3:18 am

Raspberry Pi stacks collection #67 = progress3of4.livecode [=creating relations]
[difficulty: medium to handle, medium to understand, scripts: advanced]

Shows percentage-progress in percentages of path length along a curve.
Use here relations you give dependent of an x-parameter range, an coord1-Formula and an coord2-Formula for this param.
For example
  • the param range "0,2*pi" and "100*cos(x)" as coord1 and "100*sin(x)" as coord2 gives, without other scaling, a circle with radius 100
  • the param range "-1,1" and "x" as coord1 and "x*(x-1)" as coord2 gives, without other scaling, a plot of the function f(x)=x*(x-1) over the interval [-1,1].
This is not elementary math, but non-math people can play, at first, with the 9 examples given (1=Lissajous, 2=normal density, 3=oscillo-krakel, 4=archimedian spiral, 5=logistic curve, 6=fermat spiral, 7: f(x)=x*log(x), 8=heart, 9=hypertrochoid = AdobeLogo).
You can also, beyond playing with the formulas, drag the polygon points (for example 'FlipV' example 7 and drag the point at the origin to get approximately a McDon' logo).

This demo shows impressingly the enormous possibilities of LC for plotting relations -- at least excellent previews.

There is help in the stack (use button"?")

The stack runs on Mac/Win/Linux using LC 6-8, and on RaspberryPi using (the only available) LC 6.5.1 or 7.0.4.
Attachments
hhProgress3of4.livecode.zip
(16.3 KiB) Downloaded 224 times
progress3of4-adobe.png
Hupertrochoid (curve type that is used by Adobe) at 42%, see formula in stack.
progress3of4.png
A Lissajous figure at 42%, see formula in stack.
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1686
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Sun Jan 10, 2016 3:31 am

Raspberry Pi stacks collection #68 = progress4of4.livecode [=click-and-drag creation]
[difficulty: easy/medium to handle, easy to understand, scripts: advanced+]

Shows percentage-progress in percentages of path length along a curve. Use here
  • Clicks to create the vertices of the polygon or
  • Drag to draw ("Krikel-Krakel") to create a polygon.
Your artwork is cumulated until 'Clear' is used. In order to 'save-in-between' make short additional parts (this is not a drawing app!). Kids need 5 minutes of help for that, there are a several options to explain!

The 'progress-part' using the 'handwritten path' is essentially my HTML5 demo "Progress polygon". The 'click-part' will become, given time, become (part of) a 'sunday game'.
You can have my "Happy New-Year-Wish" by shift-clicking button "Reset" -- the wish is valid all over the year.

Use it for fun, I found myself playing half an hour with creating "figures" with the click part (was useful for finding bugs...).
There is help in the stack (use button"?")

The stack runs on Mac/Win/Linux using LC 6-8, and on RaspberryPi using (the only available) LC 6.5.1 or 7.0.4.
 
Attachments
hhProgress4of4.livecode.zip
(36.85 KiB) Downloaded 237 times
progress4of4.png
A figure I used (for testing progress with 'separated subpaths') at 22%.
shiftLock happens

Post Reply

Return to “Raspberry Pi”