# 05 sample_laybtn_ease.hsp

sample\ 05 sample_laybtn_ease.hsp

    #include "mod_layerbutton.hsp"

    // ボタン作成
    pos 10,100
    repeat 4
    	tien = 10*cnt
    	pos ,ginfo_cy+10
    	layerbutton 180,60, tien, 0, 30+tien,20,0, 15+tien/2,10,0 {
    		if lparam == objlayer_cmddraw {
    			color 0,0,0 : font msgothic, 18, 1
    			ti = objlayer_option
    			// ボタン状態で分岐 (+イージングで表示位置,色を変える)
    			switch layerbtn_stat
    			case LAYBTN_SHOW_IN
    				color 0,0,255 : laybtn_boxfb objlayer_axis_x-laybtn_ease(200, 0, ti), objlayer_axis_y, objlayer_axis_x2-laybtn_ease(200, 0, ti), objlayer_axis_y2, -1
    				color 250,250,250 : laybtn_mes "遅延="+ti,0, 1,1, -laybtn_ease(200, 0, ti)
    				swbreak
    			case LAYBTN_FOCUS_IN
    				color laybtn_ease(0,128),0,255 : laybtn_boxfb objlayer_axis_x, objlayer_axis_y, objlayer_axis_x2, objlayer_axis_y2, -1
    				color 250,250,250 : laybtn_mes "遅延="+ti,0, 1,1
    				swbreak
    			case LAYBTN_FOCUS_OUT
    				color laybtn_ease(128,0),0,255 : laybtn_boxfb objlayer_axis_x, objlayer_axis_y, objlayer_axis_x2, objlayer_axis_y2, -1
    				color 250,250,250 : laybtn_mes "遅延="+ti,0, 1,1
    				swbreak
    			case LAYBTN_PRESS_IN
    				color 128,128,255 : laybtn_boxfb objlayer_axis_x, objlayer_axis_y, objlayer_axis_x2, objlayer_axis_y2, -1
    				color 250,250,250 : laybtn_mes "遅延="+ti,0, 1,1
    				swbreak
    			case LAYBTN_SHOW_OUT
    			case LAYBTN_SHOW_OUT_SELECTED
    				if layerbtn_stat & LAYBTN_SELECTED { color 128,128,255 } else { color 0,0,255 }
    				laybtn_boxfb objlayer_axis_x-laybtn_ease(0, 200, ti/2), objlayer_axis_y, objlayer_axis_x2-laybtn_ease(0, 200, ti/2), objlayer_axis_y2, -1
    				color 250,250,250 : laybtn_mes "遅延="+ti,0, 1,1, -laybtn_ease(0, 200, ti/2)
    				swbreak
    			swend
    		}
    		return
    	}
    loop
    // 表示ループ
    repeat
    	redraw 0 : color 255,255,255 : boxf : color : pos 0,0 : font msgothic,17
    	redraw 1
    	await 1000/60
    loop