Example ====== Timecode - Set Start Time from Palette Fade ====== ^ by: | Gregory Haynes, February 2022 | ^ published: | here | ^ description: | set the Timecode start time from palette fade time | ^ remarks: | best used with Web API. Set the fade time via POST request and then fire this macro to set the start time. | This is a brilliant workaround for versions before Titan v14 when the TimecodeTime cast was introduced. The API calls are shown in [[webapi:examples:settimecodefrompalettefade|]] {{tag>timecode time palette fade}} ==== functions ==== * [[:macros:function:timecode.timecodeone.setstarttime]] * [[:macros:function:Timecode.MakeTimecodeTime]] * [[:macros:function:Math.Cast.ToInteger]] ==== affected properties ==== * [[:macros:property:Palette.Numeric.InputValue]] ==== control structures ==== * [[macros:types#casting_-_type_conversion|Casting]] ===== Code ===== Set the start time from the current palette fade time. Timecode.TimecodeOne.SetStartTime( Timecode.MakeTimecodeTime( 0, 0, int:Palette.Numeric.InputValue, Math.Cast.ToInteger(( Palette.Numeric.InputValue - float:int:Palette.Numeric.InputValue) * 1000), false, 1000)) ===== Explanation ===== This explains the functional steps within the sequence. For all the other XML details please refer to [[:macros:formats_and_syntax#xml_format|Formats and syntax]] > This takes the number entered in the root menu (used for specifying the time to fire the next palette), splits it into seconds and milliseconds and uses that to create a TimecodeTime object and set the start time. ===== How to use it ===== - [[:macros:deploying|make this macro available]] - you can now input a time with the number keys and then fire this macro to transfer this into a timecode start time - in order to use this with WebAPI you need to copy this macro to a handle - albeit it looks like you can remove it from the handle thereafter copying makes it available for the WebAPI > For WebAPI workflow would be to set the Palette.Numeric.InputValue from WebAPI first and then run the macro. The seconds value will rollover into minutes and even hours so you can use a value of 120 for 2 minutes etc.. ~~DISCUSSION~~