当前位置: 首页>>代码示例>>C++>>正文


C++ Animation::Play方法代码示例

本文整理汇总了C++中Animation::Play方法的典型用法代码示例。如果您正苦于以下问题:C++ Animation::Play方法的具体用法?C++ Animation::Play怎么用?C++ Animation::Play使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Animation的用法示例。


在下文中一共展示了Animation::Play方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: StartTransition

void DissolveEffectApp::StartTransition(Vector2 position, Vector2 displacement)
{
  mAnimation = Animation::New(TRANSITION_DURATION);

  Dali::Toolkit::DissolveEffectSetCentralLine( mCurrentImage, position, displacement, 0.0f );
  mCurrentImage.SetProperty( Toolkit::ImageView::Property::IMAGE, mDissolveEffect );
  mAnimation.AnimateTo( Property( mCurrentImage, "uPercentage" ), 1.0f, AlphaFunction::LINEAR );

  mNextImage.SetOpacity(0.0f);
  mAnimation.AnimateTo( Property( mNextImage, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunction::LINEAR );

  if(mUseHighPrecision)
  {
    Dali::Toolkit::DissolveEffectSetCentralLine( mNextImage, position, displacement, 1.0f );
    mNextImage.SetProperty( Toolkit::ImageView::Property::IMAGE, mDissolveEffect );
    mAnimation.AnimateTo( Property( mNextImage, "uPercentage" ), 0.0f, AlphaFunction::LINEAR );
  }
  else
  {
    mAnimation.AnimateTo( Property( mNextImage, Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), AlphaFunction::LINEAR );
  }

  mAnimation.FinishedSignal().Connect( this, &DissolveEffectApp::OnTransitionCompleted );
  mAnimation.Play();
  mIsTransiting = true;
}
开发者ID:tizenorg,项目名称:platform.core.uifw.dali-demo,代码行数:26,代码来源:dissolve-effect-example.cpp

示例2: ContinueAnimation

 /**
  * Resumes animation for another ANIMATION_DURATION seconds.
  */
 void ContinueAnimation()
 {
   Animation animation = Animation::New(ANIMATION_DURATION);
   mAnimationTime += ANIMATION_DURATION;
   animation.AnimateTo( Property(mBouncingMagnifier, mAnimationTimeProperty), mAnimationTime );
   animation.Play();
   animation.FinishedSignal().Connect(this, &ExampleController::OnAnimationFinished);
 }
开发者ID:tizenorg,项目名称:platform.core.uifw.dali-demo,代码行数:11,代码来源:magnifier-example.cpp

示例3: main

int main ()
{
  printf ("Results of animation2_test:\n");
  
  try
  {  
    AnimationManager manager;
    
    manager.LoadResource ("data/test.xanim");

    Node::Pointer node = Node::Create (), target1 = Node::Create (), target2 = Node::Create ();
    
    target1->SetName ("target1");
    target2->SetName ("target2");

    target1->BindToParent (*node);
    target2->BindToParent (*node);

    Animation animation = manager.PlayAnimation ("animation1", *node, &event_handler);
    
    animation.RegisterEventHandler (AnimationEvent_OnPlay, &event_handler);
    animation.RegisterEventHandler (AnimationEvent_OnPause, &event_handler);
    animation.RegisterEventHandler (AnimationEvent_OnStop, &event_handler);
    animation.RegisterEventHandler (AnimationEvent_OnUpdate, &event_handler);
    animation.RegisterEventHandler (AnimationEvent_OnDestroy, &event_handler);
    
    printf ("animation duration: %.2f\n", animation.Duration ());

    node->Update (TimeValue (2, 1));
    node->Update (TimeValue (3, 1));
    
    animation.Pause ();
    animation.Pause ();
    
    node->Update (TimeValue (4, 1));
    
    printf ("animation offset %.2f\n", animation.Tell ());
    
    animation.Play ();
    animation.Play ();
    
    node->Update (TimeValue (5, 1));
    
    printf ("animation offset %.2f\n", animation.Tell ());    
    
    animation.Stop ();
    
    node->Update (TimeValue (6, 1));    
    
    printf ("animation offset %.2f\n", animation.Tell ());
  }
  catch (std::exception& e)
  {
    printf ("%s\n", e.what ());
  }

  return 0;
}
开发者ID:untgames,项目名称:funner,代码行数:58,代码来源:animation2.cpp

示例4: UtcDaliBubbleEmitterRestore

int UtcDaliBubbleEmitterRestore(void)
{
  ToolkitTestApplication application;
  tet_infoline( " UtcDaliBubbleEmitterRestore " );

  Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 90, Vector2( 5.f, 10.f ));
  Actor root = emitter.GetRootActor();
  Stage::GetCurrent().Add( root );
  root.SetPosition( Vector3::ZERO );
  root.SetParentOrigin( ParentOrigin::CENTER );
  root.SetAnchorPoint( AnchorPoint::CENTER );

  Actor bubbleMesh = root.GetChildAt( 0 );
  Renderer renderer = bubbleMesh.GetRendererAt( 0 );
  DALI_TEST_CHECK( renderer );

  TestGlAbstraction& gl = application.GetGlAbstraction();

  float percentageValue;
  Vector4 startEndPosValue;

  Animation animation = Animation::New( 0.5f );
  emitter.EmitBubble( animation, Vector2(40.f,40.f), Vector2(-5.f,-5.f), Vector2(30.f,30.f) );

  Wait(application);

  DALI_TEST_CHECK( gl.GetUniformValue<float>( "uPercentage[0]", percentageValue ) );
  DALI_TEST_EQUALS( percentageValue, 0.f, TEST_LOCATION );

  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uStartEndPosition[0]", startEndPosValue ) );
  DALI_TEST_EQUALS( startEndPosValue.x, 40.f, TEST_LOCATION );
  DALI_TEST_EQUALS( startEndPosValue.y, 40.f, TEST_LOCATION );

  animation.Play();
  Wait(application, 200);
  animation.Clear();

  DALI_TEST_CHECK( gl.GetUniformValue<float>( "uPercentage[0]", percentageValue ) );
  DALI_TEST_CHECK( percentageValue < 0.5f && percentageValue >= 0.4);

  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uStartEndPosition[0]", startEndPosValue ) );
  DALI_TEST_EQUALS( startEndPosValue.x, 40.f, TEST_LOCATION );
  DALI_TEST_EQUALS( startEndPosValue.y, 40.f, TEST_LOCATION );

  emitter.Restore();
  application.SendNotification();
  application.Render();

  DALI_TEST_CHECK( gl.GetUniformValue<float>( "uPercentage[0]", percentageValue ) );
  DALI_TEST_EQUALS( percentageValue, 0.f, TEST_LOCATION );

  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uStartEndPosition[0]", startEndPosValue ) );
  DALI_TEST_EQUALS( startEndPosValue,  Vector4::ZERO, TEST_LOCATION );

  END_TEST;
}
开发者ID:mettalla,项目名称:dali,代码行数:57,代码来源:utc-Dali-BubbleEmitter.cpp

