Expression Syntax to change a Value over a given number of frames

User avatar
eaerendil
Posts: 5
Joined: Thu Sep 04, 2014 1:07 am

Expression Syntax to change a Value over a given number of frames

#1

Post by eaerendil » Thu Jun 13, 2019 8:17 am

in My setup i have a Particle field with a replicator node which replaces each particle with a plane pacing camera. What i want is to animate a region Box and make every particle rotate around the Z axis by -90 degrees. So far so good. but I want them to rotate over a given number of frames and not just instantly flip by -90. Does anyone have any ideas?

Thanx!!!!

User avatar
SirEdric
Fusionator
Posts: 1995
Joined: Tue Aug 05, 2014 10:04 am
Answers: 4
Real name: Eric Westphal
Been thanked: 146 times
Contact:

Re: Expression Syntax to change a Value over a given number of frames

#2

Post by SirEdric » Thu Jun 13, 2019 9:20 am

Hi.
pCustom is your friend...:-)

Code: Select all

{
	Tools = ordered() {
		Background2 = Background {
			CtrlWZoom = false,
			Inputs = {
				Width = Input { Value = 1920, },
				Height = Input { Value = 1080, },
				["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
				Type = Input { Value = FuID { "Gradient" }, },
				Gradient = Input {
					Value = Gradient {
						Colors = {
							[0.338926174496644] = { 0, 0, 0, 1 },
							[0.647651006711409] = { 1, 1, 1, 1 }
						}
					},
				},
				Offset = Input {
					SourceOp = "Background2Offset",
					Source = "Value",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 165, -49.5 } },
		},
		Background2Offset = BezierSpline {
			SplineColor = { Red = 234, Green = 92, Blue = 75 },
			NameSet = true,
			KeyFrames = {
				[0] = { -1, RH = { 33.3333333333333, -0.333333333333333 }, Flags = { Linear = true } },
				[100] = { 1, LH = { 66.6666666666667, 0.333333333333333 }, Flags = { Linear = true } }
			}
		},
		pCustom1 = pCustom {
			ID = 16,
			Inputs = {
				RotationYExpression = Input { Value = "getr1b(pxi1+0.5,pyi1+0.5)*180\n", },
				Input = Input {
					SourceOp = "pImageEmitter1",
					Source = "Output",
				},
				Image1 = Input {
					SourceOp = "Background2",
					Source = "Output",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 165, 16.5 } },
		},
		pImageEmitter1 = pImageEmitter {
			ID = 13,
			Inputs = {
				XDensity = Input { Value = 0.01, },
				YDensity = Input { Value = 0.01, },
				Lifespan = Input { Value = 200, },
				Input = Input {
					SourceOp = "Background1",
					Source = "Output",
				},
				["Transform3DOp.Style"] = Input { Value = FuID { "ParticleStyleBlob" }, },
				["ParticleStyle.SizeOverLife"] = Input {
					SourceOp = "pImageEmitter1SizeoverLife",
					Source = "Value",
				},
				["ParticleStyle.BlurOverLife"] = Input {
					SourceOp = "pImageEmitter1BluroverLife2D",
					Source = "Value",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 55, 16.5 } },
		},
		pImageEmitter1SizeoverLife = LUTBezier {
			KeyColorSplines = {
				[0] = {
					[0] = { 0.5, RH = { 0.3, 0.5 }, Flags = { Linear = true } },
					[1] = { 0.5, LH = { 0.7, 0.5 }, Flags = { Linear = true } }
				}
			},
			SplineColor = { Red = 192, Green = 128, Blue = 64 },
			NameSet = true,
		},
		pImageEmitter1BluroverLife2D = LUTBezier {
			KeyColorSplines = {
				[0] = {
					[0] = { 0.5, RH = { 0.3, 0.5 }, Flags = { Linear = true } },
					[1] = { 0.5, LH = { 0.7, 0.5 }, Flags = { Linear = true } }
				}
			},
			SplineColor = { Red = 192, Green = 128, Blue = 64 },
			NameSet = true,
		},
		Background1 = Background {
			Inputs = {
				Width = Input { Value = 1920, },
				Height = Input { Value = 1080, },
				["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
				TopLeftRed = Input { Value = 0.86, },
				TopLeftGreen = Input { Value = 0.370866414485664, },
				TopLeftBlue = Input { Value = 0.00860000000000001, },
			},
			ViewInfo = OperatorInfo { Pos = { -55, 16.5 } },
		},
		pRender1 = pRender {
			Inputs = {
				_MotionBlurWarning = Input { Disabled = true, },
				Width = Input { Value = 1920, },
				Height = Input { Value = 1080, },
				["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
				OutputMode = Input { 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 = { 330, 16.5 } },
		},
		Shape3D1 = Shape3D {
			Inputs = {
				["MtlStdInputs.MaterialID"] = Input { Value = 2, },
				["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 2, }
			},
			ViewInfo = OperatorInfo { Pos = { 440, -49.5 } },
		},
		Replicate3D1 = Replicate3D {
			Inputs = {
				Alignment = Input { Value = 2, },
				Destination = Input {
					SourceOp = "pRender1",
					Source = "Output",
				},
				Input1 = Input {
					SourceOp = "Shape3D1",
					Source = "Output",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 495, 16.5 } },
		}
	}
}

User avatar
eaerendil
Posts: 5
Joined: Thu Sep 04, 2014 1:07 am

Re: Expression Syntax to change a Value over a given number of frames

#3

Post by eaerendil » Fri Jun 14, 2019 1:15 am

Ersteinmal: Danke Eric! ;-) Ich hoffe bei dir ist alles soweit gut!
And now back to english ;-)
I had pCustom set up to rotate my particles. But i faild to get a smooth rotation.
In your example you used an image emitter. In my case i have "Cloud" of planes emitted by a pEmitter. As yet i have not been able to adapt our setup to my spacific needs. I am probaly missing somthing. :-/
  1. {
  2.     Tools = ordered() {
  3.         Camera3D1 = Camera3D {
  4.             Inputs = {
  5.                 ["Transform3DOp.Translate.Y"] = Input { Value = 60.8572815642879, },
  6.                 ["Transform3DOp.Rotate.X"] = Input { Value = -90, },
  7.                 ProjectionType = Input { Value = FuID { "Orthographic" }, },
  8.                 AoV = Input { Value = 19.2642683071402, },
  9.                 ["Stereo.Mode"] = Input { Value = FuID { "OffAxis" }, },
  10.                 FilmGate = Input { Value = FuID { "BMD_URSA_4K_16x9" }, },
  11.                 ApertureW = Input { Value = 0.831496062992126, },
  12.                 ApertureH = Input { Value = 0.467716535433071, },
  13.                 ViewingVolumeSize = Input { Value = 0.1893, },
  14.                 ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 2, },
  15.                 ["MtlStdInputs.MaterialID"] = Input { Value = 2, },
  16.             },
  17.             ViewInfo = OperatorInfo { Pos = { 770, 148.5 } },
  18.         },
  19.         Background2_2 = Background {
  20.             Inputs = {
  21.                 Width = Input { Value = 1920, },
  22.                 Height = Input { Value = 1080, },
  23.                 ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
  24.                 Type = Input { Value = FuID { "Gradient" }, },
  25.                 Gradient = Input {
  26.                     Value = Gradient {
  27.                         Colors = {
  28.                             [0.338926174496644] = { 0, 0, 0, 1 },
  29.                             [0.647651006711409] = { 1, 1, 1, 1 }
  30.                         }
  31.                     },
  32.                 },
  33.                 Offset = Input {
  34.                     SourceOp = "Background2_2Offset",
  35.                     Source = "Value",
  36.                 },
  37.             },
  38.             ViewInfo = OperatorInfo { Pos = { 440, 247.5 } },
  39.         },
  40.         Background2_2Offset = BezierSpline {
  41.             SplineColor = { Red = 234, Green = 92, Blue = 75 },
  42.             NameSet = true,
  43.             KeyFrames = {
  44.                 [0] = { -1, RH = { 33.3333333333333, -0.333333333333333 }, Flags = { Linear = true } },
  45.                 [100] = { 1, LH = { 66.6666666666667, 0.333333333333333 }, Flags = { Linear = true } }
  46.             }
  47.         },
  48.         pCustom1 = pCustom {
  49.             ID = 15,
  50.             CtrlWZoom = false,
  51.             Inputs = {
  52.                 RotationZExpression = Input { Value = "getr1b(pxi1+0.5,pyi1+0.5)*90\n\n \n \n", },
  53.                 Input = Input {
  54.                     SourceOp = "pEmitter1",
  55.                     Source = "Output",
  56.                 },
  57.                 Image1 = Input {
  58.                     SourceOp = "Background2_2",
  59.                     Source = "Output",
  60.                 },
  61.                 ["CubeRgn.Width"] = Input { Value = 20, },
  62.                 ["CubeRgn.Height"] = Input { Value = 20, },
  63.                 ["CubeRgn.Depth"] = Input { Value = 20, }
  64.             },
  65.             ViewInfo = OperatorInfo { Pos = { 440, 313.5 } },
  66.         },
  67.         pEmitter1 = pEmitter {
  68.             ID = 1,
  69.             Inputs = {
  70.                 Number = Input {
  71.                     SourceOp = "pEmitter1Number",
  72.                     Source = "Value",
  73.                 },
  74.                 Lifespan = Input { Value = 1000, },
  75.                 VelocityControls = Input { Value = 1, },
  76.                 Velocity = Input { Value = 0.0519, },
  77.                 Angle = Input { Value = 180, },
  78.                 Region = Input { Value = FuID { "CubeRgn" }, },
  79.                 ["ParticleStyle.SizeOverLife"] = Input {
  80.                     SourceOp = "pEmitter1SizeoverLife",
  81.                     Source = "Value",
  82.                 },
  83.                 ["ParticleStyle.BlurOverLife"] = Input {
  84.                     SourceOp = "pEmitter1BluroverLife2D",
  85.                     Source = "Value",
  86.                 },
  87.                 ["CubeRgn.Width"] = Input { Value = 20, },
  88.                 ["CubeRgn.Height"] = Input { Value = 20, },
  89.                 ["CubeRgn.Depth"] = Input { Value = 12.99, }
  90.             },
  91.             ViewInfo = OperatorInfo { Pos = { 330, 313.5 } },
  92.         },
  93.         pEmitter1Number = BezierSpline {
  94.             SplineColor = { Red = 233, Green = 206, Blue = 78 },
  95.             NameSet = true,
  96.             KeyFrames = {
  97.                 [0] = { 20, RH = { 0.333333333333333, 13.3333333333333 }, Flags = { Linear = true } },
  98.                 [1] = { 0, LH = { 0.666666666666667, 6.66666666666667 }, Flags = { Linear = true } }
  99.             }
  100.         },
  101.         pEmitter1SizeoverLife = LUTBezier {
  102.             KeyColorSplines = {
  103.                 [0] = {
  104.                     [0] = { 0.5, RH = { 0.3, 0.5 }, Flags = { Linear = true } },
  105.                     [1] = { 0.5, LH = { 0.7, 0.5 }, Flags = { Linear = true } }
  106.                 }
  107.             },
  108.             SplineColor = { Red = 192, Green = 128, Blue = 64 },
  109.             NameSet = true,
  110.         },
  111.         pEmitter1BluroverLife2D = LUTBezier {
  112.             KeyColorSplines = {
  113.                 [0] = {
  114.                     [0] = { 0.5, RH = { 0.3, 0.5 }, Flags = { Linear = true } },
  115.                     [1] = { 0.5, LH = { 0.7, 0.5 }, Flags = { Linear = true } }
  116.                 }
  117.             },
  118.             SplineColor = { Red = 192, Green = 128, Blue = 64 },
  119.             NameSet = true,
  120.         },
  121.         pRender1 = pRender {
  122.             Inputs = {
  123.                 _MotionBlurWarning = Input { Disabled = true, },
  124.                 Width = Input { Value = 1920, },
  125.                 Height = Input { Value = 1080, },
  126.                 ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
  127.                 OutputMode = Input { Disabled = true, },
  128.                 IntegrationMethod = Input { Value = FuID { "RK4" }, },
  129.                 ["MaterialID.MaterialID"] = Input { Value = 1, },
  130.                 ["ObjectID.ObjectID"] = Input { Value = 1, },
  131.                 Input = Input {
  132.                     SourceOp = "pCustom1",
  133.                     Source = "Output",
  134.                 },
  135.             },
  136.             ViewInfo = OperatorInfo { Pos = { 550, 313.5 } },
  137.         },
  138.         Replicate3D1 = Replicate3D {
  139.             Inputs = {
  140.                 Alignment = Input { Value = 2, },
  141.                 ["JitterScale.X"] = Input { Value = 1.364, },
  142.                 Destination = Input {
  143.                     SourceOp = "pRender1",
  144.                     Source = "Output",
  145.                 },
  146.                 Input1 = Input {
  147.                     SourceOp = "Shape3D1",
  148.                     Source = "Output",
  149.                 },
  150.             },
  151.             ViewInfo = OperatorInfo { Pos = { 660, 313.5 } },
  152.         },
  153.         Merge3D1 = Merge3D {
  154.             Inputs = {
  155.                 SceneInput1 = Input {
  156.                     SourceOp = "Replicate3D1",
  157.                     Source = "Data3D",
  158.                 },
  159.                 SceneInput2 = Input {
  160.                     SourceOp = "Camera3D1",
  161.                     Source = "Output",
  162.                 },
  163.             },
  164.             ViewInfo = OperatorInfo { Pos = { 770, 313.5 } },
  165.         },
  166.         Renderer3D1 = Renderer3D {
  167.             CustomData = {
  168.                 ToolVersion = 2,
  169.             },
  170.             Inputs = {
  171.                 Width = Input { Value = 1920, },
  172.                 Height = Input { Value = 1080, },
  173.                 ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
  174.                 SceneInput = Input {
  175.                     SourceOp = "Merge3D1",
  176.                     Source = "Output",
  177.                 },
  178.             },
  179.             ViewInfo = OperatorInfo { Pos = { 990, 313.5 } },
  180.         },
  181.         Shape3D1 = Shape3D {
  182.             Inputs = {
  183.                 ["Transform3DOp.Rotate.X"] = Input { Value = -90, },
  184.                 ["Transform3DOp.ScaleLock"] = Input { Value = 0, },
  185.                 ["Transform3DOp.Scale.X"] = Input { Value = 1.92, },
  186.                 ["Transform3DOp.Scale.Y"] = Input { Value = 1.08, },
  187.                 ["MtlStdInputs.MaterialID"] = Input { Value = 3, },
  188.                 ["SurfacePlaneInputs.Width"] = Input { Value = 2.18, },
  189.                 ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 3, }
  190.             },
  191.             ViewInfo = OperatorInfo { Pos = { 660, 379.5 } },
  192.         }
  193.     }
  194. }

User avatar
SirEdric
Fusionator
Posts: 1995
Joined: Tue Aug 05, 2014 10:04 am
Answers: 4
Real name: Eric Westphal
Been thanked: 146 times
Contact:

Re: Expression Syntax to change a Value over a given number of frames

#4

Post by SirEdric » Fri Jun 14, 2019 2:24 am

Immer gerne, eaerendil.
(Auch wenn mir das Synonym gerade nichts sagt...:-))

