Hi James! Wow, that's amazing!
Thanks a lot! Regards Michael > -----Ursprungliche Nachricht----- > Von: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]Im Auftrag von James Newton > Gesendet: Sonntag, 20. Januar 2002 17:13 > An: [EMAIL PROTECTED] > Betreff: Re: <lingo-l> radial gradient with Lingo > > > Michael von Aichberger <[EMAIL PROTECTED]> wrote: > > I want to create a radial gradient with Lingo... > > Calculating the color change is not the problem, but how do I > calculate the > > pixels for the concentric circles? > > Hi Michael, > > Why not let Director do this for you by using the image of a Vector Shape > member? > > Here's a handler that allows you to create a radial gradient with a given > center point, center color, outer color and radius. > > You can test it by copying the handler into a Movie Script and typing the > following lines of code in the Message window: > > > tImage = image(128, 128, 8, #Web216) > > -- Remove hard returns from the following line: > mRadialGradient([#radius: 128, #image: tImage, #centerColor: rgb(255, 255, > 0), #outerColor: rgb(255, 0, 0), #centerLoc: point(64, 0)]) > > new(#bitmap).image = tImage > > > You can get a much smoother gradient if you use this for the first line: > > tImage = image(128, 128, 32) > > > Cheers, > > James > > > ------------------------------------------------------------------ > ---------- > > > on mRadialGradient(aDataList) ---------------------------------------- > -- INPUT: <aDataList> should be a property list with the format: > -- [#image: <image object>, > -- #centerLoc: <point>, > -- #centerColor: <color object>, > -- #outerColor: <color object>, > -- #diameter: <positive integer or float>, > -- #options: <copyPixels-style property list>] > -- ACTION: Copies a circular image with a radial gradient to the > -- image object defined by aDataList.image > -------------------------------------------------------------------- > > -- Unpack the data in the property list (no error checking) > tImage = aDataList.image > tRadius = aDataList.radius > tCenter = aDataList.centerLoc - tRadius > tFillColor = aDataList.centerColor > tEndColor = aDataList.outerColor > tOptions = aDataList[#options] > if ilk(tOptions) <> #propList then > tOptions = [:] > end if > > tSourceRect = rect(0, 0, tRadius * 2, tRadius * 2) > > -- Create a temporary circular vector shape > tVectorShape = new(#vectorShape) > tVectorShape.vertexList = [ \ > [#vertex: point(-50, -50), \ > #handle1: point(28, -28), #handle2: point(-28, 28)], \ > [#vertex: point(50, -50), \ > #handle1: point(28, 28), #handle2: point(-28, -28)], \ > [#vertex: point(50, 50), \ > #handle1: point(-28, 28), #handle2: point(28, -28)], \ > [#vertex: point(-50, 50), \ > #handle1: point(-28, -28), #handle2: point(28, 28)]] > > -- Set the properties to give a smooth gradient from center to edge > tVectorShape.closed = TRUE > tVectorShape.strokeWidth = 0 > tVectorShape.fillMode = #gradient > tVectorShape.gradientType = #radial > tVectorShape.fillCycles = 2 > tVectorShape.fillColor = tFillColor > tVectorShape.endColor = tEndColor > tVectorShape.defaultRect = tSourceRect > > -- Copy the image of the vectorShape to aDataList.image > tVectorImage = tVectorShape.image > tDestRect = tSourceRect.offset(tCenter.locH, tCenter.locV) > tImage.copyPixels(tVectorImage, tDestRect, tSourceRect, tOptions) > > tVectorShape.erase() > end mRadialGradient > > > [To remove yourself from this list, or to change to digest mode, > go to http://www.penworks.com/lingo-l.cgi To post messages to > the list, email [EMAIL PROTECTED] (Problems, email > [EMAIL PROTECTED]). Lingo-L is for learning and helping > with programming Lingo. Thanks!] > [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
