Jump to content
John Rostron

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

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 10, Affinity Photo 1.7 and Designer 1.7, (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Share this post


Link to post
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!

Share this post


Link to post
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 10, Affinity Photo 1.7 and Designer 1.7, (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Share this post


Link to post
Share on other sites

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

 

 

Share this post


Link to post
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 online2long.gif
Affinity Designer/Photo/Publisher 1.7.3.481 • Windows 10 Home (4th gen Core i3 CPU)
Affinity Photo for iPad 1.7.3.155 • Designer for iPad 1.7.3.1 • iOS 12.4.1 (iPad Air 2)

Share this post


Link to post
Share on other sites

Alfred to the rescue once again.

Thanks mate.


High-End Photographic Prints

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

These are the Terms of Use you will be asked to agree to if you join the forum. | 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.