Obviously there were a few differences in the setups, and here's how to fix 'em:

First off, you need a ParticleType that actually supports Rotation parameters.
Point Particles don't have those, so let's switch to Blob.

My Particles where living on a x/y plane, so the original expression getr1b(pxi1+0.5,pyi1+0.5)*180 did the job.
In your case, we need to modify it a bit to getr1d(px+0.5,px+0.5)*90.
So we only take the x-position of the particle into account.

Voila...:-)

Code: Select all

{
	Tools = ordered() {
		pCustom1 = pCustom {
			ID = 4,
			CtrlWZoom = false,
			Inputs = {
				["CubeRgn.Height"] = Input { Value = 20, },
				["CubeRgn.Width"] = Input { Value = 20, },
				["CubeRgn.Depth"] = Input { Value = 20, },
				RotationZExpression = Input { Value = "getr1d(px+0.5,px+0.5)*90", },
				Input = Input {
					SourceOp = "pEmitter1",
					Source = "Output",
				},
				Image1 = Input {
					SourceOp = "Background2_2",
					Source = "Output",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 110, 412.5 } },
		},
		Background2_2 = Background {
			Inputs = {
				Width = Input { Value = 1920, },
				Height = Input { Value = 1080, },
				["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
				Type = Input { Value = FuID { "Gradient" }, },
				Gradient = Input {
					Value = Gradient {
						Colors = {
							[0.338926174496644] = { 0, 0, 0, 1 },
							[0.647651006711409] = { 1, 1, 1, 1 }
						}
					},
				},
				Offset = Input {
					SourceOp = "Background2_2Offset",
					Source = "Value",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 110, 346.5 } },
		},
		Background2_2Offset = BezierSpline {
			SplineColor = { Red = 234, Green = 92, Blue = 75 },
			NameSet = true,
			KeyFrames = {
				[0] = { -1, RH = { 33.3333333333333, -0.333333333333333 }, Flags = { Linear = true } },
				[100] = { 1, LH = { 66.6666666666667, 0.333333333333333 }, Flags = { Linear = true } }
			}
		},
		pEmitter1 = pEmitter {
			ID = 5,
			Inputs = {
				Number = Input {
					SourceOp = "pEmitter1Number",
					Source = "Value",
				},
				Lifespan = Input { Value = 1000, },
				VelocityControls = Input { Value = 1, },
				Velocity = Input { Value = 0.0519, },
				Angle = Input { Value = 180, },
				Style = Input { Value = FuID { "ParticleStyleBlob" }, },
				Region = Input { Value = FuID { "CubeRgn" }, },
				["ParticleStyle.SizeOverLife"] = Input {
					SourceOp = "pEmitter1SizeoverLife",
					Source = "Value",
				},
				["ParticleStyle.BlurOverLife"] = Input {
					SourceOp = "pEmitter1BluroverLife2D",
					Source = "Value",
				},
				["CubeRgn.Width"] = Input { Value = 20, },
				["CubeRgn.Height"] = Input { Value = 20, },
				["CubeRgn.Depth"] = Input { Value = 12.99, }
			},
			ViewInfo = OperatorInfo { Pos = { 0, 412.5 } },
		},
		pEmitter1Number = BezierSpline {
			SplineColor = { Red = 233, Green = 206, Blue = 78 },
			NameSet = true,
			KeyFrames = {
				[0] = { 20, RH = { 0.333333333333333, 13.3333333333333 }, Flags = { Linear = true } },
				[1] = { 0, LH = { 0.666666666666667, 6.66666666666667 }, Flags = { Linear = true } }
			}
		},
		pEmitter1SizeoverLife = 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 },
			NameSet = true,
		},
		pEmitter1BluroverLife2D = 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 },
			NameSet = true,
		},
		Replicate3D1 = Replicate3D {
			Inputs = {
				Alignment = Input { Value = 2, },
				["JitterScale.X"] = Input { Value = 1.364, },
				Destination = Input {
					SourceOp = "pRender1",
					Source = "Output",
				},
				Input1 = Input {
					SourceOp = "Shape3D1",
					Source = "Output",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 330, 412.5 } },
		},
		Renderer3D1 = Renderer3D {
			CustomData = {
				ToolVersion = 2
			},
			Inputs = {
				Width = Input { Value = 1920, },
				Height = Input { Value = 1080, },
				["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
				SceneInput = Input {
					SourceOp = "Merge3D1",
					Source = "Output",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 660, 412.5 } },
		},
		Shape3D1 = Shape3D {
			Inputs = {
				["Transform3DOp.Rotate.X"] = Input { Value = -90, },
				["Transform3DOp.ScaleLock"] = Input { Value = 0, },
				["Transform3DOp.Scale.X"] = Input { Value = 1.92, },
				["Transform3DOp.Scale.Y"] = Input { Value = 1.08, },
				["MtlStdInputs.MaterialID"] = Input { Value = 3, },
				["SurfacePlaneInputs.Width"] = Input { Value = 6.67, },
				["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 3, }
			},
			ViewInfo = OperatorInfo { Pos = { 330, 478.5 } },
		},
		pRender1 = pRender {
			Inputs = {
				_MotionBlurWarning = Input { Disabled = true, },
				Width = Input { Value = 1920, },
				Height = Input { Value = 1080, },
				["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
				OutputMode = Input { 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 = { 220, 412.5 } },
		},
		Merge3D1 = Merge3D {
			Inputs = {
				SceneInput1 = Input {
					SourceOp = "Replicate3D1",
					Source = "Data3D",
				},
				SceneInput2 = Input {
					SourceOp = "Camera3D1",
					Source = "Output",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 440, 412.5 } },
		},
		Camera3D1 = Camera3D {
			Inputs = {
				["Transform3DOp.Translate.Y"] = Input { Value = 60.8572815642879, },
				["Transform3DOp.Rotate.X"] = Input { Value = -90, },
				ProjectionType = Input { Value = FuID { "Orthographic" }, },
				AoV = Input { Value = 19.2642683071402, },
				["Stereo.Mode"] = Input { Value = FuID { "OffAxis" }, },
				FilmGate = Input { Value = FuID { "BMD_URSA_4K_16x9" }, },
				ApertureW = Input { Value = 0.831496062992126, },
				ApertureH = Input { Value = 0.467716535433071, },
				ViewingVolumeSize = Input { Value = 0.1893, },
				["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 2, },
				["MtlStdInputs.MaterialID"] = Input { Value = 2, },
			},
			ViewInfo = OperatorInfo { Pos = { 440, 247.5 } },
		}
	}
}
Cheers & all the best.

Eric.

User avatar
eaerendil
Posts: 5
Joined: Thu Sep 04, 2014 1:07 am

Re: Expression Syntax to change a Value over a given number of frames

#5

Post by eaerendil » Fri Jun 14, 2019 2:45 am

Der Mark von ehmals Magan Mana ;-)

User avatar
SirEdric
Fusionator
Posts: 1995
Joined: Tue Aug 05, 2014 10:04 am
Answers: 4
Real name: Eric Westphal
Been thanked: 146 times
Contact:

Re: Expression Syntax to change a Value over a given number of frames

#6

Post by SirEdric » Fri Jun 14, 2019 3:37 am

Ahhhh! DER!
Ja grüß' Dich ganz fein!

User avatar
eaerendil
Posts: 5
Joined: Thu Sep 04, 2014 1:07 am

Re: Expression Syntax to change a Value over a given number of frames

#7

Post by eaerendil » Fri Jun 14, 2019 8:29 am

sorry...one more stupid question. How would i modify the expression to drive the alpha of each particle to fade them out while theyrotate. :oops:

User avatar
SirEdric
Fusionator
Posts: 1995
Joined: Tue Aug 05, 2014 10:04 am
Answers: 4
Real name: Eric Westphal
Been thanked: 146 times
Contact:

Re: Expression Syntax to change a Value over a given number of frames

#8

Post by SirEdric » Fri Jun 14, 2019 8:42 am

Not stupid at all...:-)

Of course you could put a slightly modified expression into the particle's Alpha: geta1d(px+0.5,px+0.5)
However, since particles by default are comped additive, they would just 'pop off' when Alpha reaches zero.
So in your Red/Green/Blue Expression just add r*a (replacing 'r' with the respective color name...:-))