示例5: UtcDaliControlImplSizeAnimation

int UtcDaliControlImplSizeAnimation(void)
{
  ToolkitTestApplication application;

  {
    DummyControl dummy = DummyControl::New( true );
    DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());

    Stage::GetCurrent().Add(dummy);

    DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, false, TEST_LOCATION );
    Animation animation = Animation::New(1.0f);
    animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
    animation.Play();

    application.Render();
    application.SendNotification();
    application.Render();
    application.SendNotification();

    DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, true, TEST_LOCATION );

    Stage::GetCurrent().Remove(dummy);
  }

  // Ensure full code coverage
  {
    DummyControl dummy = DummyControl::New();

    Stage::GetCurrent().Add(dummy);

    Animation animation = Animation::New(1.0f);
    animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
    animation.Play();

    application.Render();
    application.SendNotification();
    application.Render();
    application.SendNotification();

    Stage::GetCurrent().Remove(dummy);
  }
  END_TEST;
}
开发者ID:Tarnyko,项目名称:dal-toolkit,代码行数:44,代码来源:utc-Dali-ControlImpl.cpp

示例6: HideMagnifier

 /**
  * Hides the magnifier
  */
 void HideMagnifier()
 {
   if(mMagnifierShown)
   {
     Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION);
     animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ZERO, AlphaFunction::EASE_OUT);
     animation.Play();
     mMagnifierShown = false;
   }
 }
