Jump to content

TR's ZigZag Plugin V1.1


Recommended Posts

It Zigs! It Zags! It's a Ripple Plugin!


Version 1.1 includes Vertical Zig Zagging


 


 


Menu: Effects->Distort


 


The Modulator modifies the Carrier Amplitude.


 


ZZMenu.PNG?raw=1


 


The Example


ZigZag.png?raw=1


 


Valley of the Gods


ValleyoftheGods.png?raw=1


 


 


The Code


Hidden Content:



// Submenu: Distort
// Name: TR's ZigZag
// Title: TR's ZigZag - v1.1
// Author: TechnoRobbo
// URL: http://www.technorobbo
#region UICode
double Amount1 = 10; // [1,100] Carrier Frequency
double Amount2 = 0.5; // [0,3] Carrier Amplitude
double Amount3 = 0.5; // [0,1] Carrier Offset
double Amount4 = 2; // [1,100] Modulator Frequency
double Amount5 = 0.15; // [0,3] Modulator Amplitude
double Amount6 = 0; // [0,1] Modulator Offset
bool Amount7 = false; // [0,1] Vertical ZigZag
#endregion


void Render(Surface dst, Surface src, Rectangle rect)
{
    // Delete any of these lines you don't need
    Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    
    double CF=0,MF=0;
    if (!Amount7) {
        CF = selection.Width /Amount1;
        MF = selection.Width /Amount4;
    }else{
        CF = selection.Height /Amount1;
        MF = selection.Height /Amount4;        
    }
            
    double CA = CF * Amount2;
    double COF = CF * Amount3;
    double MA= MF * Amount5;
    double MOF = CF * Amount6;    
    
    
    ColorBgra CurrentPixel;
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        for (int x = rect.Left; x < rect.Right; x++)
        {
            double rad,off;
            if (!Amount7) {
                rad = ((x + COF) % CF) / CF * 2 * Math.PI ;
                off =Math.Cos(rad) * CA;
                rad = ((x + MOF) % MF) / MF * 2 * Math.PI ;
                off =y + Math.Cos(rad) * MA + off;
                CurrentPixel = src.GetBilinearSampleClamped(x,(int)off);
            }else{
                rad = ((y + COF) % CF) / CF * 2 * Math.PI ;
                off =Math.Cos(rad) * CA;
                rad = ((y + MOF) % MF) / MF * 2 * Math.PI ;
                off =x + Math.Cos(rad) * MA + off;
                CurrentPixel = src.GetBilinearSampleClamped((int)off,y);


            }
            dst[x,y] = CurrentPixel;
        }
    }
}
 


 


 


TRsZigZag.zip

Edited by TechnoRobbo
  • Upvote 1

Go out there and be amazing. Have Fun, TR
TRsSig.png?raw=1
Some Pretty Pictures Some Cool Plugins

Link to comment
Share on other sites

I'm liking this.  A nice effect.  Many thanks for the update TechnoRobbo.

 

Is your source code up-to-date too?

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.

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.

 Share

×
×
  • Create New...