- Posts: 46
- Joined: Wed Apr 10, 2019 8:42 pm
- Real Name: Thomas Baumgärtel
- Code: Select all
{
Tools = ordered() {
RandomSwitch_2_1 = Dissolve {
Transitions = {
[0] = "DFTDissolve"
},
CtrlWZoom = false,
NameSet = true,
Inputs = {
Mix = Input {
Value = 0,
Expression = ":t0=0; randomseed(RandomSeed); while t0<=time do off=random(MinimumOffTime,MaximumOffTime); on=random(MinimumOnTime,MaximumOnTime); t=time-t0; t0=t0+on+off; end; n=t0-on; if t>off then return 1; else return 0; end",
},
Comments = Input { Value = "Randomly switches the Mix control between 0 and 1. Adjust the frequency of switching using the Max and Min sliders. \r\n\r\nMuse Effects Elements Library, Glitch Tools Collection\r\nby Bryan Ray.\r\nwww.musevfx.com", },
MinimumOffTime = Input { Expression = "controlPanel_timeStutter_1.MinOffTime", },
MaximumOffTime = Input { Expression = "controlPanel_timeStutter_1.MaxOffTime", },
MinimumOnTime = Input { Expression = "controlPanel_timeStutter_1.MinShuffleDuration", },
MaximumOnTime = Input { Expression = "controlPanel_timeStutter_1.MaxShuffleDuration", },
RandomSeed = Input {
Value = 67,
Expression = "controlPanel_timeStutter_1.RandomSeed+250",
},
},
ViewInfo = OperatorInfo { Pos = { 0, 43.15 } },
UserControls = ordered() {
MinimumOffTime = {
INP_MaxAllowed = 10000,
INP_Integer = true,
INPID_InputControl = "SliderControl",
IC_ControlPage = 0,
INP_MaxScale = 30,
INP_Default = 3,
INP_MinAllowed = 0,
LINKID_DataType = "Number",
LINKS_Name = "Minimum Off Time",
},
MaximumOffTime = {
INP_MaxAllowed = 10000,
INP_Integer = true,
INPID_InputControl = "SliderControl",
IC_ControlPage = 0,
INP_MaxScale = 60,
INP_Default = 10,
INP_MinScale = 1,
INP_MinAllowed = 0,
LINKID_DataType = "Number",
LINKS_Name = "Maximum Off Time",
},
MinimumOnTime = {
INP_MaxAllowed = 10000,
INP_Integer = true,
INPID_InputControl = "SliderControl",
IC_ControlPage = 0,
INP_MaxScale = 30,
INP_Default = 3,
INP_MinAllowed = 0,
LINKID_DataType = "Number",
LINKS_Name = "Minimum On Time",
},
MaximumOnTime = {
INP_MaxAllowed = 10000,
INP_Integer = true,
INPID_InputControl = "SliderControl",
IC_ControlPage = 0,
INP_MaxScale = 60,
INP_Default = 10,
INP_MinScale = 1,
INP_MinAllowed = 0,
LINKID_DataType = "Number",
LINKS_Name = "Maximum On Time",
},
RandomSeed = {
LINKID_DataType = "Number",
LINKS_Name = "Random Seed",
IC_ControlPage = 0,
INPID_InputControl = "SliderControl",
INP_Default = 0,
}
}
}
},
ActiveTool = "RandomSwitch_2_1"
}
In this tool, Number In 2 will return 0 if the value of Number In 1 is less than 0, and it will return 1 if the value of Number In 1 is greater than 0. In this example, I've modified Number In 1 with a Perturb. You'd then connect whatever tool you want to control to the Number In 2 control with this expression:
CustomTool1.NumberIn2
Here's a more elaborate controller that switches randomly between 0 and 1 with control over the minimum and maximum length of time that the control can remain static:
- Code: Select all
{
Tools = ordered() {
RandomSwitch1 = Dissolve {
Transitions = {
[0] = "DFTDissolve"
},
CtrlWZoom = false,
NameSet = true,
Inputs = {
Mix = Input { Expression = ":t0=0; randomseed(RandomSeed); while t0<=time do off=random(MinimumOffTime,MaximumOffTime); on=random(MinimumOnTime,MaximumOnTime); t=time-t0; t0=t0+on+off; end; n=t0-on; if t>off then return 1; else return 0; end", },
Comments = Input { Value = "Randomly switches the Mix control between 0 and 1. Adjust the frequency of switching using the Max and Min sliders. \r\n\r\nMuse Effects Elements Library, Glitch Tools Collection\r\nby Bryan Ray.\r\nwww.musevfx.com", },
RandomSeed = Input { Value = 67, },
},
ViewInfo = OperatorInfo { Pos = { 564, 34.6364 } },
UserControls = ordered() {
MinimumOffTime = {
INP_MaxAllowed = 10000,
INP_Integer = true,
INPID_InputControl = "SliderControl",
IC_ControlPage = 0,
INP_MaxScale = 30,
INP_Default = 3,
INP_MinAllowed = 0,
LINKID_DataType = "Number",
LINKS_Name = "Minimum Off Time",
},
MaximumOffTime = {
INP_MaxAllowed = 10000,
INP_Integer = true,
INPID_InputControl = "SliderControl",
IC_ControlPage = 0,
INP_MaxScale = 60,
INP_Default = 10,
INP_MinScale = 1,
INP_MinAllowed = 0,
LINKID_DataType = "Number",
LINKS_Name = "Maximum Off Time",
},
MinimumOnTime = {
INP_MaxAllowed = 10000,
INP_Integer = true,
INPID_InputControl = "SliderControl",
IC_ControlPage = 0,
INP_MaxScale = 30,
INP_Default = 3,
INP_MinAllowed = 0,
LINKID_DataType = "Number",
LINKS_Name = "Minimum On Time",
},
MaximumOnTime = {
INP_MaxAllowed = 10000,
INP_Integer = true,
INPID_InputControl = "SliderControl",
IC_ControlPage = 0,
INP_MaxScale = 60,
INP_Default = 10,
INP_MinScale = 1,
INP_MinAllowed = 0,
LINKID_DataType = "Number",
LINKS_Name = "Maximum On Time",
},
RandomSeed = {
LINKID_DataType = "Number",
INP_Default = 0,
IC_ControlPage = 0,
INPID_InputControl = "SliderControl",
LINKS_Name = "Random Seed",
}
}
}
},
ActiveTool = "RandomSwitch1"
}
Save that as a .setting file in your Macros folder, and you'll be able to recall it at any time. It's a Dissolve tool, so you could plug images into the Background and Foreground inputs to switch between them, or you can connect to it with an expression as with the previous tool with this expression:
RandomSwitch1.Mix