Page 1 of 1

Countdown with a smooth slowdown with a complete stop

PostPosted: Sun Dec 10, 2017 11:10 pm
by Jonas Millgård
Hi,

I'm pretty much new to Fusion and its capabilities. I looked through the forum for a question similar to the one I have, but I couldn't find one.

What I would like to create is a counter that counts from 2017 to 1897, where the countdown is a smooth slow down as it get closer to 1897 and also comes to a complete stop at 1897.

I have tried a customTool node with expressions using current time and a Text+ node to display the result. I’m not getting it to work and I’m lacking knowledge of expressions and figuring out how to get the slowing down of the counter to work properly.

I would very much appreciate you help, tips and tricks to get ideas of how to solve the countdown. Maybe I’m doing it all wrong trying to use expressions and some other alternative e.g. scripts would work better?

Thanks
Jonas

Re: Countdown with a smooth slowdown with a complete stop

PostPosted: Mon Dec 11, 2017 5:41 pm
by Paul Ingvarsson
Code: Select all
{
   Tools = ordered() {
      Text1 = TextPlus {
         CtrlWZoom = false,
         Inputs = {
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Font = Input { Value = "Open Sans", },
            StyledText = Input {
               Value = "2050",
               Expression = "floor(CustomTool1.NumberIn2)",
            },
            Style = Input { Value = "Bold", },
            ManualFontKerningPlacement = Input {
               Value = StyledText {
                  Array = {
                  },
                  Value = ""
               },
            },
         },
         ViewInfo = OperatorInfo { Pos = { 605, 181.5 } },
      },
      CustomTool1 = Custom {
         CtrlWZoom = false,
         Inputs = {
            NumberIn2 = Input {
               SourceOp = "Publish1",
               Source = "Value",
            },
            LUTControlsNest = Input { Value = 1, },
            LUTIn1 = Input {
               SourceOp = "CustomTool1LUTIn1",
               Source = "Value",
            },
            LUTIn2 = Input {
               SourceOp = "CustomTool1LUTIn2",
               Source = "Value",
            },
            LUTIn3 = Input {
               SourceOp = "CustomTool1LUTIn3",
               Source = "Value",
            },
            LUTIn4 = Input {
               SourceOp = "CustomTool1LUTIn4",
               Source = "Value",
            },
            NumberControls = Input { Value = 1, },
         },
         ViewInfo = OperatorInfo { Pos = { 660, 82.5 } },
      },
      Publish1 = PublishNumber {
         CtrlWZoom = false,
         Inputs = {
            Value = Input {
               SourceOp = "CustomTool1Value",
               Source = "Value",
            },
         },
      },
      CustomTool1Value = BezierSpline {
         SplineColor = { Red = 246, Green = 136, Blue = 49 },
         NameSet = true,
         KeyFrames = {
            [0] = { 1850, RH = { 23.2, 1897.6 }, Flags = { Linear = true } },
            [250] = { 2050, LH = { 82.8, 2048.8 } }
         }
      },
      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,
      },
      Merge2 = Merge {
         Inputs = {
            Background = Input {
               SourceOp = "Merge1",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 825, 280.5 } },
      },
      Merge1 = Merge {
         Inputs = {
            Background = Input {
               SourceOp = "Background1",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "Text1",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 605, 280.5 } },
      },
      Background1 = Background {
         Inputs = {
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
         },
         ViewInfo = OperatorInfo { Pos = { 495, 280.5 } },
      }
   }
}

Re: Countdown with a smooth slowdown with a complete stop

PostPosted: Mon Dec 11, 2017 5:43 pm
by Paul Ingvarsson
I'm far from expert on this but this method uses the custom tool to animate a generic number which is then linked into the text tool as an expression, but uses the floor() function to remove all decimal places.

Hope it's of some use!

Re: Countdown with a smooth slowdown with a complete stop

PostPosted: Mon Dec 11, 2017 5:44 pm
by Frank Feijen
Even without custom tool
Code: Select all
{
   Tools = ordered() {
      Text1 = TextPlus {
         Inputs = {
            GlobalOut = Input { Value = 150, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Font = Input { Value = "Open Sans", },
            StyledText = Input {
               Value = "1998",
               Expression = "math.ceil(year)",
            },
            Style = Input { Value = "Bold", },
            ManualFontKerningPlacement = Input {
               Value = StyledText {
                  Array = {
                  },
                  Value = ""
               },
            },
            year = Input {
               SourceOp = "Text1year",
               Source = "Value",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 935, 181.5 } },
         UserControls = ordered() {
            year = {
               LINKS_Name = "year",
               LINKID_DataType = "Number",
               INPID_InputControl = "SliderControl",
               INP_Integer = false,
               ICS_ControlPage = "Text"
            }
         }
      },
      Text1year = BezierSpline {
         SplineColor = { Red = 252, Green = 0, Blue = 183 },
         NameSet = true,
         KeyFrames = {
            [0] = { 2017, RH = { 18.3838383838384, 2017 }, Flags = { Linear = true } },
            [140] = { 1897, LH = { 25.4545454545455, 1897 } }
         }
      },
      Merge1 = Merge {
         Inputs = {
            Background = Input {
               SourceOp = "Background1",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "Text1",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 935, 214.5 } },
      },
      Background1 = Background {
         Inputs = {
            GlobalOut = Input { Value = 150, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
         },
         ViewInfo = OperatorInfo { Pos = { 825, 214.5 } },
      }
   }
}

Re: Countdown with a smooth slowdown with a complete stop

PostPosted: Mon Dec 11, 2017 5:47 pm
by Paul Ingvarsson
Too clever - how do you get the year slider up?

Re: Countdown with a smooth slowdown with a complete stop

PostPosted: Mon Dec 11, 2017 6:03 pm
by Frank Feijen
Too clever - how do you get the year slider up?

Right-click on the text+-title in the tools tab, select edit controls.
Next create a new number-control on the Text-page

Re: Countdown with a smooth slowdown with a complete stop

PostPosted: Mon Dec 11, 2017 8:01 pm
by Jonas Millgård
Thanks Frank and Paul!

Must say the solution with adding number-control on the Text-page was sweet.

Re: Countdown with a smooth slowdown with a complete stop

PostPosted: Tue Dec 12, 2017 12:03 pm
by Paul Ingvarsson
Jonas Millgård wrote:Thanks Frank and Paul!

Must say the solution with adding number-control on the Text-page was sweet.


Yes it was! Nice little addition to the toolbox of knowledge!