Page 5 of 8

Re: RaspberryPi Stacks

Posted: Sat Jan 23, 2016 7:55 am
by [-hh]
Raspberry Pi stacks collection #69 = Gears.livecode

My goal was to make gears with polygons only. The animation is again a rotation of the polygons, no use of images. This is a mathematical "prototype" approach for the simplest case, it's much more complicated in mechanical engeneering (for a first good overview see https://en.wikipedia.org/wiki/Gear).

You can adjust (also while the animation is running)
  • N = the num of teeth (2,4,6,8,12,16,24,48) for each of the three gears.
    The radius is then set to keep the ratio radius/N = constant (here constant=10).
  • the "rotation speed" of millisecs per rotation-step (step is here 48/N degrees).
Each of the loops (one angle status) computes the rotated points for the three gears.
The average needed times per loop are
  • On a Raspberry Pi 2: Around 35|65 ms on LC 6|LC 7,
  • On a Raspi B: Around 135|255 ms on LC 6|LC 7.
  • On a 2.5 GHz machine: Around 3|7 ms on LC 6|LC 7.
[ The simplified math used here for the gear's curves is given by
( g*cos(t), g*sin(t) ) where t is the angle ( t=degree*pi/180 )
N2 = N/2 and g = 10*(N2 + tanh(N2*cos(N2*t)*sin(N2*t))) ]

Use it for fun, explore and change the (medium difficult) script.

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

Re: RaspberryPi Stacks

Posted: Wed Jan 27, 2016 12:35 am
by [-hh]
Our next goal is to handle mini displays like the 84x48 Mini-LCD-display (ready to use available for 10$ (Adafruit,Sunfounder); this is in fact the Nokia 5110 display of an early mobile phone).

We'll do this in 3 steps, only step [3] depends on Raspi hardware.
The first two steps may be of it's own LC-related "scripting interest" for all platforms.

[1] Prepare the 'pure' math. This may be applied to ANY display (which has also, if scaling a clipped region high enough, the behaviour of a mini display). I'll post that part in the "easy math"-thread of this subforum: Relations I and II, see here.

[2] Build some scripts for creating "images" (the pixel-displays) on such a display. Will be the next post here.

[3] Using the hardware (how to put a display from card to the miniLCD). Of course we use available resources and infos from the Raspi community here.
I'll post that part in an own "hardware"-thread in this subforum.

Re: RaspberryPi Stacks

Posted: Sat Feb 06, 2016 3:46 pm
by [-hh]
I lost oversight, a table of content may be also comfortable for you, I'll insert one every 69 stacks :-)

Table of contents (as of Sep 11, 2019)

Re: RaspberryPi Stacks

