RaspberryPi Stacks

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

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

Re: RaspberryPi Stacks

Post by [-hh] » Mon May 05, 2014 10:35 pm

Raspberry Pi stacks collection #26 = colorNine2.livecode
Raspberry Pi stacks collection #27 = cubeNine1.livecode


colorNine is a *tiny* stack, that moves along Bezier curves over your screen.
RightClick on the center to get a menu "Flyer" for that.
This stacks shows *extreme* differences in grahic animation between LC 6 and LC 7, the latter is up to a factor of 20 slower (you have to adjust the number of iterations on Raspi).
cubeNine.png
cubeNine, displays date and time. Options available.
cubeNine displays the time (and date) like gaming dices, also selectable are some number bases that are NOT base10. Funny for developers to read this fast, while some other's can't.
Attachments
colorNine2.livecode.zip
(4.02 KiB) Downloaded 186 times
cubeNine1.livecode.zip
(9.53 KiB) Downloaded 218 times
Last edited by [-hh] on Tue Nov 25, 2014 3:02 am, edited 3 times in total.
shiftLock happens

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

Re: RaspberryPi Stacks

Post by [-hh] » Sat May 10, 2014 2:08 am

Raspberry Pi stacks collection #28 = Shuffle4cards1.livecode.zip

ShuffleCards is a stack that answer a question that is very often asked.
How to order randomly the cards of a stack or the images of a folder or some other N objects. Reorder means: If there is a set of N different objects (may be distinguished by a number or something else like name) in a set then there are again exactly these N different objects in the new set but in a new random order. This new order is usually different from the first, but the same order is also a possible outcome.

There are N possible choices for the first new place, n-1 possible choices for the second new place, ..., in total N!= N*(N-1)*(N-2)*...*2*1 choices.
We show some tests for n=4, that is 4!=4*3*2*1=24 possible outcomes of a reorder.
Two methods are used to be found in the stack's script.
  • The Knuth-Fisher-Yates algorithm that uses the usual pseudo random() in a special way.
  • The usualRandomSort that sorts the numbers 1 to N (in N lines) by random(large-number).
Both methods are set to get a new randomSeed at start and show for increasing N a surprisingly good distribution to the 24 possible reorder-outcomes.
.
Attachments
Shuffle4Cards1.livecode.zip
(78.86 KiB) Downloaded 224 times
shuffle4Cards.jpg
shuffle4Cards.jpg (51.64 KiB) Viewed 4773 times
Last edited by [-hh] on Tue Nov 25, 2014 3:02 am, edited 3 times in total.
shiftLock happens

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

Re: RaspberryPi Stacks

Post by [-hh] » Wed May 21, 2014 12:15 pm

Raspberry Pi stacks collection #29 = wakeUpNeo.livecode

Wake Up, Neo (admin).
If Neo had know that only a LC stack window was running on his screen ...

The stack shows the internet date in line 1 and "emulates" Neo's famous terminal (now yours). It is not front-fullscreen but fills the working screenrect and may be used as a kind of screensaver, coming to front if you click it and goes back if you use the LC 'Window' menu, and it stops if you click the mouse or hit any key (without some specials, see the tooltip of the field after opening the stack).
.
Attachments
wakeUpNeo.livecode.zip
(4.57 KiB) Downloaded 222 times
matrix.jpg
matrix.jpg (13.59 KiB) Viewed 4773 times
Last edited by [-hh] on Tue Nov 25, 2014 3:02 am, edited 3 times in total.
shiftLock happens

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

Re: RaspberryPi Stacks

Post by [-hh] » Fri May 23, 2014 1:39 am

Raspberry Pi stacks collection #30 = SmoothDraw4.livecode

This stack is a common work of 'mag' and me.
To use it, some exercise is needed. The scripts try to smooth your hand-drawing or mouse-drawing or pen-drawing from an usb-tablet respectively in such a way that the characteristics of your drawing are not removed.
The drawn objects are polygons (graphics), that can be edited later on. There are some techniques to reduce the number of points (vertices) of these polygons and a 'core' smoothing algorithm (by deCasteljau), that essentially computes (approximates) Bezier curves. We are using quadratic Bezier curves only here.

Scripts are largely commented, every action button has help (tooltip). There are a few demos added. The stack is ready-made for different cards that retain linesize and color.
Also saved are for each 'canvas' (card) ...
  • ... the choosable 'flatness-limit'. This is used by a simple computation that decides whether a segment is "flat" enough not to be curve-smoothed ('rounded').
  • ... the choosable 'wait-rate'. This is the speed of the repeat loop that collects the points for the polygons while you are drawing.
