Author Topic: Nutcracker: User Defined Effects  (Read 827 times)

Offline smeighan

  • Moderator
  • Sr. Member
  • *****
  • Posts: 2285
    • Nutcracker RGB Sequence Builder
Nutcracker: User Defined Effects
« on: June 11, 2012, »
I was asked on another forum about some simple effects. I posted 1-2 months ago about the user defined effect. Remember, this is where you can write a few lines of code and create effects.

I will gather 50-100 of these togeter and post them as a basic effect class. How to do this programming is the class i will teach this weekend on advanced Nutcracker. In the advanced calss i will probably also explain how to get nutcracker effects synced to your mp3 music timeline (a new feature).


So many of the basic effects can be done with the user defined class. This allows you to write your own effects. I will be teaching (and documenting this) for the  academy this weekend. I am going to gather a bunch of them together and make a new basic class. Maybe it will have 20-30 effects.

Here is a user defined effect (meaning you can type in the php code to generate basic effects).  See the bolded line below that creates this flashing color cycle
array_to_save
username   f
user_target   AA
effect_class   user_defined
effect_name   USER1
window_degrees   180
start_color   #FFFFFF
end_color   #FFFFFF
frame_delay   200
sparkles   0
param1   1
param2   2
seq_duration   2
php_program   if($frame%4==0) $rgb=hexdec(\"#FFFFFF\"); if($frame%4==1) $rgb=hexdec(\"#FF0000\"); if($frame%4==2) $rgb=hexdec(\"#00FF00\"); if($frame%4==3) $rgb=hexdec(\"#0000FF\");
submit   Submit Form to create your effect
OBJECT_NAME   user_defined


Here is another example:
array_to_save
username   f
user_target   AA
effect_class   user_defined
effect_name   USER7
window_degrees   180
start_color   #FFFFFF
end_color   #FFFFFF
frame_delay   200
sparkles   0
param1   3
param2   2
seq_duration   2
php_program    # function user_defined($frame,$s,$p,$maxFrame,$maxStrand,$maxPixel,$param1,$param2,$start_color,$end_color) $rgb=hexdec(\"#FFFFFF\"); $H=$S=$V=1; $slice=$param1; // use first parameter passed in from user $slice_size=$maxPixel/$slice; $H0 = (($frame% $slice) * $slice_size); $H=($p+$H0)/$maxPixel; if($H>1) $H = $H-intval($H); $rgb=HSV_TO_RGB ($H, $S, $V); return $rgb;
submit   Submit Form to create your effect
OBJECT_NAME   user_defined



One more. Again, the bolded line is the entire program to create this effect. I will have a document describing how to create your own. The doc will describe the functions available to use.


array_to_save
username   f
user_target   AA
effect_class   user_defined
effect_name   USER9
window_degrees   180
start_color   #FFFFFF
end_color   #FFFFFF
frame_delay   200
sparkles   0
param1   3
param2   2
seq_duration   2
php_program    $H = rand(1,100)/100; $S=rand(1,100)/100; $V=rand(1,100)/100; if(($p+$maxFrame-$frame/2)%5==0) { $H=$p/$maxPixel; $S=$V=1; } $rgb=HSV_TO_RGB ($H, $S, $V);
submit   Submit Form to create your effect
OBJECT_NAME   user_defined





another:
array_to_save
username   f
user_target   AA
effect_class   user_defined
effect_name   USER3
window_degrees   180
start_color   #FFFFFF
end_color   #FFFFFF
frame_delay   100
sparkles   0
param1   1
param2   2
seq_duration   2
php_program    $H=$S=$V=0; if($s%2==0) { if($p<=$frame) { $H=$p/$maxPixel; $S=$V=1; } } else if($s%2==1) { if($p>=($maxPixel-$frame)) { $H=1- ($p/$maxPixel); $S=$V=1; } } $rgb=HSV_TO_RGB ($H, $S, $V);
submit   Submit Form to create your effect
OBJECT_NAME   user_defined




I will probably build 50-100 of these by end of summer and just create them all into the basic effect library.

first, i will get the nutcracker to sync its effects to the music.
Sean
Littleton, CO
Latest releases You are not allowed to view links. Register or Login
xLights/Nutcracker Forum You are not allowed to view links. Register or Login
Fbook You are not allowed to view links. Register or Login