Notifications
Clear all

[Closed] Listbox Question

Hi everyone,

I’ve been trying to construct a listbox on my rollout that will offer 6 animation presets;
The presets will contain variations on the following information:


  animationRange = interval 0 960
 at time 0 l.color = (color 191 94 85)
 at time 480 l.color = (color 201 145 88)
 at time 960 l.color = (color 210 168 58)  

anyone got any ideas on how i can link this information to the items in the listbox?

I was using the following- But couldn’t work out how to add any of the keyframe information in with the array.

 local DynArray = #() 
 	
    
 	fn buildDynList =
 	(
 		
 		struct sDyn ( name,value )
 		
 		append DynArray (sDyn "Dynamic Reds" (interval 0 960))
 		append DynArray (sDyn "Dynamic Greens" (interval 0 500)) 
 		append DynArray (sDyn "Dynamic Blues" (interval 0 60))
 		append DynArray (sDyn "Dynamic Circadian" (interval 0 300)) 
 		append DynArray (sDyn "kaleidoscope" (interval 0 200))
 		append DynArray (sDyn "Colour Temeratures"(interval 0 1100))
 	) 
 
 		on Apply2 pressed do
 	(
 		if queryBox "This operation will adjust the animation length. Do you want to continue?" beep:false then
 		local theDynamic = for d in DynArray where d.name == dynamicLst.selected collect d.value
 	   
 		for l in lights where l.isSelected do
 					with animate on
 					animationRange = theDynamic[1]
 
 )
 

Thanks for your time,

JPN5

1 Reply

several ways you could go about it – I think the easiest might be replacing the single ‘value’ in your sDyn struct with two arrays:


 struct sDyn (
   name,
   colorTimes,
   colorValues
 )
 
myDyn = sDyn \
	name:"myDyn" \
	colorTimes:#(0,480,960) \
	colorValues:#((color 191 94 85), (color 201 145 88), (color 210 168 58))

 for i = 1 to myDyn.colorTimes.count do (
 	at time (myDyn.colorTimes[i]) ( l.color = myDyn.colorValues[i] )
 )
 

Edit: wrapped the myDyn line – the ‘keyword:’ bits are optional