--------------------------------------------------------------------
-- e_flower.lua
-- 花（画面内へ入る）
--
-- author IZUMI STUDIO
-- date 2009-10-05
--------------------------------------------------------------------
require(".\\scripts\\common")

PROJ_FOV        = 3.1415 * 25.0 / 180.0
PROJ_RADIUS     = 40.0 / math.cos( PROJ_FOV / 2.0 )
PROJ_HALF_WIDTH = PROJ_RADIUS * math.sin( PROJ_FOV / 2.0 )
PROJ_WIDTH      = PROJ_HALF_WIDTH * 2.0

IMAGE_NAME = "sunflower_photo"

function createElement_Flower_In( _delay, _endFrame, _x, _y )
	
	mover = Effect.CreateAnimator_PointToPoint(
		_x, _y+4.0, 0.0,
		_x, _y, 0.0,
		INTERPOLATION_EASE_OUT,
		20,
		ANIMATOR_LOOP_NO )

	rotator = Effect.CreateAnimator_Still(
		0.0, 0.0, 0.0,
		0.0, 0.0, 0.0 )
	
	Effect.CreateElement_Sprite( 
		IMAGE_NAME,
		220.0/800.0*1.333*PROJ_WIDTH, 220.0/800.0*1.333*PROJ_WIDTH, INTERPOLATION_LINEAR,
		220.0/600.0*PROJ_WIDTH, 220.0/600.0*PROJ_WIDTH, INTERPOLATION_LINEAR,
		1.0, 1.0, INTERPOLATION_LINEAR,
		EFFECT_BLEND_NORMAL,
		EFFECT_BILLBOARD_NORMAL,
		_delay, _endFrame, 1,
		0,
		mover,
		rotator )
end


function createElement_Flower( _delay, _endFrame, _x, _y )
	
	mover = Effect.CreateAnimator_Still(
		_x, _y, 0.0,
		0.0, 0.0, 0.0 )

	rotator = Effect.CreateAnimator_Still(
		0.0, 0.0, 0.0,
		0.0, 0.0, 0.0 )
	
	Effect.CreateElement_Sprite( 
		IMAGE_NAME,
		220.0/800.0*1.333*PROJ_WIDTH, 220.0/800.0*1.333*PROJ_WIDTH, INTERPOLATION_LINEAR,
		220.0/600.0*PROJ_WIDTH, 220.0/600.0*PROJ_WIDTH, INTERPOLATION_LINEAR,
		1.0, 1.0, INTERPOLATION_LINEAR,
		EFFECT_BLEND_NORMAL,
		EFFECT_BILLBOARD_NORMAL,
		_delay, _endFrame, 0,
		0,
		mover,
		rotator )
end


createElement_Flower_In( 
	0, 20,
	(53.0-400.0)/400.0*1.333*PROJ_HALF_WIDTH, 
	(300.0-66.0)/300.0*PROJ_HALF_WIDTH )

createElement_Flower( 
	20-1, 1000,
	(53.0-400.0)/400.0*1.333*PROJ_HALF_WIDTH, 
	(300.0-66.0)/300.0*PROJ_HALF_WIDTH )



