Jump to content
You must now use your email address to sign in [click for more info] ×

Applying gradient stroke to multiple lines as individual objects


Recommended Posts

Hi, I've searched extensively for a solution to this but can't find anything that works.

I have a vector graphic with several horizontal lines; each line has bumps and 'ridges' of varying heights and no two lines are the same. I want to apply a gradient to each individual horizontal line so that the bottom/flat part is one colour and the peaks/ridges are another colour - like the two lines near the bottom of this image, which I did manually with gradient tool.

image.png.a8f6a3e060bada8bf07ec9b0bcdbc665.png

How can I apply that same style to the other lines? It is not practical to do it manually as there are 80 lines altogether. I have tried the following without success:

  • Applying the gradient swatch to other lines. This only applies the gradient horizontally (see the line in the middle of the image) rather than vertically; if I try to rotate the gradient, it doesn't work, I think because the rotation is based on the width of the object and isn't limiting itself to the height of the object (this is hard to describe)
  • Using 'create style' for my gradient stroke and applying the new style to other lines. This doesn't do anything; the lines stay white. It doesn't do anything if I try to draw a circle or square as a fresh shape, either.
  • using 'create style' for a gradient fill and applying it to other lines. This kind of works but I still need to apply the gradient to each line manually then tinker with the stroke/fill options to set it correctly.
  • Selecting one of the correctly styled lines, clicking copy, then trying to 'paste style' to another line. As above, doesn't do anything, lines stay white, doesn't work on newly created shapes.
  • Selecting all of the lines and using the gradient tool on them in one go. This just treats all of the lines as a group, so across the whole image the ones towards the bottom are purple and the lines at the top are white rather than styling each line individually.

If it matters:

  • I've tried the above with the lines grouped and as individual layers
  • The lines are open-ended rather than closed shapes

Ideas, please! Grateful for any insight.

Edited by robac
Added further information
Link to comment
Share on other sites

Hi @robac, Welcome to the Affinity Forums!

If I understand right you have two options. One via copy/paste… 

  1. Select one curve with the desired design.
  2. Choose menu Edit > Copy.
  3. Select all unformatted objects.
  4. Choose menu Edit > Paste as Style.

Bildschirmfoto2024-08-17um16_46_51.thumb.jpg.3231e85c37710c742c657bca0918d67f.jpg

… the other way via a saved style:

  1. Select one curve which is designed as desired.
  2. In the "Styles" Panel choose the menu option "Add Style from Selection".
  3. Apply the new style to other objects.

Bildschirmfoto2024-08-17um16_49_34.thumb.jpg.6d29c0f04220dfda8e2dfd43fffb9dbc.jpg

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

Link to comment
Share on other sites

14 minutes ago, thomaso said:

Hi @robac, Welcome to the Affinity Forums!

If I understand right you have two options. One via copy/paste… 

  1. Select one curve with the desired design.
  2. Choose menu Edit > Copy.
  3. Select all unformatted objects.
  4. Choose menu Edit > Paste as Style.

… the other way via a saved style:

  1. Select one curve which is designed as desired.
  2. In the "Styles" Panel choose the menu option "Add Style from Selection".
  3. Apply the new style to other objects.

 

The OP tried that. The functionality is broken in V2.

Link to comment
Share on other sites

Posted (edited)
36 minutes ago, lepr said:

The functionality is broken in V2.

Good point - I forgot to say I'm on v2. And it doesn't look like I can roll back to v1 and try it there as I only ever purchased v2.

Edited by robac
grammar
Link to comment
Share on other sites

Moonshot idea

Assuming all lines have vertical equal distance, and layer stack is organized from top to bottom matching y position.

  1. align all lines to bottom
  2. apply gradient to all lines
  3. move top line to original y position
  4. select all lines and distribute them in equal distance

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

My posts focus on technical aspects and leave out most of social grease like „maybe“, „in my opinion“, „I might be wrong“ etc. just add copy/paste all these softeners from this signature to make reading more comfortable for you. Otherwise I’m a fine person which respects you and everyone and wants to be respected.

 

Link to comment
Share on other sites

2 hours ago, lepr said:

The OP tried that. The functionality is broken in V2.

Thanks and sorry for not reading carefully!

