Jump to: Board index » General » Fusion

How to draw a sine wave

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

Andy Weimer

  • Posts: 10
  • Joined: Thu Dec 14, 2017 9:51 am

How to draw a sine wave

PostSat Feb 03, 2018 10:42 am

Hi everyone

I am trying replicate Kelvin's tide prediction machine where I need to to make a comp that draws a sine wave.
(see graphic)

I am not happy with the result of taking a line and displacing it with a ramp.

Any ideas how I could make this with an expression or script would be greatly appreciated.

Thanks.

Andy
Attachments
Screen Shot 2018-02-03 at 11.35.13.png
Screen Shot 2018-02-03 at 11.35.13.png (173.97 KiB) Viewed 2490 times
Offline

Okke Verbart

  • Posts: 290
  • Joined: Tue Jan 17, 2017 8:40 pm

Re: How to draw a sine wave

PostMon Feb 05, 2018 7:07 pm

Immediate thought for me would be something with the custom tool. For example, like the below. Just quickly put together as an example and would of course require some tweaking to fit your purpose:

Code: Select all
{
   Tools = ordered() {
      Background1 = Background {
         Inputs = {
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
         },
         ViewInfo = OperatorInfo { Pos = { 330, 115.5 } },
      },
      CustomTool1 = Custom {
         CtrlWZoom = false,
         Inputs = {
            NumberIn1 = Input { Value = -0.025, },
            NumberIn2 = Input { Value = 0.0006, },
            NumberIn3 = Input { Value = 0.202, },
            LUTIn1 = Input {
               SourceOp = "CustomTool1LUTIn1",
               Source = "Value",
            },
            LUTIn2 = Input {
               SourceOp = "CustomTool1LUTIn2",
               Source = "Value",
            },
            LUTIn3 = Input {
               SourceOp = "CustomTool1LUTIn3",
               Source = "Value",
            },
            LUTIn4 = Input {
               SourceOp = "CustomTool1LUTIn4",
               Source = "Value",
            },
            Intermediate1 = Input { Value = "((sin(x/n2))*n3 ) + 0.5", },
            RedExpression = Input { Value = "if(y<(i1) |y>(i1-n1),1,0)", },
            GreenExpression = Input { Value = "if(y<(i1) |y>(i1-n1),1,0)", },
            BlueExpression = Input { Value = "if(y<(i1) |y>(i1-n1),1,0)", },
            NumberControls = Input { Value = 1, },
            NameforNumber1 = Input { Value = "Thickness", },
            NameforNumber2 = Input { Value = "Frequency", },
            NameforNumber3 = Input { Value = "Amplitude", },
            Image1 = Input {
               SourceOp = "Background1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 550, 115.5 } },
      },
      CustomTool1LUTIn1 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 204, Green = 0, Blue = 0 },
         NameSet = true,
      },
      CustomTool1LUTIn2 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 0, Green = 204, Blue = 0 },
         NameSet = true,
      },
      CustomTool1LUTIn3 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 0, Green = 0, Blue = 204 },
         NameSet = true,
      },
      CustomTool1LUTIn4 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 204, Green = 204, Blue = 204 },
         NameSet = true,
      }
   }
}
www.ablackbirdcalledsue.com
Offline

robert_capper

  • Posts: 9
  • Joined: Tue Oct 11, 2016 12:42 pm

Re: How to draw a sine wave

PostMon Feb 05, 2018 9:59 pm

You could also try a particle based approach.

Try mixing different images together as the source to vary the waves. I would render at a higher res and resize for cleaner lines. This is all a bit rough but you get the idea.

