Stack Posted April 25 Share Posted April 25 I'm trying to create gradient text for a business card project, and I came across this old post from 2013. The code has been adapted and is working, however our gradient is a gold color on the left and right, white in the middle: Our work around has been to create two rules; "Address 1 &Address 2" is one rule, ", City, State ZIP" is the other rule and the Start/End colors are reversed for each. Both are inserted and centered in a text box so it looks like the gradient transitions gold-white-gold. Obviously this doesn't look too great, the white portion won't always be centered within the text box since the Addresses and City/State/Zip will almost always have different character lengths. Is there a way to adapt the code to include a third (or more) color to the gradient? Quote Link to comment Share on other sites More sharing options...
Stack Posted April 25 Author Share Posted April 25 Tried to update the post above with the code but it was too late. Below is the code from our template, for reference: var FieldName= "CompleteAddress"; var End = [1,1,1,0]; var Start = [15,28,62,0]; var FieldLength = Len(Rule(FieldName)); var StepCyan = (End[0]-Start[0])/FieldLength; var StepMagenta = (End[1]-Start[1])/FieldLength; var StepYellow = (End[2]-Start[2])/FieldLength; var StepBlack = (End[3]-Start[3])/FieldLength; var myColor; var Result = "<span>"; // Build Colors for Text for (c = 0; c < FieldLength; c++) { myColor = new FusionProColor("Gradient_01_"+c, Start[0]+(StepCyan*c), Start[1]+(StepMagenta*c), Start[2]+(StepYellow*c), Start[3]+(StepBlack*c)); } // Build resulting string for (c = 0; c < FieldLength; c++) { if (Asc(Mid(Rule(FieldName), c+1, 1)) == 32) { // Special case the space character Result = Result + " "; // Use " " for a breaking space } else if (Asc(Mid(Rule(FieldName), c+1, 1)) == 38) { // Special case the ampersand character Result = Result + "&"; } else { Result = Result + '<color name="Gradient_01_'+c+'">'+Mid(Rule(FieldName), c+1, 1); } } Result = Result + "<\span>"; return Result; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.