SmoothDraw4.jpg
SmoothDraw4.jpg (22.13 KiB) Viewed 4747 times
Remarks.
  • If the result is too 'curvy' try to draw slower and to draw short segments (e.g. M as three segments, D as two segments (straight and curved), ...) and try with increasing the flatness-limit.
  • If the result is not smooth enough try to draw faster and to draw one-chars (e.g. M as one segments, V as one segment, D as one segment, ...) and try with decreasing the flatness-limit.
  • On PPC (older machines) start with a wait-rate of 48 millisecs and then go upward if needed.
  • On Raspi start with the maximal wait-rate of 128 millisecs and then go downward if needed.
  • On fast machines or if using a highly sensitive usb-tablet (Bamboo or better) try in the range of 4-32 millisecs. If for some reason user is not enough exercised, go up to 128 milliseconds.
  • A good start could be to try to write the word "Step" and change parameters until the drawing is close to your wishes (hope this is possible).
SmoothDraw4-krikel.jpg
SmoothDraw4-krikel.jpg (23.6 KiB) Viewed 4747 times
I added new features:
== The drawing is now in such a way that you can "react" on smoothing so far with your movements. Just try, it's funny, like very old Disney animations.
== There are other "tools", additional to the simple brush. Yes these are still graphic tools, not painting tools ...
Attachments
SmoothDraw4.livecode.zip
(30.4 KiB) Downloaded 285 times
Last edited by [-hh] on Tue Nov 25, 2014 3:03 am, edited 3 times in total.
shiftLock happens

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

Re: RaspberryPi Stacks

Post by [-hh] » Sat May 31, 2014 7:27 am

Raspberry Pi stacks collection #31 = UnQuotate.livecode
Raspberry Pi stacks collection #32 = ScriptMarks.livecode


Un-Quotate
puts quotes around multiline strings or unquotates these.

Marks in scripteditor
Marks are lines in a script that start with any of the sequences
commentChar(s) & colon & "M" & space that is '#:M ' or '//:M ' or '--:M '.

The button lists, prefixed by the line number of the marks location, the marks of the currently active tab of the scripteditor, wherever this script is from. The reading of marks is live (works even with a not yet saved script). Picking a mark from the menu causes a jump to and hiliting of the marks line in scripteditor.
The script is fully commented and very short, you may alter it to your needs.

For the layout of the buttons's menu one can use
Giving marks for dividers: #:M -text
and for disabled items: #:M (text
.
Attachments
UnQuotate.livecode.zip
(4.97 KiB) Downloaded 208 times
ScriptMarks.livecode.zip
(2.64 KiB) Downloaded 191 times
Last edited by [-hh] on Tue Nov 25, 2014 3:03 am, edited 4 times in total.
shiftLock happens

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

Re: RaspberryPi Stacks

Post by [-hh] » Tue Jun 10, 2014 11:31 pm

Raspberry Pi stacks collection #33 = checksum.livecode
Raspberry Pi stacks collection #34 = LCInfo.livecode
Raspberry Pi stacks collection #35 = summary6.livecode


Checksum is for use of md5 and/or sha-1.
The other two stacks are usable in IDE for several infos.
Attachments
checksum.livecode.zip
(3.14 KiB) Downloaded 199 times
LCinfo.livecode.zip
(2.18 KiB) Downloaded 185 times
summary6.livecode.zip
(3.93 KiB) Downloaded 191 times
Last edited by [-hh] on Tue Nov 25, 2014 3:04 am, edited 5 times in total.
shiftLock happens

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

Re: RaspberryPi Stacks

Post by [-hh] » Mon Jul 07, 2014 10:06 pm

Raspberry Pi stacks collection #36 = accordeon16.livecode
accordeon1.jpg
Empty accordeon fields
accordeon1.jpg (11.58 KiB) Viewed 4748 times
accordeon2.jpg
Accordeon using images
accordeon2.jpg (36.2 KiB) Viewed 4748 times
The red<->blue switch is for users of LC 6.5.1 on Raspi (takes some time).
Attachments
accordeon16.livecode.zip
(229.06 KiB) Downloaded 248 times
Last edited by [-hh] on Tue Nov 25, 2014 3:04 am, edited 5 times in total.
shiftLock happens

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

