Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let colors = [
- 230,229,15
- 243,209,0
- 246,132,0
- 239,55,1
- 219,29,3
- 194,8,83
- 117,26,123
- 56,24,100
- 43,38,161
- 2,98,208
- 0,153,179
- 0,174,66
- 39,185,22
- 103,196,2
- 173,214,0]
- #r "System.Drawing.dll"
- open System.Drawing
- let brushes =
- colors |> List.map (fun (r,g,b) -> new SolidBrush(Color.FromArgb(255,r,g,b)) )
- let xs = [3;2;1;4;2;1;4;2;1;4;2;1;4;2;1]
- let ys = [0;10;14;8;11;6;9;4;7;2;5;12;4;13;1]
- let width,height=476,450
- let w,h = 14,30
- let draw k =
- let image = new Bitmap(width,height)
- use graphics = Graphics.FromImage(image)
- for y = 0 to 14 do
- List.zip xs ys
- |> List.mapi (fun i xy -> i,xy)
- |> List.scan (fun x (i,(dx,dy)) ->
- let k = if i%2 = 0 then -k else k
- let brush = brushes.[(15+(y + dy+k))%15]
- graphics.FillRectangle(brush, x*w, y*h, w*dx,h)
- x + dx
- ) 0 |> ignore
- image
- (*
- #r "System.Windows.Forms.dll"
- open System.Windows.Forms
- let show () =
- let image = draw ()
- let form = new Form (Text="15", Width=width+16, Height=height+36)
- let picture = new PictureBox(Dock=DockStyle.Fill, Image=image)
- do form.Controls.Add(picture)
- form.ShowDialog() |> ignore
- show()
- *)
- #r @"Gif.Components.dll"
- open Gif.Components
- let encoder = AnimatedGifEncoder()
- if encoder.Start(@"c:\app\15.gif") then
- encoder.SetFrameRate(2.0f)
- encoder.SetRepeat(0)
- for i = 0 to 15 do
- encoder.AddFrame(draw i) |> ignore
- encoder.Finish() |> ignore
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement