I’ve been using degrafa for a while but can’t quite grasp how to fully utilize the RadielGradientFill.

Here’s what i want to achieve:

radial-gradient-red-black

It’s an elliptical gradient on a elliptical path. The center of a gradient is slightly off the horizontal x-axis and the radius of the circular gradient is bigger than that of the path.

Usually I create my vector graphics using Inkscape and then used   the generated SVG in xml format (you could do this by clicking the  xml icon – inkscape-xml-icon-toolbar)  in my degrafa objects.

Oh I know how to define simple radial gradients in degrafa but i could only produce circular gradients and i cant even change the x and y axis coordinates of the center.

I was quite frustrated because i dont know how to use the properties of the radial gradient fill to achieve the desired result. So I applied brute force, that is try – and – see method by defining one parameter and see how it affects the gradient to no avail.

Every once in a while I stop and search google for answers using vague keywords like: Degrafa RadialGradientFill  cx (coz the docs says you use this to offset the x-axis of your radial gradient).

And then finally i decided i have to see the code itself so that I could analyze where it happens, and what part of the code decides on how to draw the gradient.

So after downloading the degrafa source code, I saw on

com/degrafa/RadialGradientFill.as on line 174 (under the function

 override public function begin(graphics:Graphics, rc:Rectangle))

The culprit was you have to define  the cx, cy and radius of the fill rather than just the cx and cy.

Like this one:

< RadialGradientFill cx="{rx*1.10}" cy="{ry}" radiusX="{rx*1.11}" radiusY="{ry*1.44}">

where rx=this.width/2 and ry = this.height/2

I thought (radius) should have a default value. (I found out that this is not the case.. 😀 )

See! I’m learning!

Most of the times, I cannot find a direct solution/instructions/guide to simple things such as this one. For example degrafa.org/docs should have pointed out (specially for beginners like me) that cx and cy attributes do not make sense without defining the radius first.

I know, i know.. for most this maybe an obvious thing. But who knows, someone like me might have been stuck on this same problem too.. 😛

 

Cheers!

loving degrafa more and more

Advertisements