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;
}
コード例 #2
0
 /**
  * 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);
 }
コード例 #3
0
 /**
  * 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;
   }
 }
コード例 #4
0
 /**
  * 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;
   }
 }
コード例 #5
0
ファイル: bubble-emitter-impl.cpp プロジェクト: mettalla/dali
void BubbleEmitter::EmitBubble( Animation& animation, const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement )
{
  unsigned int curUniform = mCurrentBubble  % mNumBubblePerActor;
  unsigned int groupIdx = mCurrentBubble / mNumBubblePerActor;
  SetBubbleParameter( mBubbleActors[groupIdx], curUniform, emitPosition, direction, displacement);
  animation.AnimateTo( (mBubbleActors[groupIdx])->GetPercentageProperty(curUniform),
                       1.f, AlphaFunction::LINEAR );

  mCurrentBubble = (mCurrentBubble + 1) % mTotalNumOfBubble;
}
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;
}
コード例 #7
0
ファイル: utc-Dali-BaseHandle.cpp プロジェクト: mettalla/dali
int UtcDaliBaseHandleDoAction(void)
{
  TestApplication application;
  tet_infoline("Positive Test Dali::BaseHandle::UtcDaliBaseHandleDoAction");

  Actor actor = Actor::New();
  BaseHandle actorObject = actor;

  DALI_TEST_CHECK(actorObject);

  // Check that an invalid command is not performed
  Property::Map attributes;
  DALI_TEST_CHECK(actorObject.DoAction("invalidCommand", attributes) == false);

  // Check that the actor is visible
  actor.SetVisible(true);
  DALI_TEST_CHECK(actor.IsVisible() == true);

  // Check the actor performed an action to hide itself
  DALI_TEST_CHECK(actorObject.DoAction("hide", attributes) == true);

  // flush the queue and render once
  application.SendNotification();
  application.Render();

  // Check that the actor is now invisible
  DALI_TEST_CHECK(actor.IsVisible() == false);

  // Check the actor performed an action to show itself
  DALI_TEST_CHECK(actorObject.DoAction("show", attributes) == true);

  // flush the queue and render once
  application.SendNotification();
  application.Render();

  // Check that the actor is now visible
  DALI_TEST_CHECK(actor.IsVisible() == true);

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

  // Build an animation with initial duration of 1 second
  float durationSeconds(1.0f);
  Animation animation = Animation::New(durationSeconds);
  BaseHandle animationObject = animation;

  DALI_TEST_CHECK(animationObject);

  // Check the current animation duration is 1 second
  DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);

  Vector3 targetPosition(100.0f, 100.0f, 100.0f);
  animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);

  // Set the new duration to be 2 seconds
  float newDurationSeconds(2.0f);
  Property::Value newDurationSecondsValue = Property::Value( newDurationSeconds );
  attributes["duration"] = newDurationSecondsValue;

  // Check the animation performed an action to play itself with the specified duration of 2 seconds
  animationObject.DoAction("play", attributes);

  bool signalReceived(false);
  AnimationFinishCheck finishCheck(signalReceived);
  animation.FinishedSignal().Connect(&application, finishCheck);

  application.SendNotification();
  application.Render(static_cast<unsigned int>(newDurationSeconds * 1000.0f) + 1u/*just beyond the animation duration*/);

  // We expect the animation to finish
  application.SendNotification();
  finishCheck.CheckSignalReceived();
  DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );

  // Check the new animation duration is 2 seconds
  DALI_TEST_EQUALS(animation.GetDuration(), newDurationSeconds, TEST_LOCATION);
  END_TEST;
}