Jump to content

Vexillomorphic transformations (Flag-Waving) in Photo


Recommended Posts

This is an extension of my tutorial on Trigonometrical transformations using Filter > Distort > Equations. This one is focused on simulating flags waving in a light  wind. Flags have an advantage in that they have a standard shape (width is twice the height).

Edit: I have been told that this is not true. I stand corrected.

To get the desired waving, I apply a sine transformation to each of the x and y-axes. The equations to apply are:

x=(x+20*sin(360*y/h))/c-100*b
y=y+a*(h/10)*sin(2*360*x/w)-(x/w)*h/10

I add a sideways sine wave to the x-axis as a function of the y-position. When the flag waves, the visual width is decreased, so I have added a parameter c which scales the width of the flag. The parameter b is an offset, since the left-hand corners of the flag can otherwise move outside the canvas.

The y-axis also has a sine wave, depending on the x-position. The parameter a determines the magnitude of this sine wave. The final expression (-(x/w)*h/10) ensures that the fly  (RHS in this case) is below the hoist (LHS here). (Definitions: hoist is the part next to the flagpole; fly is the part flying free.)

Here is the UK Union Flag, plus a bit of extra space above and below to create room:

5aa505737a6d7_UnionFlag.png.d935e7821017a941e6cb7c0bf92150bf.png

And waving in the breeze:

5aa50572d1f81_UnionFlagWave.png.b78245a340d299518c53e8545f5e55af.png

And here is a macro that implements these transformations:

FlagWaving.afmacro

And a macro library containing the single macro:

FlagWaving.afmacros

The parameters should appear when you run the macro. Parameter a controls the vertical wave; parameter b controls the horizontal offset; parameter c controls the overall horizontal scaling.

This macro will not simulate a flag in too strong a wind, where the parts overlap!

John

 

Windows 11, Affinity Photo 2.4.2 Designer 2.4.2 and Publisher 2.4.2 (mainly Photo).

CPU: Intel Core i5 8500 @ 3.00GHz. RAM: 32.0GB  DDR4 @ 1063MHz, Graphics: 2047MB NVIDIA GeForce GTX 1050

Link to comment
Share on other sites

Quote

Flags have an advantage in that they have a standard shape (width is twice the height).

 

Sorry but this is just not correct. Flags come in all sorts of different shapes and sizes. Just Google "flags" and take a look!

Acer XC-895 : Core i5-10400 Hexa-core 2.90 GHz :  32GB RAM : Intel UHD Graphics 630 : Windows 10 Home
Affinity Publisher 2 : Affinity Photo 2 : Affinity Designer 2 : (latest release versions) on desktop and iPad

"Beware of false knowledge, it is more dangerous than ignorance." (GBS)

Link to comment
Share on other sites

54 minutes ago, PaulEC said:

 

Sorry but this is just not correct. Flags come in all sorts of different shapes and sizes. Just Google "flags" and take a look!

You are quite right. I was still remembering what I learned as a Scout sixty years ago. It was probably incorrect then!

John

Windows 11, Affinity Photo 2.4.2 Designer 2.4.2 and Publisher 2.4.2 (mainly Photo).

CPU: Intel Core i5 8500 @ 3.00GHz. RAM: 32.0GB  DDR4 @ 1063MHz, Graphics: 2047MB NVIDIA GeForce GTX 1050

Link to comment
Share on other sites

  • 4 months later...

Any chance someone could convert this macro to a macroS file, so that it can be used on Photo for iPad?

Any help appreciated, as I don’t have my Mac available to convert it myself.

Thank you.

High-End Photographic Prints

 

 

Link to comment
Share on other sites

56 minutes ago, DesignMeister said:

Any chance someone could convert this macro to a macroS file, so that it can be used on Photo for iPad?

Library (*.macros) file duly attached. :)

Flag-waving.afmacros

Alfred spacer.png
Affinity Designer/Photo/Publisher 2 for Windows • Windows 10 Home/Pro
Affinity Designer/Photo/Publisher 2 for iPad • iPadOS 17.5.1 (iPad 7th gen)

Link to comment
Share on other sites

Alfred to the rescue once again.

Thanks mate.

High-End Photographic Prints

 

 

Link to comment
Share on other sites

  • 5 years later...

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.