Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace AndroidApp
- open Android.App
- open Android.Graphics
- open Android.Widget
- [<Activity(Label = "Bubbles", MainLauncher = true)>]
- type ArtActivity() =
- inherit Activity()
- override this.OnCreate(bundle) =
- base.OnCreate(bundle)
- let layout = new LinearLayout(this)
- layout.Orientation <- Orientation.Horizontal
- let width, height = 1280, 720
- let bm = Bitmap.CreateBitmap(width,height,Bitmap.Config.Argb8888)
- let view = new ImageView(this)
- view.SetImageBitmap(bm)
- layout.AddView(view)
- this.SetContentView(layout)
- let colors = [|Color.Red; Color.Green; Color.Blue; Color.Yellow|]
- let canvas = new Canvas(bm)
- let rand = System.Random()
- for i = 1 to 400 do
- let paint = new Paint(Color=colors.[rand.Next(colors.Length)])
- paint.Alpha <- rand.Next(255)
- let x, y = rand.Next(width), rand.Next(height)
- let r = 10 + rand.Next(40)
- canvas.DrawCircle(float32 x,float32 y,float32 r,paint)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement