samples/07_advanced_rendering/03_render_target_viewports/app/main.rb
# Determines if button was clicked, and changes its appearance if it is clicked
Determines if button was clicked, and changes its appearance if it is clicked
Determines if button was clicked and changes its appearance if it is clicked
def tick_button_prefab button
    outputs.labels << button.label 
    outputs.borders << button.border
    if button_clicked? button 
      button.clicked_at = inputs.mouse.click.created_at 
    end
    if button.clicked_at 
      outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h,
                         0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] 
    end
  end
def tick_button_prefab button outputs . labels << button . label outputs . borders << button . border if button_clicked? button button . clicked_at = inputs . mouse . click . created_at end if button . clicked_at outputs . solids << [ button . border . x , button . border . y , button . border . w , button . border . h , 0 , 180 , 80 , 255 * button . clicked_at . ease ( 0.25 . seconds , :flip ) ] end end
Determines if button was clicked, and changes its appearance if it is clicked
Determines if button was clicked and changes its appearance if it is clicked
# outputs button's label and border # if button is clicked # stores the time that the button was clicked # if clicked_at has a frame value and is not nil # button is output; color changes and transparency changes for 0.25 seconds after click occurs # transparency changes for 0.25 seconds
button