var g = NewGraph2D( { BorderWidth: 5, DrawFunc: test } ); function test(g) { g.SetWindowWH( 0, 0, 600, 400 ); var grad = g.CreateLinearGradient( { X1: 0, Y1: 0, X2: 600, Y2: 400, Stops: [ { Pos: 0, Color: 'rgb(0,0,255)' }, { Pos: 1, Color: 'rgb(255,255,0)' } ] } ); g.SetBgColor( grad ); g.RectWH( 0, 0, 600, 200, 2 ); g.SetLinearGradientGeom( grad, { X1: 600, Y1: 400, X2: 0, Y2: 0 } ); g.Ellipse( 300, 300, 300, 100, 0, 2 ); }