HISE Logo Forum
    • Categories
    • Register
    • Login

    Working with Sprite Sheets / Note On

    Scheduled Pinned Locked Moved Scripting
    2 Posts 2 Posters 248 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      SonoLuminus
      last edited by SonoLuminus

      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!

      1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey
        last edited by

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

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        1 Reply Last reply Reply Quote 0
        • First post
          Last post

        49

        Online

        1.7k

        Users

        11.7k

        Topics

        101.9k

        Posts