@robac, in V2 there is another option to transfer a style between objects: The Style Picker Tool. According this thread it appears to work in a previous V2 version at least:

Possibly there is also a V2 version that does not have the two issues mentioned above. In this case you might try to download the according installer, if you'll get them offered for download in a "Previous versions" list in your account, like so:

Bildschirmfoto2024-08-17um18_17_47.thumb.jpg.8e4eb6b3122fadf28c67b1df5232b93a.jpg

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

Link to comment
Share on other sites

8 minutes ago, NotMyFault said:

Assuming all lines have vertical equal distance

They don't, but perhaps this will help someone else!

7 minutes ago, thomaso said:

in V2 there is another option to transfer a style between objects: The Style Picker Tool.

Thanks, I'll take a look.

KarinC, maybe it's paste style specifically in relation to gradient strokes that's broken..? idk, my Designer use cases are such that I haven't had to use that particular feature before.

Link to comment
Share on other sites

1 minute ago, robac said:

maybe it's paste style specifically in relation to gradient strokes that's broken..?

Maybe. @lepr or another V2 user might know what specific function in detail has been reported & logged as a bug for your issues.

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

Link to comment
Share on other sites

7 minutes ago, NotMyFault said:

Moonshot idea

Assuming all lines are same width, and vertical equal distance.

  1. align all lines to bottom
  2. apply gradient to all lines
  3. move top line to original y position
  4. select all lines and distribute them in equal distance

Brilliant. Just a couple of extra thoughts:

Set the stroke of all the lines to white. 

Layer>Alignment>Align bottom

Select all the lines in the Layers panel and Group them.

Make sure the Group is selected.

Switch to the Gradient tool, set the Context to Stroke, Type to Linear, set colours as required.

Draw the gradient over the group, rotate so it's vertical:

Screenshot2024-08-17at17_44_16.thumb.png.c5272d0ba22d8b1c475ccf66c3cc54e3.png

 

 

Switch to the Move tool, Ungroup.

Distribute the individual lines as required:

Screenshot2024-08-17at17_47_05.thumb.png.2d5dd8e51056834b5bec8f496cc44122.png

 

@robac in your screen shot the left-hand ends of the lines are equally distributed vertically, so I think this should work.

 

 

Affinity Photo 2.5.3,  Affinity Designer 2.5.3, Affinity Publisher 2.5.3, Mac OSX 14.5, 2018 MacBook Pro 15" Intel.

Link to comment
Share on other sites

Pasting the gradient style in the stroke is broken. Even though the gradient is showing in the swatches I only get one end of the gradient in the stroke and I can't adjust it when selecting the stroke in the appearance panel. 

If I expand the stroke then it works. Maybe you can do that. Select all of the strokes, choose layer>expand stroke then you can paste the gradient style to all of them.

Link to comment
Share on other sites

12 minutes ago, robac said:

They don't, but perhaps this will help someone else!

You can enforce that by using a helper rectangle object per line. Yes, I know still extra step  but this can be automated by macros.

 

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

My posts focus on technical aspects and leave out most of social grease like „maybe“, „in my opinion“, „I might be wrong“ etc. just add copy/paste all these softeners from this signature to make reading more comfortable for you. Otherwise I’m a fine person which respects you and everyone and wants to be respected.

 

Link to comment
Share on other sites

5 minutes ago, h_d said:

Distribute the individual lines as required:

Unfortunately a found no way to distribute layers of unequal heights to a grid. All existing layer distribution are relative to layer height.

so extra step is needed, e.g. adding a parent container rectangle of fixed size.

 

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

My posts focus on technical aspects and leave out most of social grease like „maybe“, „in my opinion“, „I might be wrong“ etc. just add copy/paste all these softeners from this signature to make reading more comfortable for you. Otherwise I’m a fine person which respects you and everyone and wants to be respected.

 

Link to comment
Share on other sites

15 minutes ago, NotMyFault said:

no way to distribute layers of unequal heights to a grid

Ah yes, I see what you mean. Pity.

Affinity Photo 2.5.3,  Affinity Designer 2.5.3, Affinity Publisher 2.5.3, Mac OSX 14.5, 2018 MacBook Pro 15" Intel.

Link to comment
Share on other sites

1 hour ago, lepr said:

