Working with Sprite Sheets / Note On



  • I'm trying to animate a sprite sheets (png) where the animation is triggered and disabled with Note on information. I've done this in Kontakt many times with a custom script that looks something like this:

    DECLARATION
    declare $i
    declare $wait
    declare $run
    declare $playing
    declare $speed
    declare $center
    declare $ease_out
    declare $animation_width := 0
    $center := (275-$animation_width)
    declare ui_label $animation(1, 1)

    set_control_par_str(get_ui_id($animation),$CONTROL_PAR_PICTURE,"animation_noteon")
    set_control_par(get_ui_id($animation),$CONTROL_PAR_PICTURE_STATE,0)
    set_control_par(get_ui_id($animation),$CONTROL_PAR_WIDTH,$animation_width)
    set_control_par(get_ui_id($animation),$CONTROL_PAR_HEIGHT,100)
    set_control_par(get_ui_id($animation),$CONTROL_PAR_POS_X,$center+33)
    set_control_par(get_ui_id($animation),$CONTROL_PAR_POS_Y,50)

    CONTROL
    function animation
    $i := 0
    while ($run=1)
    $playing := 1
    set_control_par(get_ui_id($animation),$CONTROL_PAR_PICTURE_STATE,$i)
    inc($i)
    if ($i=90)
    $i := 0
    end if
    wait($wait)
    end while
    end function

    on note
    $speed := 10+($EVENT_NOTE/2)+($EVENT_VELOCITY/10*2)
    $wait := 1000000/$speed

    $ease_out := 0
    $run := 1
    if ($playing=0)
    call animation
    end if
    end on

    on release
    if (search(%KEY_DOWN,1)=-1)
    $ease_out := 10
    else
    $ease_out := 0
    end if
    while (search(%KEY_DOWN,1)=-1 and ($ease_out>0))
    dec($ease_out)
    dec($speed)
    $wait := 1000000/$speed+1
    if ($ease_out=0)
    $playing := 0
    $run := 0
    end if
    wait($wait)
    end while

    Can someone direct me to any comparable HISE callbacks, snippets or expressions that may get me headed in the proper direction? I've been able to create a knob using the my sprite sheet but I have not determined the best way to trigger the animation using any NoteOn functions.

    Thanks in advance for your comments and replies!



  • There is no wait statement in HISE. Instead you should use the timer callback.


Log in to reply
 

9
Online

503
Users

1.8k
Topics

13.7k
Posts