Posted: Wed Apr 13, 2016 3:32 pm
by [-hh]
[Placeholder for Raspberry Pi stacks collection #70 (still unfinished)]

Re: RaspberryPi Stacks

Posted: Wed Apr 13, 2016 3:33 pm
by [-hh]
[Placeholder for Raspberry Pi stacks collection #71 (still unfinished)]

Re: RaspberryPi Stacks

Posted: Wed Apr 13, 2016 3:48 pm
by [-hh]
Raspberry Pi stacks collection #72 = Pointillize.livecode

Pointillize and Hatching = LC-Magick 2 could this stack be called, because it gives you very fast (fast enough for Raspi B!) an image effect, that 'imageMagick' serves and creates with a similar technique.

Blur and Pixelate = LC-Magick 1 would be then, also similar to techniques of 'imageMagick', a stack in which Scott Rossi shows us how to use resizing at different quality levels in order to blur or pixelate (ScottR's blog.)

The technique used here is to pixelate the image and then to draw a polygon that masks these enlarged pixels with its markerPoints, which are appropriate (computed) regular polygons. The masking is achieved by simply setting the ink of the pixelated image and the polygon, as described in Raspi stack #59 (= keyhole.livecode). Since the technique builds on pixelation, the methods of LC-Magick 1 are included in LC-Magick 2 -- switch Pointillizing off for that (or apply both).

Kind of a "Hatching effect" is achieved by setting vertices to 2 and using angles.
The image example is the Thistle from Thistle Street NW, Edinburgh. You can import your own 'thistle' (and then export your 'artwork').

The stack runs on Mac/Win/Linux using LC 6 to 8, and on RaspberryPi using (the only available) LC651 or LC704.

Re: RaspberryPi Stacks

Posted: Sun Apr 17, 2016 11:51 pm
by [-hh]
Raspberry Pi stacks collection #73 = imageMultiplexer2c.livecode

ImageMultiplexing = LC-Magick 3 could this stack be called.
It gives you very fast an interesting aspect of image manipulation.

I've see this several times in "big imaging apps" and wondered if this could be done fast enough even for Raspi with the "on-board-tools" of LC. The answer is yes. The resulting stack is below.

It is all done with 'solid' image data (and alphadata) handling, no tricks, no external helper. Not, not the single pixels are used, this would be far too slow. Wherever possible, the data is prepared in a way, that 'blocks of pixels' can be used.

The times needed are surprising: 80-300 ms on a medium fast machine, 500-2000 ms on a Raspi2.
That is, on a medium fast machine you have the result 'on mouseUp': LC-Magick ...

An included image example is again the Thistle from Thistle Street NW, Edinburgh. You can import your own 'thistle' (and then export your 'artwork').

The stack runs on Mac/Win/Linux using LC 6 to 8, and on RaspberryPi (using LC651 or LC704).
The stackFileversion is 5.5.
.

Re: RaspberryPi Stacks

Posted: Sat Apr 23, 2016 11:17 am
by [-hh]
Raspberry Pi stacks collection #74 = SundayGameNb5.livecode

SundayGame number 5 is a "Digits-Frequency-Race".

You choose one of Pi, Sqrt(2) or Exp(1). Then fix N (1 <= N <= 10000) of its digits as "population". The stacks computes the frequency distribution of the digits 0-9 in that population.

The game is now to bet on a winning digit:
Which digit has the highest frequency in the current population?

For each "round" of the game you can set your own N (by an input field) or get a random N out of 1000 or out of 10000. For N < 1000 there is more variation in the frequencies. For larger N the frequencies are close to 10% (the 'theoretical' value if the digits have a discrete uniform distribution).

The script includes a 'tied-rank-computation'.

You may play the game also online with it's HTML5-standalone "digitRace" frome here (EU) or from here (US).

The stack runs on Mac/Win/Linux using LC 6 to 8, and on RaspberryPi (using LC651 or LC704). The stackFileversion is 5.5.

Re: RaspberryPi Stacks

Posted: Tue May 24, 2016 7:49 am
by [-hh]
Raspberry Pi stacks collection #75 = Rotate3D-XY.livecode

A Simple (non-perspective) 3D rotation of a shape (and snapshot-text from a field).
You can choose the number of vertices of the 'shape', a regular polygon.
'Speed' is hard-coded, easily adjustable to your special needs in the script.

We don't have widgets available on Raspi, so we have to make our own utilities.
[Widgets would be much too slow for Raspi anyway.]
Our series has started just now, this is 'R-widget #1'.

A similar example of such a simple 3D-rotation (of a masked image) is available online as HTML5-standalone, choose from the overview here (EU) or here (US).

The stack runs on Mac/Win/Linux using LC 6 to 8, and on RaspberryPi (using LC651 or LC704). The stackFileversion is 5.5.

Re: RaspberryPi Stacks

Posted: Mon May 30, 2016 12:06 am
by [-hh]
Raspberry Pi stacks collection #76 = wireFrames1b.livecode

This is the IDE version of my simple font tracing algorithms,
tracing styles Contours, Horizontal, Vertical, Gutter or Points.
[It is a 'byproduct' of the preparation of my talk in August, Edinburgh.]

This version uses only optionally the webFonts of the HTML5 version, only if you install them.
Default is to show the available fontNames (the fonts of your OS that LC can see).

The scripts run very fast in LC 6 (on Raspi 2/3 significantly faster than the HTML5 version, on a medium fast machine ca. 10-15 times faster than the HTML5 version, depending on web browser used). In LC 7/8 it slows down graciously and you need a very fast machine to have still fun with that.

Usage hint.
One source of fast algorithms is the 'dont-check-everything-twice'. So sometimes you will get unwanted 'connections' between letters. These usually disappear if you choose a larger textSize and decrease the scale of the traced poly (use menus). Of course this need more computation time, seen also from the number of needed lines (which include empty lines for separating subpolys).

We don't have widgets available on Raspi, so take this as 'R-widget #2'.
Look at the HTML5-version from the overview here (EU) or here (US).

The stack runs on Mac/Win/Linux using LC 6 to 8, and on RaspberryPi (using LC651 or LC704). The stackFileversion is 5.5.

Re: RaspberryPi Stacks

Posted: Sat Jun 04, 2016 9:20 pm
by [-hh]
Raspberry Pi stacks collection #77 = SundayGameNb6.livecode

SundayGame number 6 is a "RGB-Puzzle":
You create a picture from a subset of all 24 bit different RGB colors, use each of the different colors exactly once.

This is inspired by the great site https://allrgb.com
(Use there all 24 bit = 16777216 = 256x256x256 = 4096x4096 different RGB-colors).

Of course 2^24 is much too large for a sunday game, so we have to use a proper subset, I offer 8x8, 12x18, 64x64 or 72x81 (the last two in case you wish to play from sunday to sunday). The graphics are created 'on-the-fly' what takes some time, especially on Raspi better start with the first two.
[Scripts make heavy use of 'mod' and 'div' -- in case you are beginner and wish to exercise that.]

You may play the game also (simplified) online with it's HTML5-standalone "RGBPuzzle" frome here (EU) or from here (US).

The stack runs on Mac/Win/Linux using LC 6 to 8, and on RaspberryPi (using LC651 or LC704). The stackFileversion is 5.5.

Re: RaspberryPi Stacks

Posted: Tue Jun 21, 2016 7:54 pm
by [-hh]
Raspberry Pi stacks collection #78 = AlertBuilder2a.livecode

The stack, may be also called 'R-widget #3', is too large for a download in the LC-forum (1.2 MB, contains 756 HiRes-icons).
You may download it from livecodeshare or *much* faster via the link "Sample Stacks" from LC's topBar (which works pretty well now in LC 6/7/8).
-------
The stack runs in latest version of LC 6/7/8 (6.7.11-7.1.4-8.1.0).
It is tested on "desktop" with Mac 10.6-10.11 / Win 7-10 / Ubuntu 15.10-16.04.
It runs on Raspi B+ (Debian)/ Raspi 2 (Lubuntu)/ Raspi 3 (Xubuntu), using LC 6.5.1 and 7.0.4.
[Using a built alert on Android and iOS will need some additional work.]
-------
There is large help available in the stack.
-------
Short info:
The stack builds a (sub-)stack, that you can use as an alert.
[+] The built alertStack is 'windowshaped' and disappears after N seconds (counting down the seconds).
[+] Available shapes: Rectangle, roundRect, oval and regular polys (3 to 24 vertices).
[+] The shapes are resizable and (if regular polygons) 'reshapable' by handles.
[+] BackColor, foreColor (border) and lineSize of the shape may be set.
[+] The text is editable (textSize, textFont, textColor).
[+] 756 HiRes-icons (PNG) from Google's set are available
... https://github.com/google/material-desi ... master.zip (60 MByte)
... [Please read and use licenses from the package.]
[+] The icons are resizable (scale down).
[+] We colorise the icons by ourselves in the editing stack or the built alert.
[+] A small subset of the icons is attached to the built alert.
=======
Have fun! [-hh]

[Given time, I'll make a special LC 8 version, that uses the SVG versions of the icons ...]

Re: RaspberryPi Stacks

Posted: Tue Aug 16, 2016 6:09 pm
by [-hh]
Raspberry Pi stacks collection #79 = LCD-01e.livecode

This is the example stack "LCD scroller", presented at the LC conference, Edinburgh 2016. For help and info on the technique used see the
accompanying PDF.

The stack runs in latest version of LC 6/7/8 (6.7.11-7.1.4-8.1.0).
It is tested on "desktop" with Mac 10.6-10.12 / Win 7-10 / Ubuntu 15.10-16.04.
It runs on Raspi B+ (Debian)/ Raspi 2 (Lubuntu)/ Raspi 3 (Xubuntu), using LC 6.5.1 and 7.0.4.
 

Re: RaspberryPi Stacks

Posted: Wed Sep 28, 2016 6:58 pm
by [-hh]
Raspberry Pi stacks collection #80 = worldNews.livecode

[2019] Doesn't work any more because of a changed input format. I'll leave it as a "template.

The stack displays headlines from news@Reuters as a "runningText" with weblinks to the articles.

The following info/help is _not_ included in the stack.
  • * RightClick at the _lower_ half of the runningText to shift the Text up or down.
  • RightClick at the _upper_ half of the runningText to drag the stack.
  • Click at the runningText to start/stop it running.
  • Move mouse from above into the stack's window to show an action/info group.
  • Move mouse to top or bottom of the stack's window to hide the action/info group.
  • * RightClick at the (most right) date-field of this group to shift its text up or down.
  • Click at this field of this group to enlarge/shrink it. The field is displaying a countDown in seconds until the next refresh.
  • RightClick the button "Refresh" of the action/info group to choose a textFont.
  • Click at one of the four orange rects of the stack window's corners to move the stack to the corresponding corner of the working screenRect.
  • The action/info group shows buttons "News" (with the main script), a region option, Start/Stop, Color 'swatches', Previous, Next and Refresh. The speed of the animation may be adjusted (for Raspi to fastest desktop box) by the right option menu (slowest=1 to 7=fastest).
[* may be needed after choosing a different textFont or switching LC 7 and LC 8 for the display. Default is the otf-Font "Churchill" (added in the zip, install it by a double-click).]

The stack runs on Mac/Win/Linux using LC 7 or 8, and on RaspberryPi using (the for Raspi available) LC704.

We use LC > 6, because most messages contain unicode chars. The stack runs also with LC 6 (if the stackfileversion is changed), but such chars have then a wrong display and you have to work around that.

[2019] Doesn't work any more because of a changed input format. I'll leave it as a "template".

 

Re: RaspberryPi Stacks

Posted: Fri Oct 07, 2016 6:11 pm
by [-hh]
Raspberry Pi stacks collection #81 = contrastRatio2.livecode

A Contrast Ratio helper. Formulas for relative luminance and contrast ratio are based on the W3C's recommendation for Accessibility.
  • You can set by "oneClick" the backColor and textColor of a text field. Then the relative luminance and the contrast ratio of the two colors are computed.
    The colors may also be set by a color dialog (click the corresponding 'color swatches').
  • There is a 'first' algorithm that *tries* to find a foreColor on base of the current foreColor (the backColor remains fixed) such that a contrast ratio > 7 is reached.
    Try to improve it for your needs.
The stack runs on Mac/Win/Linux using LC 6/7/8, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.