开发者ID:tizenorg,项目名称:platform.core.uifw.dali-demo,代码行数:13,代码来源:magnifier-example.cpp

示例7: ShowMagnifier

 /**
  * Shows the magnifier
  */
 void ShowMagnifier()
 {
   if(!mMagnifierShown)
   {
     Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION);
     animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ONE, AlphaFunction::EASE_IN);
     animation.Play();
     mMagnifierShown = true;
   }
 }
开发者ID:tizenorg,项目名称:platform.core.uifw.dali-demo,代码行数:13,代码来源:magnifier-example.cpp

示例8: UtcDaliShaderAnimatedProperty02

int UtcDaliShaderAnimatedProperty02(void)
{
  TestApplication application;

  tet_infoline("Test that a uniform map shader property can be animated");

  Shader shader = Shader::New(VertexSource, FragmentSource);
  Material material = Material::New( shader );
  material.SetProperty(Material::Property::COLOR, Color::WHITE);

  Geometry geometry = CreateQuadGeometry();
  Renderer renderer = Renderer::New( geometry, material );

  Actor actor = Actor::New();
  actor.AddRenderer(renderer);
  actor.SetSize(400, 400);
  Stage::GetCurrent().Add(actor);
  application.SendNotification();
  application.Render(0);

  Vector4 initialColor = Color::WHITE;
  Property::Index colorIndex = shader.RegisterProperty( "uFadeColor", initialColor );

  TestGlAbstraction& gl = application.GetGlAbstraction();

  application.SendNotification();
  application.Render(0);

  Vector4 actualValue(Vector4::ZERO);
  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
  DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );

  Animation  animation = Animation::New(1.0f);
  KeyFrames keyFrames = KeyFrames::New();
  keyFrames.Add(0.0f, initialColor);
  keyFrames.Add(1.0f, Color::TRANSPARENT);
  animation.AnimateBetween( Property( shader, colorIndex ), keyFrames );
  animation.Play();

  application.SendNotification();
  application.Render(500);

  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
  DALI_TEST_EQUALS( actualValue, Color::WHITE * 0.5f, TEST_LOCATION );

  application.Render(500);
  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
  DALI_TEST_EQUALS( actualValue, Color::TRANSPARENT, TEST_LOCATION );

  END_TEST;
}
开发者ID:mettalla,项目名称:dali,代码行数:51,代码来源:utc-Dali-Shader.cpp

示例9: Init

void Stage_Ending::Init()
{
	timer = 0;
	TextureManager::GetSingleton().Add(L"data\\ending\\background.png");
	TextureManager::GetSingleton().Add(L"data\\ending\\flag.png");
	TextureManager::GetSingleton().Init();

	Entity *newEntity = new Entity(L"data\\ending\\background.png", 800, 600);
	newEntity->SetPos(0, 0);
	entities.push_back(newEntity);

	Animation *newAnimation = new Animation(L"data\\ending\\flag.png", 2000, 120, 1, 20);
	newAnimation->SetPos(236, 200);
	newAnimation->Play(15.0f, true);
	entities.push_back(newAnimation);
}
开发者ID:iAmGhost,项目名称:Dokdo_Pasta,代码行数:16,代码来源:Stage_Ending.cpp

示例10: UtcDaliPropertyNotificationOrder

