Skip to content

Instantly share code, notes, and snippets.

@DideC
DideC / animate.red
Created February 26, 2018 08:32
First try of an animation dialect for Red VID. Computation is not precise enough, but just a proof of concept ;-)
Red [
Purpose: "Animation system for VID"
Needs: 'View
Notes: {
Simplyfied Ease in/out formulas : http://gizma.com/easing/#l
See at the end of page source for javascripts formulas (included elastic) : http://easings.net/en
}
]
@DideC
DideC / logo.red
Last active February 23, 2018 17:03 — forked from rebolek/logo.red
Live logo
Red[]
dst: [
pen 238.172.41
fill-pen 238.172.41 polygon 100x2 114x56 72x43
fill-pen 188.130.45 polygon 100x2 114x56 128x38
pen 212.28.24
fill-pen 212.28.24 polygon 118x72 132x128 36x96 64x54
fill-pen 129.31.34 polygon 118x72 132x128 169x88 135x48
@DideC
DideC / red-basic-editor.red
Last active January 25, 2017 21:04
A very basic text editor in VID. Handling only load and save of a file. Needs `call` to handle compilation and test of script
Red [
title: "Red basic Editor"
author: "Didier Cadieu"
version: 0.1.1
date: "25-01-2017"
]
script: make string! 10000
saved?: true
@DideC
DideC / heart-animation.red
Last active January 30, 2017 10:37
Heart animation for Red (only). New parameters added to the (reordered) control panel to play with the animation + credits. Nice time eater ;-)
Red [
title: "Heart animation"
author: "Didier Cadieu"
notes: {
Traduction in Red of Terebus Volodymyr javascript demo : http://codepen.io/tvolodimir/pen/wqKuJ
}
Needs: View
]
;*** Settings
@DideC
DideC / focus.red
Created October 19, 2016 08:37
Tiny VID utility func and test (find-window, focus)
Red [
title: "Test of `find-window and `focus funcs"
author: "Didier Cadieu"
]
find-window: func [
"Find a face's window face."
face [object!]
][
while [face/parent] [face: face/parent]
@DideC
DideC / dt.red
Created October 7, 2016 09:18
Small func to compute running time of a Red/Rebol code
Red [
title: "Compute the time taken to run a code a number of times."
author: "Didier Cadieu"
]
dt: func [n [integer!] code [block!] /local st] [
st: now/time/precise
loop n code
print [n "loops in" st: now/time/precise - st " => one in" st / n]
]
@DideC
DideC / roman-to-from-arabic.red
Last active October 7, 2016 09:00
Conversion between Arabic and Roman numbers in Red
Red [
Purpose: "Arabic <-> Roman numbers converter"
Author: "Didier Cadieu"
Date: "07-Oct-2016"
]
; Lookup tables for conversion
table-r2a: reverse copy table-a2r: [1000 "M" 900 "CM" 500 "D" 400 "CD" 100 "C" 90 "XC" 50 "L" 40 "XL" 10 "X" 9 "IX" 5 "V" 4 "IV" 1 "I"]
roman-to-arabic: func [r [string!] /local a b e] [
@DideC
DideC / Livecode enhanced
Last active February 20, 2018 19:32
Based on Dockimbel VID livecode, this is a little more advanced version where you can define Red's values used by the VID code. The window is resizable and there is spliters to rearange space.
Red [
Title: "Simple GUI livecoding demo"
Author: "Nenad Rakocevic / Didier Cadieu"
File: %livecode.red
Version: 1.2.1
Needs: 'View
Usage: {
Type VID code in the bottom right area, you will see the resulting GUI components
rendered live on the left side and fully functional (events/actors/reactors working live).
The top right area let you define Red's values to be used in your VID code, even functions or anything.
@DideC
DideC / sparks.red
Last active June 15, 2016 09:02 — forked from qtxie/sparks.red
With just a little bit of colored sparks
Red [
Title: "Sparks demo"
Author: "Qingtian Xie"
File: %sparks.red
Tabs: 4
Needs: View
]
system/view/auto-sync?: no
@DideC
DideC / analog-clock.red
Created June 15, 2016 08:59 — forked from greggirwin/analog-clock.red
An analog clock for Red
Red [
Title: "Red O'clock"
Author: "Gregg Irwin"
]
degree-to-xy: func [rad "radius" deg "degrees"] [
as-pair (rad * sine deg) (rad * negate cosine deg)
]
sex-to-degree: func ["Sexagesimal to degrees" n] [n * 6]