Thanks. That's what I meant because that's what the OP was trying to do.

Sorry, I was verifying it that it was happening for me. Expand to stroke is the best way around it. Just be sure to make a copy if you want to edit the lines.

Link to comment
Share on other sites

2 minutes ago, KarinC said:

Sorry, I was verifying it that it was happening for me.

No need to be sorry :)
I think there has been a misunderstanding. I was genuinely thanking you for clarifying what I meant by broken functionality.

 

Link to comment
Share on other sites

Thanks all for trying to help. There are a few ideas I haven't tried yet and can attempt later this week/next weekend. I had been starting to play around with expand stroke but didn't get very far before the work week came around again.

As a placeholder 'workaround', which definitely does not work if there are hundreds of lines, I managed to get the look I was after by setting my gradient on the *fill* rather than the stroke and creating a style of it, then applying that style to my lines (so it appeared as a fill under the ridges), then swapping the fill and stroke (to make the stroke take the gradient style), then applying a black fill. I had to do all 80 lines manually, which ended up only taking a few minutes, though I'd still rather have a one-and-done way of doing it for next time!

Link to comment
Share on other sites

On 8/17/2024 at 6:37 PM, KarinC said:

Paste as style is broken in v2? I use it all the time in v2.

edit: Designer v2.4.2

Did it break in 2.5?

This wasn't answered yet, right? – It might be faster to install an earlier app version than editing 80 objects individually, @robac.

41 minutes ago, robac said:

then swapping the fill and stroke (to make the stroke take the gradient style), then applying a black fill. I had to do all 80 lines manually, which ended up only taking a few minutes, though I'd still rather have a one-and-done way of doing it for next time!

If you have APhoto + if next time the "Paste Style" issue will not be fixed, possibly the "Links" Panel may be a workaround for less repeated settings of stroke & fill:

Bildschirmfoto2024-08-19um11_10_23.jpg.4fae53980384948c9d072f1b6e6e6c2e.jpg

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

Link to comment
Share on other sites

Might this work for your situation - leave the lines as black strokes, select them all and apply a Gradient Overlay FX? You can set the orientation to 90 degrees so the overlay is applied vertically. You can fine tune the FX on one line and then use Copy/Paste FX to apply it to all the others.

There are a couple of downsides:

1. The "length" of the gradient is set relative to each particular object, so the "top" of a line will always be one end of the gradient and the "bottom" will be at the other end - even if the absolute height difference is much less than for the other lines. Even a perfectly horizontal line will have the top edge in one colour and the bottom edge the other (see pic). You might be able to finesse this with the scale and offset adjustments in the FX panel.

2. I believe using FX will result in rasterisation on export.

image.png.5190edb56939d6c56f6a28587f4e2fa8.png

Link to comment
Share on other sites

3 hours ago, thomaso said:

This wasn't answered yet, right? – It might be faster to install an earlier app version than editing 80 objects individually, @robac.

 

 

I confirmed that this one type of paste style is also broken in 2.4.2

Link to comment
Share on other sites

On 8/17/2024 at 6:37 PM, KarinC said:

Paste as style is broken in v2? I use it all the time in v2.

edit: Designer v2.4.2

2 minutes ago, KarinC said:

I confirmed that this one type of paste style is also broken in 2.4.2

So your first quoted info was a mistake? – Or what do you mean by "this one type of paste style", – are there various 'types' of the menu command "Paste Style", or do you mean 'gradients' only while other stroke designs work?

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

Link to comment
Share on other sites

1 hour ago, thomaso said:

So your first quoted info was a mistake? – Or what do you mean by "this one type of paste style", – are there various 'types' of the menu command "Paste Style", or do you mean 'gradients' only while other stroke designs work?

No, my first quoted info wasn't a mistake. I use Copy, then paste as style all the time so I thought it was working. After I posted that I tried copy and paste a gradient stroke style to another stroke and it didn't work. I got one end of the gradient which was not adjustable. I posted that correction. All of the "paste style" works that I've tried except that one - pasting the gradient of a stroke. I found that if I expand the stroke you can paste the style to the expanded stroke. Strangely I found, but didn't post, that I could copy the gradient of the stroke, then paste as style to an expanded stroke and it put the gradient in as a fill which I didn't expect.

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.