int UtcDaliPropertyNotificationOrder(void)
{
  TestApplication application; // Reset all test adapter return codes

  Actor actor = Actor::New();
  Stage::GetCurrent().Add(actor);
  // this should complete in first frame
  PropertyNotification notification1 = actor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(90.0f) );
  notification1.NotifySignal().Connect( &TestCallback );
  // this should complete in second frame
  PropertyNotification notification2 = actor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(150.0f) );
  notification2.NotifySignal().Connect( &TestCallback2 );
  Animation animation = Animation::New( 0.032f ); // finishes in 32 ms
  animation.AnimateTo( Property(actor, Actor::Property::POSITION ), Vector3( 200.0f, 0.0f, 0.0f ), AlphaFunction::LINEAR );
  animation.Play();

  // flush the queue
  application.SendNotification();
  // first frame
  application.Render(RENDER_FRAME_INTERVAL);
  // no notifications yet
  DALI_TEST_EQUALS( gCallBackCalled, false, TEST_LOCATION );
  DALI_TEST_EQUALS( gCallBack2Called, false, TEST_LOCATION );
  gCallBackCalled = false;
  gCallBack2Called = false;

  // dont serve the notifications but run another update & render
  // this simulates situation where there is a notification in event side but it's not been picked up by event thread
  // second frame
  application.Render(RENDER_FRAME_INTERVAL);
  DALI_TEST_EQUALS( gCallBackCalled, false, TEST_LOCATION );
  DALI_TEST_EQUALS( gCallBack2Called, false, TEST_LOCATION );

  // serve the notifications
  application.SendNotification();
  DALI_TEST_EQUALS( gCallBackCalled, true, TEST_LOCATION );
  DALI_TEST_EQUALS( gCallBack2Called, true, TEST_LOCATION );

  gCallBackCalled = false;
  gCallBack2Called = false;
  application.Render(RENDER_FRAME_INTERVAL);
  application.SendNotification();
  DALI_TEST_EQUALS( gCallBackCalled, false, TEST_LOCATION );
  DALI_TEST_EQUALS( gCallBack2Called, false, TEST_LOCATION );

  END_TEST;
}
开发者ID:tizenorg,项目名称:platform.core.uifw.dali-core,代码行数:47,代码来源:utc-Dali-PropertyNotification.cpp

示例11: UtcDaliBubbleEmitterEmitBubble

int UtcDaliBubbleEmitterEmitBubble(void)
{
  ToolkitTestApplication application;
  tet_infoline( " UtcDaliBubbleEmitterEmitBubble " );

  Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));

  Actor root = emitter.GetRootActor();
  Actor bubbleMesh = root.GetChildAt( 0 );
  Stage::GetCurrent().Add( root );
  DALI_TEST_CHECK( bubbleMesh );

  Property::Index propertyIndex0 = bubbleMesh.GetPropertyIndex( "uPercentage[0]" );
  Property::Index propertyIndex1 = bubbleMesh.GetPropertyIndex( "uPercentage[1]" );
  float value0, value1;

  Animation animation = Animation::New( 0.5f );
  emitter.EmitBubble( animation, Vector2(40.f,40.f), Vector2(-5.f,-5.f), Vector2(30.f,30.f) );
  emitter.EmitBubble( animation, Vector2(10.f,10.f), Vector2(5.f,5.f), Vector2(30.f,30.f) );
  (bubbleMesh.GetProperty(propertyIndex0)).Get( value0 );
  (bubbleMesh.GetProperty(propertyIndex1)).Get( value1 );
  DALI_TEST_EQUALS(value0, 0.f, TEST_LOCATION );
  DALI_TEST_EQUALS(value1, 0.f, TEST_LOCATION );

  animation.Play();

  Wait(application, 300);
  propertyIndex0 = bubbleMesh.GetPropertyIndex( "uPercentage[0]" );
  propertyIndex1 = bubbleMesh.GetPropertyIndex( "uPercentage[1]" );
  (bubbleMesh.GetProperty(propertyIndex0)).Get( value0 );
  (bubbleMesh.GetProperty(propertyIndex1)).Get( value1 );
  DALI_TEST_CHECK( value0 >= 0.6f );
  DALI_TEST_CHECK( value1 >= 0.6f );

  Wait(application,500);
  (bubbleMesh.GetProperty(propertyIndex0)).Get( value0 );
  (bubbleMesh.GetProperty(propertyIndex1)).Get( value1 );
  DALI_TEST_EQUALS(value0, 1.f, TEST_LOCATION );
  DALI_TEST_EQUALS(value1, 1.f, TEST_LOCATION );
  END_TEST;
}
开发者ID:mettalla,项目名称:dali,代码行数:42,代码来源:utc-Dali-BubbleEmitter.cpp

