: Easy way to create repeating custom radial gradient? I want to create a simple repeating gradient for a Gradient Overlay effect in Photoshop. I had to manually create this: Is there an
I want to create a simple repeating gradient for a Gradient Overlay effect in Photoshop. I had to manually create this:
Is there an easier way to make a repeating pattern by designing a small one then extrapolating from it? If there is no way to design a gradient like this in the Gradient Editor, is there a way to simulate it (with the style set as Radial)?
More posts by @Bethany839
2 Comments
Sorted by latest first Latest Oldest Best
Create a new layer, and execute the following code as a script. It will create a new layer style with 0% fill and the new gradient as an overlay. The for-loop towards the bottom creates a 21-stop gradient in the foreground color. Every other stop alternates between opaque and transparent.
You can then save the gradient as a preset within the Layer Styles menu.
var idsetd = charIDToTypeID( "setd" );
var desc120 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref29 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref29.putEnumerated( idLyr, idOrdn, idTrgt );
desc120.putReference( idnull, ref29 );
var idT = charIDToTypeID( "T " );
var desc121 = new ActionDescriptor();
var idfillOpacity = stringIDToTypeID( "fillOpacity" );
var idPrc = charIDToTypeID( "#Prc" );
desc121.putUnitDouble( idfillOpacity, idPrc, 0.000000 );
var idLefx = charIDToTypeID( "Lefx" );
var desc122 = new ActionDescriptor();
var idScl = charIDToTypeID( "Scl " );
var idPrc = charIDToTypeID( "#Prc" );
desc122.putUnitDouble( idScl, idPrc, 100.000000 );
var idGrFl = charIDToTypeID( "GrFl" );
var desc123 = new ActionDescriptor();
var idenab = charIDToTypeID( "enab" );
desc123.putBoolean( idenab, true );
var idMd = charIDToTypeID( "Md " );
var idBlnM = charIDToTypeID( "BlnM" );
var idNrml = charIDToTypeID( "Nrml" );
desc123.putEnumerated( idMd, idBlnM, idNrml );
var idOpct = charIDToTypeID( "Opct" );
var idPrc = charIDToTypeID( "#Prc" );
desc123.putUnitDouble( idOpct, idPrc, 100.000000 );
//Gradient Definition
var idGrad = charIDToTypeID( "Grad" );
var desc34 = new ActionDescriptor();
var idNm = charIDToTypeID( "Nm " );
desc34.putString( idNm, "Custom" );
var idGrdF = charIDToTypeID( "GrdF" );
var idGrdF = charIDToTypeID( "GrdF" );
var idCstS = charIDToTypeID( "CstS" );
desc34.putEnumerated( idGrdF, idGrdF, idCstS );
var idIntr = charIDToTypeID( "Intr" );
desc34.putDouble( idIntr, 4096.000000 );
var idClrs = charIDToTypeID( "Clrs" );
var list5 = new ActionList();
var desc35 = new ActionDescriptor();
var idType = charIDToTypeID( "Type" );
var idClry = charIDToTypeID( "Clry" );
var idFrgC = charIDToTypeID( "FrgC" );
desc35.putEnumerated( idType, idClry, idFrgC );
var idLctn = charIDToTypeID( "Lctn" );
desc35.putInteger( idLctn, 0 );
var idMdpn = charIDToTypeID( "Mdpn" );
desc35.putInteger( idMdpn, 50 );
var idClrt = charIDToTypeID( "Clrt" );
list5.putObject( idClrt, desc35 );
var desc38 = new ActionDescriptor();
var idType = charIDToTypeID( "Type" );
var idClry = charIDToTypeID( "Clry" );
var idFrgC = charIDToTypeID( "FrgC" );
desc38.putEnumerated( idType, idClry, idFrgC );
var idLctn = charIDToTypeID( "Lctn" );
desc38.putInteger( idLctn, 4096 );
var idMdpn = charIDToTypeID( "Mdpn" );
desc38.putInteger( idMdpn, 50 );
var idClrt = charIDToTypeID( "Clrt" );
list5.putObject( idClrt, desc38 );
desc34.putList( idClrs, list5 );
// Gradient Stops
var idTrns = charIDToTypeID( "Trns" );
var list6 = new ActionList();
// Create 21 stops
for (i = 0; i < 22; i++){
var desc39 = new ActionDescriptor();
var idOpct = charIDToTypeID( "Opct" );
var idPrc = charIDToTypeID( "#Prc" );
// Alternate opacity from 100 to 0 every other stop
desc39.putUnitDouble( idOpct, idPrc, 100.000000 * ((i+1)%2) );
var idLctn = charIDToTypeID( "Lctn" );
// Distribute stops evenly from 0 to 4096
desc39.putInteger( idLctn, 4096 * (i/20));
var idMdpn = charIDToTypeID( "Mdpn" );
// Set midpoint halfway between stops
desc39.putInteger( idMdpn, 50 );
var idTrnS = charIDToTypeID( "TrnS" );
list6.putObject( idTrnS, desc39 );
}
desc34.putList( idTrns, list6 );
var idGrdn = charIDToTypeID( "Grdn" );
desc123.putObject( idGrad, idGrdn, desc124 );
var idAngl = charIDToTypeID( "Angl" );
var idAng = charIDToTypeID( "#Ang" );
desc123.putUnitDouble( idAngl, idAng, 90.000000 );
var idType = charIDToTypeID( "Type" );
var idGrdT = charIDToTypeID( "GrdT" );
var idLnr = charIDToTypeID( "Rdl " );
desc123.putEnumerated( idType, idGrdT, idLnr );
var idRvrs = charIDToTypeID( "Rvrs" );
desc123.putBoolean( idRvrs, false );
var idAlgn = charIDToTypeID( "Algn" );
desc123.putBoolean( idAlgn, true );
var idScl = charIDToTypeID( "Scl " );
var idPrc = charIDToTypeID( "#Prc" );
desc123.putUnitDouble( idScl, idPrc, 100.000000 );
var idOfst = charIDToTypeID( "Ofst" );
var desc154 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idPrc = charIDToTypeID( "#Prc" );
desc154.putUnitDouble( idHrzn, idPrc, 0.000000 );
var idVrtc = charIDToTypeID( "Vrtc" );
var idPrc = charIDToTypeID( "#Prc" );
desc154.putUnitDouble( idVrtc, idPrc, 0.000000 );
var idPnt = charIDToTypeID( "Pnt " );
desc123.putObject( idOfst, idPnt, desc154 );
var idGrFl = charIDToTypeID( "GrFl" );
desc122.putObject( idGrFl, idGrFl, desc123 );
var idLefx = charIDToTypeID( "Lefx" );
desc121.putObject( idLefx, idLefx, desc122 );
var idLyr = charIDToTypeID( "Lyr " );
desc120.putObject( idT, idLyr, desc121 );
executeAction( idsetd, desc120, DialogModes.NO );
Play around with the values, I think you'll find it quite useful. Here's a quick example:
Scripting a gradient with Illustrator is much more straightforward. But of course, you can't manipulate (or animate, or...) the gradient inside of Photoshop. Save the following to a .js file and run through File > Scripts > Other Script...
// Create a color
var startColor = new RGBColor();
startColor.red = 0;
startColor.green = 0;
startColor.blue = 0;
// Create a new gradient
// A new gradient always has 2 stops
var newGradient = app.activeDocument.gradients.add();
// Name the gradient to be the current time in POSIX
newGradient.name = new Date().getTime().toString();
newGradient.type = GradientType.RADIAL;
// Insert a number of intermediate stops. Here, 17.
for (i=0; i < 18; i += 1) {
newGradient.gradientStops.add();
}
for (var i = 0; i < newGradient.gradientStops.length; i++){
// Distribute each stop equally from 0 to 100
newGradient.gradientStops[i].rampPoint = i * (100/(newGradient.gradientStops.length-1));
// Each Midpoint is halfway to the next
newGradient.gradientStops[i].midPoint = 50;
// All colors are startColor
newGradient.gradientStops[i].color = startColor;
// Alternate the opacity between 0 and 100
newGradient.gradientStops[i].opacity = ((i + 1) % 2) * 100;
}
It creates a gradient like this:
Using Illustrator
Step 1: The circles
The "concentric rings" shape is easily created with the Polar Grid Tool. Enable the tool, and Click anywhere in the document to bring up the tool's options. I'm using the following values:
5 Concentric Dividers will create 6 evenly spaced circles for us:
Now, for the gradient part. This is easier in recent versions (CS6+) because they introduced gradients to strokes. In earlier versions, we can use an Art Brush but the process is rather clunky.
Step 2a: For CS6+
I don't have CS6, so I can't show you exactly how to set it up, but I can point you in the right direction. Apply a gradient to the stroke by following Scott's instructions here. You'll want to change it so that the gradient is applied across the stroke, which is the button I've circled below:
That should do it for CS6+.
Step 2b: For CS5 and Below
Create a square, apply your desired gradient to it as a fill
Expand the gradient using Object → Expand
Delete the clipping mask within the expanded group
Select the group of gradient, create a new Art Brush from it
Apply your Art Brush to all the rings
I've been short with these instructions in hope that you have CS6, so feel free to ask for clarification if any of that is unclear
Step 3: Bring it into Photoshop
You should have ended up with something like this depending on the gradient you used:
Save it and File → Place it into your Photoshop document and you're done.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.