Code: Select all
{
   Tools = ordered() {
      Background3 = Background {
         Inputs = {
            GlobalOut = Input { Value = 100, },
            Width = Input {
               Value = 1920,
               Expression = "Prefs.Width",
            },
            Height = Input { Value = 2, },
            Depth = Input { Value = 4, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Gradient = Input {
               Value = Gradient {
                  Colors = {
                     [0] = { 0, 0, 0, 1 },
                     [1] = { 1, 1, 1, 1 }
                  }
               },
            },
         },
         ViewInfo = OperatorInfo { Pos = { 985, 147 } },
      },
      Prefs = Custom {
         NameSet = true,
         Inputs = {
            LUTIn1 = Input {
               SourceOp = "PrefsLUTIn1",
               Source = "Value",
            },
            LUTIn2 = Input {
               SourceOp = "PrefsLUTIn2",
               Source = "Value",
            },
            LUTIn3 = Input {
               SourceOp = "PrefsLUTIn3",
               Source = "Value",
            },
            LUTIn4 = Input {
               SourceOp = "PrefsLUTIn4",
               Source = "Value",
            },
            NumberControls = Input { Value = 1, },
            ShowNumber1 = Input { Value = 0, },
            ShowNumber2 = Input { Value = 0, },
            ShowNumber3 = Input { Value = 0, },
            ShowNumber4 = Input { Value = 0, },
            ShowNumber5 = Input { Value = 0, },
            ShowNumber6 = Input { Value = 0, },
            ShowNumber7 = Input { Value = 0, },
            ShowNumber8 = Input { Value = 0, },
            ShowPoint1 = Input { Value = 0, },
            ShowPoint2 = Input { Value = 0, },
            ShowPoint3 = Input { Value = 0, },
            ShowPoint4 = Input { Value = 0, },
            ShowLUT1 = Input { Value = 0, },
            ShowLUT2 = Input { Value = 0, },
            ShowLUT3 = Input { Value = 0, },
            ShowLUT4 = Input { Value = 0, },
            ResMult = Input { Value = 2, },
            Thickness = Input { Value = 8, },
         },
         ViewInfo = OperatorInfo { Pos = { 820, 147 } },
         Colors = {
            TileColor = { R = 0, G = 1, B = 0 },
            TextColor = { R = 0, G = 0, B = 0 },
         },
         UserControls = ordered() { Width = { LINKS_Name = "Width", INP_Integer = true, LINKID_DataType = "Number", ICS_ControlPage = "Controls", INPID_InputControl = "SliderControl", INP_MinScale = 1, INP_MaxScale = 10000, INP_Default = 1920 }, Height = { LINKS_Name = "Height", INP_Integer = true, LINKID_DataType = "Number", ICS_ControlPage = "Controls", INPID_InputControl = "SliderControl", INP_MinScale = 1, INP_MaxScale = 10000, INP_Default = 1080 }, ResMult = { ICS_ControlPage = "Controls", INP_Integer = false, INPID_InputControl = "SliderControl", LINKID_DataType = "Number", INP_MinScale = 0, INP_Default = 1, INP_MaxScale = 3, LINKS_Name = "ResMult" }, Thickness = {
               LINKS_Name = "Thickness",
               LINKID_DataType = "Number",
               INPID_InputControl = "SliderControl",
               INP_Integer = false,
               INP_MinScale = 0,
               INP_MaxScale = 64,
               ICS_ControlPage = "Controls"
            } }
      },
      PrefsLUTIn1 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 204, Green = 0, Blue = 0 },
      },
      PrefsLUTIn2 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 0, Green = 204, Blue = 0 },
      },
      PrefsLUTIn3 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 0, Green = 0, Blue = 204 },
      },
      PrefsLUTIn4 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 204, Green = 204, Blue = 204 },
      },
      CosWave = Custom {
         NameSet = true,
         Inputs = {
            NumberIn1 = Input { Value = 20.25, },
            LUTIn1 = Input {
               SourceOp = "CosWaveLUTIn1",
               Source = "Value",
            },
            LUTIn2 = Input {
               SourceOp = "CosWaveLUTIn2",
               Source = "Value",
            },
            LUTIn3 = Input {
               SourceOp = "CosWaveLUTIn3",
               Source = "Value",
            },
            LUTIn4 = Input {
               SourceOp = "CosWaveLUTIn4",
               Source = "Value",
            },
            Intermediate1 = Input { Value = "(cos(getr1b(x, y)*57.2958*n1))\n\n\n\n\n\n\n", },
            Intermediate2 = Input { Value = "\n", },
            RedExpression = Input { Value = "i1", },
            GreenExpression = Input { Value = "i1", },
            BlueExpression = Input { Value = "i1", },
            AlphaExpression = Input { Value = "1\n", },
            NumberControls = Input { Value = 1, },
            ShowNumber2 = Input { Value = 0, },
            ShowNumber3 = Input { Value = 0, },
            ShowNumber4 = Input { Value = 0, },
            ShowNumber5 = Input { Value = 0, },
            ShowNumber6 = Input { Value = 0, },
            ShowNumber7 = Input { Value = 0, },
            ShowNumber8 = Input { Value = 0, },
            ShowPoint1 = Input { Value = 0, },
            ShowPoint2 = Input { Value = 0, },
            ShowPoint3 = Input { Value = 0, },
            ShowPoint4 = Input { Value = 0, },
            ShowLUT1 = Input { Value = 0, },
            ShowLUT2 = Input { Value = 0, },
            ShowLUT3 = Input { Value = 0, },
            ShowLUT4 = Input { Value = 0, },
            Image1 = Input {
               SourceOp = "Background1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1150, 213 } },
      },
      CosWaveLUTIn1 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 204, Green = 0, Blue = 0 },
      },
      CosWaveLUTIn2 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 0, Green = 204, Blue = 0 },
      },
      CosWaveLUTIn3 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 0, Green = 0, Blue = 204 },
      },
      CosWaveLUTIn4 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 204, Green = 204, Blue = 204 },
      },
      Background1 = Background {
         Inputs = {
            GlobalOut = Input { Value = 100, },
            Width = Input {
               Value = 1920,
               Expression = "Prefs.Width",
            },
            Height = Input {
               Value = 1080,
               Expression = "Prefs.Height",
            },
            Depth = Input { Value = 4, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Type = Input { Value = FuID { "Horizontal" }, },
            TopLeftRed = Input { Value = 1, },
            TopLeftGreen = Input { Value = 1, },
            TopLeftBlue = Input { Value = 1, },
            Gradient = Input {
               Value = Gradient {
                  Colors = {
                     [0] = { 0, 0, 0, 1 },
                     [1] = { 1, 1, 1, 1 }
                  }
               },
            },
         },
         ViewInfo = OperatorInfo { Pos = { 985, 213 } },
      },
      pImageEmitter1 = pImageEmitter {
         ID = 13,
         Inputs = {
            XDensity = Input {
               Value = 2,
               Expression = "Prefs.ResMult",
            },
            YDensity = Input { Value = 0.5, },
            Lifespan = Input { Value = 1000, },
            Input = Input {
               SourceOp = "Background3",
               Source = "Output",
            },
            ["Transform3DOp.Style"] = Input { Value = FuID { "ParticleStyleNGon" }, },
            ["ParticleStyle.ColorOverLife"] = Input {
               Value = Gradient {
                  Colors = {
                     [0] = { 1, 1, 1, 1 }
                  }
               },
            },
            ["ParticleStyle.SizeControls"] = Input { Value = 1, },
            ["ParticleStyle.Size"] = Input {
               Value = 0.776,
               Expression = "Prefs.Thickness/10",
            },
            ["ParticleStyle.SizeOverLife"] = Input {
               SourceOp = "pImageEmitter1SizeoverLife",
               Source = "Value",
            },
            ["ParticleStyle.FadeControls"] = Input { Value = 1, },
            ["ParticleStyle.BlurControls"] = Input { Value = 1, },
            ["ParticleStyle.BlurOverLife"] = Input {
               SourceOp = "pImageEmitter1BluroverLife2D",
               Source = "Value",
            },
            ["ParticleStyleNGon.NGonType"] = Input { Value = 6, },
         },
         ViewInfo = OperatorInfo { Pos = { 1150, 147 } },
      },
      pImageEmitter1SizeoverLife = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      pImageEmitter1BluroverLife2D = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      pCustom1 = pCustom {
         ID = 17,
         Inputs = {
            Intermediate1 = Input {
               Value = "3840",
               Expression = "Prefs.Width*Prefs.ResMult",
            },
            PositionYExpression = Input { Value = "getr1b(id/i1,0.5)/10\n\n\n", },
            Input = Input {
               SourceOp = "pImageEmitter1",
               Source = "Output",
            },
            Image1 = Input {
               SourceOp = "CosWave",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1315, 180 } },
      },
      pRender1 = pRender {
         Inputs = {
            _MotionBlurWarning = Input { Disabled = true, },
            GlobalOut = Input { Value = 100, },
            Width = Input {
               Value = 1920,
               Expression = "Prefs.Width",
            },
            Height = Input {
               Value = 1080,
               Expression = "Prefs.Height",
            },
            Depth = Input { Value = 3, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            OutputMode = Input {
               Value = FuID { "TwoD" },
               Disabled = true,
            },
            IntegrationMethod = Input { Value = FuID { "RK4" }, },
            ["MaterialID.MaterialID"] = Input { Value = 1, },
            ["ObjectID.ObjectID"] = Input { Value = 1, },
            Input = Input {
               SourceOp = "pCustom1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1480, 180 } },
      },
      Background4 = Background {
         Inputs = {
            GlobalOut = Input { Value = 100, },
            Width = Input {
               Value = 1920,
               Expression = "Prefs.Width",
            },
            Height = Input {
               Value = 1080,
               Expression = "Prefs.Height",
            },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            TopLeftRed = Input { Value = 1, },
            TopLeftGreen = Input { Value = 1, },
            TopLeftBlue = Input { Value = 1, },
            Gradient = Input {
               Value = Gradient {
                  Colors = {
                     [0] = { 0, 0, 0, 1 },
                     [1] = { 1, 1, 1, 1 }
                  }
               },
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1480, 246 } },
      },
      FastNoise1 = FastNoise {
         CtrlWZoom = false,
         Inputs = {
            GlobalOut = Input { Value = 100, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            Depth = Input { Value = 4, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Detail = Input { Value = 3.76, },
            Contrast = Input { Value = 1.65, },
            XScale = Input { Value = 1.37, },
            SeetheRate = Input { Value = 0.1, },
            Gradient = Input {
               Value = Gradient {
                  Colors = {
                     [0] = { 0, 0, 0, 1 },
                     [1] = { 1, 1, 1, 1 }
                  }
               },
            },
         },
         ViewInfo = OperatorInfo { Pos = { 985, 246 } },
      },
      Merge1 = Merge {
         Inputs = {
            Background = Input {
               SourceOp = "Background4",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "pRender1",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 1645, 246 } },
      },
      Resize1 = BetterResize {
         Inputs = {
            Width = Input { Value = 1280, },
            Height = Input { Value = 720, },
            PixelAspect = Input { Value = { 1, 1 }, },
            FilterMethod = Input { Value = 4, },
            Input = Input {
               SourceOp = "Merge1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1810, 246 } },
      }
   }
}
Offline

Andy Weimer

  • Posts: 10
  • Joined: Thu Dec 14, 2017 9:51 am

Re: How to draw a sine wave

PostThu Feb 08, 2018 10:11 pm

Thank you guys! :)

I've also tried a version with particles:

Code: Select all
{
   Tools = ordered() {
      Background1 = Background {
         ExtentSet = true,
         Inputs = {
            GlobalOut = Input { Value = 415, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
         },
         ViewInfo = OperatorInfo { Pos = { 692, 39 } },
      },
      Merge1 = Merge {
         EnabledRegion = TimeRegion { { Start = -134, End = 418.9999, FrameLength = 1 } },
         Inputs = {
            Background = Input {
               SourceOp = "Background1",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "MRG_SineWave",
               Source = "Output",
            },
            Center = Input { Value = { 0.39375, 0.5 }, },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 693, 98 } },
      },
      pRender_SineCurve = pRender {
         ExtentSet = true,
         NameSet = true,
         Inputs = {
            _MotionBlurWarning = Input { Disabled = true, },
            GlobalIn = Input { Value = -2, },
            GlobalOut = Input { Value = 419, },
            Width = Input { Value = 500, },
            Height = Input { Value = 500, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            OutputMode = Input {
               Value = FuID { "TwoD" },
               Disabled = true,
            },
            IntegrationMethod = Input { Value = FuID { "RK4" }, },
            ["MaterialID.MaterialID"] = Input { Value = 1, },
            ["ObjectID.ObjectID"] = Input { Value = 1, },
            Input = Input {
               SourceOp = "pEmitter_SineCurve",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 537, 39 } },
      },
      MRG_SineWave = Merge {
         NameSet = true,
         EnabledRegion = TimeRegion { { Start = -2, End = 419.9999, FrameLength = 1 } },
         Inputs = {
            Background = Input {
               SourceOp = "SETTINGS_SineWave",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "pRender_SineCurve",
               Source = "Output",
            },
            Center = Input { Value = { 1.55846153846154, 0.5 }, },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 538, 159 } },
      },
      SETTINGS_SineWave = Transform {
         CtrlWZoom = false,
         NameSet = true,
         EnabledRegion = TimeRegion { { Start = -2, End = 419.9999, FrameLength = 1 } },
         Inputs = {
            Angle = Input {
               SourceOp = "SETTINGS_SineWaveAngle",
               Source = "Value",
            },
            Input = Input {
               SourceOp = "MRG_Circ",
               Source = "Output",
            },
            Circ_Amp = Input {
               SourceOp = "SETTINGS_SineWaveCirc_Amp",
               Source = "Value",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 337, 157 } },
         Colors = { TileColor = { R = 0.984313725490196, G = 0.00784313725490196, B = 1 }, },
         UserControls = ordered() {
            Circ_Amp = {
               INP_MaxAllowed = 0.949999988079071,
               INP_Integer = false,
               INPID_InputControl = "SliderControl",
               INP_MaxScale = 0.949999988079071,
               INP_Default = 0.5,
               INP_MinScale = 0,
               INP_MinAllowed = 0,
               LINKID_DataType = "Number",
               ICS_ControlPage = "Controls",
               LINKS_Name = "Circ_Amp"
            },
            Circ_Freq = {
               INP_MaxAllowed = 1,
               INP_Integer = false,
               INPID_InputControl = "SliderControl",
               INP_MaxScale = 1,
               INP_Default = 0.5,
               INP_MinScale = 0.100000001490116,
               INP_MinAllowed = 0.100000001490116,
               LINKID_DataType = "Number",
               ICS_ControlPage = "Controls",
               LINKS_Name = "Circ_Freq"
            }
         }
      },
      SETTINGS_SineWaveAngle = BezierSpline {
         SplineColor = { Red = 14, Green = 221, Blue = 144 },
         NameSet = true,
         KeyFrames = {
            [41] = { 0, RH = { 59, 120 }, Flags = { Linear = true, Loop = true } },
            [95] = { 360, LH = { 77, 240 }, Flags = { Linear = true, Loop = true } }
         }
      },
      SETTINGS_SineWaveCirc_Amp = BezierSpline {
         SplineColor = { Red = 41, Green = 38, Blue = 231 },
         NameSet = true,
         KeyFrames = {
            [202] = { 0.146, RH = { 208.33333333333, 0.146 } },
            [221] = { 0.461, LH = { 205.45454545455, 0.460654545454545 } }
         }
      },
      Note1 = Note {
         Inputs = {
            Comments = Input { Value = "Curve is generated with particles. Emitter moves with sin function. Particles have velocity that move them along.\n\nchange amplitud and frequency in SETTINGS node", }
         },
         ViewInfo = StickyNoteInfo {
            Pos = { 480, 231 },
            Flags = {
               Expanded = true
            },
            Size = { 196, 179.3 }
         },
      },
      pEmitter_SineCurve = pEmitter {
         ID = 9,
         NameSet = true,
         EnabledRegion = TimeRegion { { Start = -2, End = 419.9999 } },
         Inputs = {
            Number = Input {
               SourceOp = "pEmitter_SineCurveNumber",
               Source = "Value",
            },
            Lifespan = Input { Value = 159, },
            LifespanVariance = Input { Value = 10, },
            VelocityControls = Input { Value = 1, },
            Velocity = Input { Value = 0.07, },
            Style = Input { Value = FuID { "ParticleStyleNGon" }, },
            ["ParticleStyle.SizeControls"] = Input { Value = 1, },
            ["ParticleStyle.Size"] = Input { Value = 0.411, },
            ["ParticleStyle.SizeOverLife"] = Input {
               SourceOp = "pEmitter_SineCurveSizeoverLife",
               Source = "Value",
            },
            ["ParticleStyle.BlurOverLife"] = Input {
               SourceOp = "pEmitter_SineCurveBluroverLife2D",
               Source = "Value",
            },
            ["ParticleStyleNGon.NGonType"] = Input { Value = 6, },
            ["SphereRgn.Translate.X"] = Input { Value = -0.48, },
            ["SphereRgn.Translate.Y"] = Input {
               Value = -0.120607685638724,
               Expression = "SETTINGS_SineWave.Circ_Amp*math.sin(math.rad(SETTINGS_SineWave.Angle))/2",
            },
            ["SphereRgn.Size"] = Input { Value = 0, }
         },
         ViewInfo = OperatorInfo { Pos = { 301, 40 } },
         Colors = { TileColor = { R = 0.105882352941176, G = 1, B = 0.0235294117647059 }, }
      },
      pEmitter_SineCurveNumber = BezierSpline {
         SplineColor = { Red = 233, Green = 206, Blue = 78 },
         NameSet = true,
         KeyFrames = {
            [41] = { 0, RH = { 41.3333333333333, 0.333333333333333 }, Flags = { Linear = true } },
            [42] = { 1, LH = { 41.6666666666667, 0.666666666666667 }, Flags = { Linear = true } }
         }
      },
      pEmitter_SineCurveSizeoverLife = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      pEmitter_SineCurveBluroverLife2D = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      Ellipse6 = EllipseMask {
         EnabledRegion = TimeRegion { { Start = -2, End = 419.9999, FrameLength = 1 } },
         Inputs = {
            BorderWidth = Input { Value = 0.0154, },
            Solid = Input { Value = 0, },
            MaskWidth = Input { Value = 1920, },
            MaskHeight = Input { Value = 1080, },
            PixelAspect = Input { Value = { 1, 1 }, },
            ClippingMode = Input { Value = FuID { "None" }, },
            Width = Input {
               Value = 0.461,
               Expression = "SETTINGS_SineWave.Circ_Amp",
            },
            Height = Input {
               Value = 0.461,
               Expression = "SETTINGS_SineWave.Circ_Amp",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 169, 75 } },
         Colors = { TileColor = { R = 0.105882352941176, G = 1, B = 0.0235294117647059 }, }
      },
      BG_Circ = Background {
         ExtentSet = true,
         NameSet = true,
         Inputs = {
            GlobalIn = Input { Value = -2, },
            GlobalOut = Input { Value = 419, },
            Width = Input { Value = 500, },
            Height = Input { Value = 500, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            TopLeftRed = Input { Value = 1, },
            TopLeftGreen = Input { Value = 1, },
            TopLeftBlue = Input { Value = 1, },
            EffectMask = Input {
               SourceOp = "Ellipse6",
               Source = "Mask",
            }
         },
         ViewInfo = OperatorInfo { Pos = { 167, 106 } },
      },
      MRG_Circ = Merge {
         NameSet = true,
         EnabledRegion = TimeRegion { { Start = -2, End = 419.9999, FrameLength = 1 } },
         Inputs = {
            Background = Input {
               SourceOp = "BG_Circ",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "BG_Rect",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 120, 158 } },
      },
      BG_Rect = Background {
         ExtentSet = true,
         NameSet = true,
         Inputs = {
            GlobalIn = Input { Value = -2, },
            GlobalOut = Input { Value = 419, },
            Width = Input { Value = 500, },
            Height = Input { Value = 500, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            TopLeftRed = Input { Value = 1, },
            TopLeftGreen = Input { Value = 0.195558608679592, },
            TopLeftBlue = Input { Value = 0.17, },
            EffectMask = Input {
               SourceOp = "Rectangle1",
               Source = "Mask",
            }
         },
         ViewInfo = OperatorInfo { Pos = { 28, 105 } },
      },
      Rectangle1 = RectangleMask {
         EnabledRegion = TimeRegion { { Start = -2, End = 419.9999, FrameLength = 1 } },
         Inputs = {
            MaskWidth = Input { Value = 1920, },
            MaskHeight = Input { Value = 1080, },
            PixelAspect = Input { Value = { 1, 1 }, },
            ClippingMode = Input { Value = FuID { "None" }, },
            Center = Input {
               Value = { 0.5365, 0.5 },
               Expression = "Point(0.5+(SETTINGS_SineWave.Circ_Amp/4),0.5)",
            },
            Width = Input { Value = 0.026, },
            Height = Input {
               Value = 0.073,
               Expression = "SETTINGS_SineWave.Circ_Amp/2",
            },
            Angle = Input { Value = 90, },
         },
         ViewInfo = OperatorInfo { Pos = { 28, 72 } },
         Colors = { TileColor = { R = 0.105882352941176, G = 1, B = 0.0235294117647059 }, }
      }
   }
}


Will have to tweak on the emitter so the line is more consistent.
Offline
User avatar

Blazej Floch

  • Posts: 191
  • Joined: Tue Nov 11, 2014 12:48 am
  • Location: Toronto, ON

Re: How to draw a sine wave

PostSat Feb 10, 2018 7:32 am

Could be also done with trails.
Pretty much animate a shape up and down (via Sin expression) and set the trails offset in x.

You might need to supersample the animation (more frame than needed) and speed up at the end so that the line connects if the frequency is high.

Return to Fusion

Who is online

Users browsing this forum: No registered users and 9 guests