From 1291e54a8b4f1ed1921c85e10ad79f2f450a35cf Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Tue, 8 Jan 2013 18:05:54 +0100 Subject: [PATCH] initial commit test with elm --- flame.elm | 49 ++++++++++++++++++++++ flame.html | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 flame.elm create mode 100644 flame.html diff --git a/flame.elm b/flame.elm new file mode 100644 index 0000000..b49c596 --- /dev/null +++ b/flame.elm @@ -0,0 +1,49 @@ +module Flame where + +import Random + + + +base03 = rgb 0 43 54 +base02 = rgb 7 54 66 +base01 = rgb 88 110 117 +base00 = rgb 101 123 131 +base0 = rgb 131 148 150 +base1 = rgb 147 161 161 +base2 = rgb 238 232 213 +base3 = rgb 253 246 227 +yellow = rgb 181 137 0 +orange = rgb 203 75 22 +red = rgb 220 50 47 +magenta = rgb 211 54 130 +violet = rgb 108 113 196 +blue = rgb 38 139 210 +cyan = rgb 42 161 152 +green = rgb 133 153 0 + +mybase = rgba 147 161 161 (2/3) + +point = filled mybase . rect 20 20 + +background w h = filled base3 ( rect w h (div w 2,div h 2)) + +nextint n = + let + a = 22695477 + c = 1 + m = 2^32 + in + (a*n + c) `rem` m + +randlist seed k = if (k<0) then [] else (nextint seed):randlist (nextint seed) (k-1) +randcouples seed k = if (k<0) then [] + else + let ns = nextint seed + nns = nextint ns + in (ns,nns):randcouples nns (k-1) + +scene (x,y) (w,h) = + let modpoint (x,y) = (rem x w,rem y h) + in collage w h $ background w h:map (point . modpoint) (randcouples (div y 10) (div x 10)) + +main = lift2 scene Mouse.position Window.dimensions diff --git a/flame.html b/flame.html new file mode 100644 index 0000000..e203c83 --- /dev/null +++ b/flame.html @@ -0,0 +1,117 @@ + +Flame
\ No newline at end of file