示例12: Create

  // The Init signal is received once (only) during the Application lifetime
  void Create( Application& application )
  {
    //std::cout << "HelloWorldController::Create" << std::endl;

    // Get a handle to the stage
    Stage stage = Stage::GetCurrent();

    //ImageActor bgActor = ImageActor::New(CreateBitmapImage(480, 800));
    Control  bgActor = Control::New();
    bgActor.SetSize(64 * STAGE_COL, 64 * STAGE_ROW);
    //bgActor.SetBackgroundColor(Vector4(.125f, .125f, .125f, 1.f));
    bgActor.SetBackgroundColor(Vector4(1.f, 1.f, 1.f, 1.f));
    bgActor.SetParentOrigin(ParentOrigin::CENTER);
    bgActor.SetAnchorPoint(AnchorPoint::CENTER);
    bgActor.SetZ(0.1f);
    //stage.Add(bgActor);

    ResourceImage spriteImage = ResourceImage::New(PUYO_IMAGE);

    // background
    {
      ResourceImage image = ResourceImage::New(BACKGROUND_IMAGE);
      ImageActor actor = ImageActor::New(image);
      actor.SetParentOrigin(ParentOrigin::BOTTOM_LEFT);
      actor.SetAnchorPoint(AnchorPoint::BOTTOM_LEFT);
      stage.Add(actor);
    }

    // sprites
    {
      ImageActor actor[STAGE_COL * STAGE_ROW];

      for (int i = 0; i < STAGE_ROW; i++)
      {
        for (int j = 0; j < STAGE_COL; j++)
        {
          actor[i * STAGE_COL + j] = ImageActor::New(spriteImage, PUYO_OFFSET[int(Random::Range(0.f, NUM_PUYO))]);
          actor[i * STAGE_COL + j].SetParentOrigin(ParentOrigin::BOTTOM_LEFT);
          actor[i * STAGE_COL + j].SetAnchorPoint(AnchorPoint::BOTTOM_LEFT);
          actor[i * STAGE_COL + j].SetX(i * 60.f);
          actor[i * STAGE_COL + j].SetY(j * -1.f * 60.f);
          actor[i * STAGE_COL + j].SetZ(0.1f);
          stage.Add(actor[i * STAGE_COL + j]);
        }
      }

#if 0
      Animation anim = Animation::New(1.f);

      for (int i = 0; i < STAGE_ROW; i++)
      {
        for (int j = 0; j < STAGE_COL; j++)
        {
          anim.MoveBy(actor[i * STAGE_COL + j], Vector3(0.f, j * _(7), 0.1f), AlphaFunctions::Bounce);
          anim.Resize(actor[i * STAGE_COL + j], _(32), _(25), AlphaFunctions::Bounce);
          anim.SetLooping(true);
        }
      }
      anim.Play();
#endif
    }

    {
      ImageActor actor = ImageActor::New(spriteImage, ImageActor::PixelArea(0, 224, 64, 64));
      actor.SetParentOrigin(ParentOrigin::CENTER);
      actor.SetAnchorPoint(AnchorPoint::CENTER);
      actor.SetSize(_(32), _(32));
      actor.SetZ(0.1f);
      //stage.Add(actor);
    }

    // Respond to a click anywhere on the stage
    stage.GetRootLayer().TouchedSignal().Connect( this, &HelloWorldController::OnTouch );
  }
开发者ID:jonghyunho,项目名称:puyo,代码行数:75,代码来源:puyo.cpp

示例13: Entity