Re: RaspberryPi Stacks

Post by [-hh] » Mon Jul 07, 2014 10:22 pm

Raspberry Pi stacks collection #37 = splash213131.livecode (uses windowShape)
Raspberry Pi stacks collection #38 = morphImages.livecode
Raspberry Pi stacks collection #39 = FlippingProjX2b.livecode


The first stack is a windowshaped stack that zooms as its own 'splash'. It is currently not for Raspi, (works but doesn't look good). It's there for the future, as soon as windowShape will work there too.
The second stack is a demo of how to use maskData of images for 'combining' (stack is quick-and-dirty made for a forum answer).
The third stack is based on an idee and from a topic, that Richmond once started. It resulted in a "wiper"-transition for images.

[No longer 'easteregg' of first stack: Cmd-Click btn 'Demo" for a nice additional optical effect.]
Attachments
splash213131.livecode.zip
(173.57 KiB) Downloaded 236 times
morphImages.livecode.zip
(200.56 KiB) Downloaded 199 times
FlippingProjX2b.livecode.zip
(96.67 KiB) Downloaded 189 times
Last edited by [-hh] on Fri Nov 28, 2014 2:37 am, edited 5 times in total.
shiftLock happens

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

Re: RaspberryPi Stacks

Post by [-hh] » Thu Jul 17, 2014 11:20 pm

Raspberry Pi stacks collection #40 = hhClosestColorNames2b.livecode
Raspberry Pi stacks collection #41 = colorHarmonies2_7.livecode

The first stack finds closest colours (determined by a math distance measure) to a given one.

The second stack creates standard "colour harmonies" (Analogue, Complement, Monochrome, SplitComplement, Square, Tetradic, Triadic) from a RGB "base colour" of your choice.

The harmony is displayed in the most left column, the second column is a choosable percentage of these four colours.
colourHarmonies.jpg
Button "Copy Harmony" creates a new stack with a scripted button that holds the harmony and displays it in a circle.

Also determined are closest 'safe' Hex colour (for the Web) and closest named colour, closest to your chosen baseColor (like part of first stack --- in case you need only this).
Attachments
hhClosestColorNames2b.livecode.zip
(33.52 KiB) Downloaded 194 times
colorHarmonies2_7.livecode.zip
(26.36 KiB) Downloaded 275 times
Last edited by [-hh] on Tue Nov 25, 2014 2:15 pm, edited 7 times in total.
shiftLock happens

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: RaspberryPi Stacks

Post by Simon » Thu Jul 17, 2014 11:40 pm

-hh,
hhClosestColorNames1.livecode just makes me smile from ear to ear.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: RaspberryPi Stacks

Post by [-hh] » Thu Jul 17, 2014 11:51 pm

The following 'bug' Simon mentions is removed in current LC.
Last edited by [-hh] on Mon Nov 24, 2014 9:34 am, edited 2 times in total.
shiftLock happens

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: RaspberryPi Stacks

Post by Simon » Fri Jul 18, 2014 12:13 am

Hi Hermann,
I think I have kept up with all the release notes and don't recall anything about color properties.
Possible bug?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: RaspberryPi Stacks

Post by [-hh] » Fri Jul 18, 2014 1:18 am

[Removed, wasn't up-todate here.]
Last edited by [-hh] on Mon Nov 24, 2014 9:38 am, edited 2 times in total.
shiftLock happens

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3254
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: RaspberryPi Stacks

Post by bn » Fri Jul 18, 2014 11:34 am

Hi Hermann,

that is a very nice stack. Thank you.

Regarding LC7 dp6:

LC7 dp6 returns the thumbPositon as decimal and for LC7 dp6 that is not a valid RGB value

if you change your code in the card script, handler "on scrollbarDrag" to

Code: Select all

on scrollbarDrag p,q,x
  put trunc (the thumbposition of sb "Red") into r
  put trunc (the thumbposition of sb "Green") into g
  put trunc (the thumbposition of sb "Blue") into b
your stack works in LC7 dp6

you might want to report this as a bug.

Kind regards
Bernd

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

Re: RaspberryPi Stacks

Post by [-hh] » Fri Jul 18, 2014 11:52 am

The 'integer-hints' of Bernd are now already included in stack #41 above.
Last edited by [-hh] on Mon Nov 24, 2014 9:30 am, edited 2 times in total.
shiftLock happens

Post Reply

Return to “Raspberry Pi”