Cheers.

Eric.

User avatar
eaerendil
Posts: 5
Joined: Thu Sep 04, 2014 1:07 am

Re: Expression Syntax to change a Value over a given number of frames

#9

Post by eaerendil » Fri Jun 14, 2019 9:10 am

This is sadly not working for me
  1. {
  2.     Tools = ordered() {
  3.         Shape3D1 = Shape3D {
  4.             Inputs = {
  5.                 ["Transform3DOp.Rotate.X"] = Input { Value = -90, },
  6.                 ["Transform3DOp.ScaleLock"] = Input { Value = 0, },
  7.                 ["Transform3DOp.Scale.X"] = Input { Value = 1.92, },
  8.                 ["Transform3DOp.Scale.Y"] = Input { Value = 1.08, },
  9.                 ["MtlStdInputs.MaterialID"] = Input { Value = 3, },
  10.                 ["SurfacePlaneInputs.Width"] = Input { Value = 6.67, },
  11.                 ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 3, }
  12.             },
  13.             ViewInfo = OperatorInfo { Pos = { 1016, 372 } },
  14.         },
  15.         Renderer3D1 = Renderer3D {
  16.             CustomData = {
  17.                 ToolVersion = 2,
  18.             },
  19.             Inputs = {
  20.                 Width = Input { Value = 1920, },
  21.                 Height = Input { Value = 1080, },
  22.                 ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
  23.                 SceneInput = Input {
  24.                     SourceOp = "Merge3D1",
  25.                     Source = "Output",
  26.                 },
  27.             },
  28.             ViewInfo = OperatorInfo { Pos = { 1346, 306 } },
  29.         },
  30.         Merge3D1 = Merge3D {
  31.             Inputs = {
  32.                 SceneInput1 = Input {
  33.                     SourceOp = "Replicate3D1",
  34.                     Source = "Data3D",
  35.                 },
  36.                 SceneInput2 = Input {
  37.                     SourceOp = "Camera3D1",
  38.                     Source = "Output",
  39.                 },
  40.             },
  41.             ViewInfo = OperatorInfo { Pos = { 1126.5, 304.014 } },
  42.         },
  43.         Replicate3D1 = Replicate3D {
  44.             Inputs = {
  45.                 Alignment = Input { Value = 2, },
  46.                 PerParticleColors = Input { Value = 2, },
  47.                 ["JitterScale.X"] = Input { Value = 1.364, },
  48.                 Destination = Input {
  49.                     SourceOp = "pRender1",
  50.                     Source = "Output",
  51.                 },
  52.                 Input1 = Input {
  53.                     SourceOp = "Shape3D1",
  54.                     Source = "Output",
  55.                 },
  56.             },
  57.             ViewInfo = OperatorInfo { Pos = { 1013.37, 302.869 } },
  58.         },
  59.         pCustom1 = pCustom {
  60.             ID = 1,
  61.             CtrlWZoom = false,
  62.             Inputs = {
  63.                 ["CubeRgn.Height"] = Input { Value = 20, },
  64.                 ["CubeRgn.Width"] = Input { Value = 20, },
  65.                 ["CubeRgn.Depth"] = Input { Value = 20, },
  66.                 RotationZExpression = Input { Value = "getr1d(px+0.5,px+0.5)*90", },
  67.                 RedExpression = Input { Value = "r*a", },
  68.                 GreenExpression = Input { Value = "g*a", },
  69.                 BlueExpression = Input { Value = "b*a\n", },
  70.                 AlphaExpression = Input { Value = "geta1d(px+0.5,px+0.5)\n ", },
  71.                 Input = Input {
  72.                     SourceOp = "pEmitter1",
  73.                     Source = "Output",
  74.                 },
  75.                 Image1 = Input {
  76.                     SourceOp = "Background2_2",
  77.                     Source = "Output",
  78.                 },
  79.             },
  80.             ViewInfo = OperatorInfo { Pos = { 798.062, 299.752 } },
  81.         },
  82.         pRender1 = pRender {
  83.             Inputs = {
  84.                 _MotionBlurWarning = Input { Disabled = true, },
  85.                 Width = Input { Value = 1920, },
  86.                 Height = Input { Value = 1080, },
  87.                 ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
  88.                 OutputMode = Input { Disabled = true, },
  89.                 IntegrationMethod = Input { Value = FuID { "RK4" }, },
  90.                 ["MaterialID.MaterialID"] = Input { Value = 1, },
  91.                 ["ObjectID.ObjectID"] = Input { Value = 1, },
  92.                 Input = Input {
  93.                     SourceOp = "pCustom1",
  94.                     Source = "Output",
  95.                 },
  96.             },
  97.             ViewInfo = OperatorInfo { Pos = { 906, 306 } },
  98.         },
  99.         pEmitter1 = pEmitter {
  100.             ID = 4,
  101.             Inputs = {
  102.                 Number = Input {
  103.                     SourceOp = "pEmitter1Number",
  104.                     Source = "Value",
  105.                 },
  106.                 Lifespan = Input { Value = 1000, },
  107.                 VelocityControls = Input { Value = 1, },
  108.                 Velocity = Input { Value = 0.0519, },
  109.                 Angle = Input { Value = 180, },
  110.                 Style = Input { Value = FuID { "ParticleStyleBlob" }, },
  111.                 Region = Input { Value = FuID { "CubeRgn" }, },
  112.                 ["ParticleStyle.SizeOverLife"] = Input {
  113.                     SourceOp = "pEmitter1SizeoverLife",
  114.                     Source = "Value",
  115.                 },
  116.                 ["ParticleStyle.BlurOverLife"] = Input {
  117.                     SourceOp = "pEmitter1BluroverLife2D",
  118.                     Source = "Value",
  119.                 },
  120.                 ["CubeRgn.Width"] = Input { Value = 20, },
  121.                 ["CubeRgn.Height"] = Input { Value = 20, },
  122.                 ["CubeRgn.Depth"] = Input { Value = 12.99, }
  123.             },
  124.             ViewInfo = OperatorInfo { Pos = { 686, 306 } },
  125.         },
  126.         pEmitter1Number = BezierSpline {
  127.             SplineColor = { Red = 233, Green = 206, Blue = 78 },
  128.             NameSet = true,
  129.             KeyFrames = {
  130.                 [0] = { 20, RH = { 0.333333333333333, 13.3333333333333 }, Flags = { Linear = true } },
  131.                 [1] = { 0, LH = { 0.666666666666667, 6.66666666666667 }, Flags = { Linear = true } }
  132.             }
  133.         },
  134.         pEmitter1SizeoverLife = LUTBezier {
  135.             KeyColorSplines = {
  136.                 [0] = {
  137.                     [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
  138.                     [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
  139.                 }
  140.             },
  141.             SplineColor = { Red = 192, Green = 128, Blue = 64 },
  142.         },
  143.         pEmitter1BluroverLife2D = LUTBezier {
  144.             KeyColorSplines = {
  145.                 [0] = {
  146.                     [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
  147.                     [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
  148.                 }
  149.             },
  150.             SplineColor = { Red = 192, Green = 128, Blue = 64 },
  151.         },
  152.         Background2_2 = Background {
  153.             Inputs = {
  154.                 Width = Input { Value = 1920, },
  155.                 Height = Input { Value = 1080, },
  156.                 ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
  157.                 Type = Input { Value = FuID { "Gradient" }, },
  158.                 Gradient = Input {
  159.                     Value = Gradient {
  160.                         Colors = {
  161.                             [0.338926174496644] = { 0, 0, 0, 1 },
  162.                             [0.647651006711409] = { 1, 1, 1, 1 }
  163.                         }
  164.                     },
  165.                 },
  166.                 Offset = Input {
  167.                     SourceOp = "Background2_2Offset",
  168.                     Source = "Value",
  169.                 },
  170.             },
  171.             ViewInfo = OperatorInfo { Pos = { 796, 240 } },
  172.         },
  173.         Background2_2Offset = BezierSpline {
  174.             SplineColor = { Red = 234, Green = 92, Blue = 75 },
  175.             NameSet = true,
  176.             KeyFrames = {
  177.                 [0] = { -1, RH = { 33.3333333333333, -0.333333333333333 }, Flags = { Linear = true } },
  178.                 [100] = { 1, LH = { 66.6666666666667, 0.333333333333333 }, Flags = { Linear = true } }
  179.             }
  180.         },
  181.         Camera3D1 = Camera3D {
  182.             Inputs = {
  183.                 ["Transform3DOp.Translate.Y"] = Input { Value = 60.8572815642879, },
  184.                 ["Transform3DOp.Rotate.X"] = Input { Value = -90, },
  185.                 ProjectionType = Input { Value = FuID { "Orthographic" }, },
  186.                 AoV = Input { Value = 19.2642683071402, },
  187.                 ["Stereo.Mode"] = Input { Value = FuID { "OffAxis" }, },
  188.                 FilmGate = Input { Value = FuID { "BMD_URSA_4K_16x9" }, },
  189.                 ApertureW = Input { Value = 0.831496062992126, },
  190.                 ApertureH = Input { Value = 0.467716535433071, },
  191.                 ViewingVolumeSize = Input { Value = 0.1893, },
  192.                 ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 2, },
  193.                 ["MtlStdInputs.MaterialID"] = Input { Value = 2, },
  194.             },
  195.             ViewInfo = OperatorInfo { Pos = { 1126, 141 } },
  196.         }
  197.     }
  198. }

User avatar
SirEdric
Fusionator
Posts: 1995
Joined: Tue Aug 05, 2014 10:04 am
Answers: 4
Real name: Eric Westphal
Been thanked: 146 times
Contact:

Re: Expression Syntax to change a Value over a given number of frames

#10

Post by SirEdric » Fri Jun 14, 2019 9:16 am

It would, if you had set your BG's Alpha to 0 in the Black part...:-)

Added in 2 minutes 6 seconds:
PS: Alternatively, keep your BG's Alpha all at 1 and use the exact same expression in Alpha as you did in Rotation: getr1d(px+0.5,px+0.5)