void Stage_Stage3::Init()
{
	stageOverTimer = 0;
	boatTimer = 0;
	stageClearTimer = 0;
	bulletCount = 0;
	GameStateManager::GetSingleton().Init();
	Entity *newEntity;

#pragma region Texture
	TextureManager& tm = TextureManager::GetSingleton();
	tm.Add(T_BACKGROUND_1);
	tm.Add(T_BACKGROUND_2);
	tm.Add(T_BACKGROUND_3);
	tm.Add(T_BACKGROUND_4);
	tm.Add(T_BACKGROUND_5);
	tm.Add(T_ENEMY_1);
	tm.Add(T_ENEMY_2);
	tm.Add(T_ENEMY_3);
	tm.Add(T_ENEMY_BOAT);
	tm.Add(T_ENEMY_BOSS);
	tm.Add(T_EXPLOSION);
	tm.Add(T_EXPLOSION_BIG);
	tm.Add(T_PLAYER);
	tm.Add(T_PLAYER_BOAT);
	tm.Add(T_PLAYER_ADDON);
	tm.Add(T_BULLET);
	tm.Add(T_BOAT_BULLET);
	tm.Add(T_BULLET_2);
	tm.Add(T_BULLET2_EXPLOSION);
	tm.Add(T_BULLET_SHELL);
	tm.Add(T_BULLET_EXPLOSION);
	tm.Add(T_UI_BACKGROUND_1);
	tm.Add(T_UI_BACKGROUND_2);
	tm.Add(T_UI_BAR_HEALTH);
	tm.Add(T_UI_BAR_EXP);
	tm.Add(T_UI_SHOP_POWER);
	tm.Add(T_UI_SHOP_MORESPEED);
	tm.Add(T_UI_SHOP_SPEED);
	tm.Add(T_UI_SHOP_ADDON);
	tm.Add(T_UI_SHOP_WEAPON);
	tm.Add(T_UI_BAR_BOSS);
	tm.Add(T_UI_GAMEOVER);
	tm.Add(T_UI_BAR_BOSS_BG);
	tm.Add(T_UI_BAR_BOSS_BG_BLACK);
	tm.Add(T_UI_CLEAR);
	tm.Add(T_DOKDO);
	tm.Add(T_HP);
	tm.Init();
#pragma endregion Texture
#pragma region Background
	newEntity = new Entity(T_BACKGROUND_1, 800, 600);
	newEntity->SetPos(0, 0);
	entities.push_back(newEntity);

	newEntity = new Entity(T_DOKDO, 454, 209);
	newEntity->SetPos(200, 300);
	newEntity->Params["Name"] = "Dokdo";
	newEntity->SetSpeed(-30, 0, 0, 0);
	entities.push_back(newEntity);

	newEntity = new Entity(T_BACKGROUND_2, 1600, 600);
	newEntity->SetPos(0, 0);
	newEntity->Params["Type"] = "ScrollingBackground";
	newEntity->SetSpeed(-150, 0, 0, 0);
	entities.push_back(newEntity);

	newEntity = new Entity(T_BACKGROUND_3, 1600, 600);
	newEntity->SetPos(0, 0);
	newEntity->Params["Type"] = "ScrollingBackground";
	newEntity->SetSpeed(-200, 0, 0, 0);
	entities.push_back(newEntity);

	newEntity = new Entity(T_BACKGROUND_4, 1600, 600);
	newEntity->SetPos(0, 0);
	newEntity->Params["Type"] = "ScrollingBackground";
	newEntity->SetSpeed(-250, 0, 0, 0);
	entities.push_back(newEntity);

	newEntity = new Entity(T_BACKGROUND_5, 1600, 600);
	newEntity->SetPos(0, 0);
	newEntity->Params["Type"] = "ScrollingBackground";
	newEntity->SetSpeed(-300, 0, 0, 0);
	entities.push_back(newEntity);
#pragma endregion Background
#pragma region Player
	AddNewPlayer();
	AddNewPlayerBoat();

	Animation *newAddon = new Animation(T_PLAYER_ADDON, 150, 17, 1, 6);
	newAddon->Params["Type"] = "PlayerAddon";
	newAddon->Params["Name"] = "AddonUpper";
	newAddon->Play(30.0f, true);
	entities.push_back(newAddon);

	newAddon = new Animation(T_PLAYER_ADDON, 150, 17, 1, 6);
	newAddon->Params["Type"] = "PlayerAddon";
	newAddon->Params["Name"] = "AddonLower";
	newAddon->Play(30.0f, true);
	entities.push_back(newAddon);
//.........这里部分代码省略.........
开发者ID:iAmGhost,项目名称:Dokdo_Pasta,代码行数:101,代码来源:Stage_Stage3.cpp

示例14: UtcDaliModelBuildAnimation01

int UtcDaliModelBuildAnimation01(void)
{
  TestApplication application;
  TestPlatformAbstraction& platform = application.GetPlatform();

  tet_infoline("Testing Dali::MeshActor::New()");

  Dali::ModelData modelData = BuildTreeModel();

  // Raise a request
  Model model = Model::New("Tree");

  application.SendNotification();
  application.Render();
  Integration::ResourceRequest* request = platform.GetRequest(); // Return modelData
  if(request)
  {
    platform.SetResourceLoaded(request->GetId(), request->GetType()->id, Integration::ResourcePointer(&(modelData.GetBaseObject())));
  }
  application.Render();
  application.SendNotification();

  Actor actor = ModelActorFactory::BuildActorTree(model, ""); // model should be loaded
  Stage::GetCurrent().Add(actor);

  DALI_TEST_CHECK(model.GetLoadingState() == ResourceLoadingSucceeded);
  DALI_TEST_CHECK(actor);
  DALI_TEST_CHECK(actor.GetName().compare("root") == 0);

  DALI_TEST_EQUALS(model.NumberOfAnimations(), static_cast<size_t>(1), TEST_LOCATION);
  unsigned int animIndex=0;
  bool found = model.FindAnimation("Anim1", animIndex);
  DALI_TEST_CHECK(found);

  Animation twigAnim = ModelActorFactory::BuildAnimation(model, actor, animIndex);
  DALI_TEST_CHECK(twigAnim);
  DALI_TEST_EQUALS(twigAnim.GetDuration(), 10.0f, 0.001, TEST_LOCATION);
  DALI_TEST_CHECK(twigAnim.GetDefaultAlphaFunction() == Dali::AlphaFunctions::Linear);

  Actor twigActor = actor.FindChildByName("twig");
  DALI_TEST_CHECK(twigActor);

  // Start the animation
  twigAnim.Play();

  float durationSeconds = 10.0f;

  bool signalReceived(false);
  AnimationFinishCheck finishCheck(signalReceived);
  twigAnim.FinishedSignal().Connect(&application, finishCheck);
  application.SendNotification();
  application.Render();
  finishCheck.CheckSignalNotReceived();
  DALI_TEST_EQUALS( twigActor.GetCurrentPosition(), Vector3(2.0f, 1.0f, 0.0f), 0.01f, TEST_LOCATION );

  application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
  application.SendNotification();
  DALI_TEST_EQUALS( twigActor.GetCurrentPosition(), Vector3(2.5f, 1.0f, 2.5f), 0.01f, TEST_LOCATION );

  application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 75% progress */);
  application.SendNotification();
  DALI_TEST_EQUALS( twigActor.GetCurrentPosition(), Vector3(3.5f, 1.0f, 7.5f), 0.01f, TEST_LOCATION );

  application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* Past Finished */);
  application.SendNotification();
  DALI_TEST_EQUALS( twigActor.GetCurrentPosition(), Vector3(4.0f, 1.0f, 10.0f), 0.01f, TEST_LOCATION );

  finishCheck.CheckSignalReceived();
  END_TEST;
}
开发者ID:Tarnyko,项目名称:dali-core,代码行数:70,代码来源:utc-Dali-Model.cpp


注:本文中的Animation::Play方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。