• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ clutter_timeline_start函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中clutter_timeline_start函数的典型用法代码示例。如果您正苦于以下问题:C++ clutter_timeline_start函数的具体用法?C++ clutter_timeline_start怎么用?C++ clutter_timeline_start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: im_spinning_around

static gboolean
im_spinning_around (ClutterTimeline *time)
{
    if (!clutter_timeline_is_playing (timeline))
        clutter_timeline_start (timeline);
    return TRUE;
}
开发者ID:rezafaramarzi,项目名称:toys,代码行数:7,代码来源:main.c


示例2: foreach_running_timeline

static void
foreach_running_timeline (gpointer key,
                          gpointer value,
                          gpointer user_data)
{
  ClutterScoreEntry *entry = value;
  gint action = GPOINTER_TO_INT (user_data);

  switch (action)
    {
    case ACTION_START:
      clutter_timeline_start (entry->timeline);
      break;

    case ACTION_PAUSE:
      clutter_timeline_pause (entry->timeline);
      break;

    case ACTION_STOP:
      if (entry->complete_id)
	{
	  g_signal_handler_disconnect (entry->timeline, entry->complete_id);
	  entry->complete_id = 0;
	}
      clutter_timeline_stop (entry->timeline);
      break;
    }
}
开发者ID:gramozeka,项目名称:GSB-NEW,代码行数:28,代码来源:clutter-score.c


示例3: main

int
main (int argc, char *argv[])
{
  ClutterActor *stage;
  ClutterActor *coglbox;
  ClutterTimeline *tl;

  clutter_init(&argc, &argv);

  tl = clutter_timeline_new (G_N_ELEMENTS (paint_func) * 1000);
  clutter_timeline_set_loop (tl, TRUE);
  clutter_timeline_start (tl);

  stage = clutter_stage_get_default ();
  clutter_actor_set_size (stage, 400, 400);
  clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test");

  coglbox = clutter_group_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox);
  g_signal_connect (coglbox, "paint", G_CALLBACK (paint_cb), tl);
  /* Redraw every frame of the timeline */
  g_signal_connect_swapped (tl, "new-frame",
                            G_CALLBACK (clutter_actor_queue_redraw), coglbox);

  clutter_actor_set_rotation (coglbox, CLUTTER_Y_AXIS, -30, 200, 0, 0);
  clutter_actor_set_position (coglbox, 0, 100);

  clutter_actor_show (stage);

  clutter_main ();

  g_object_unref (tl);

  return 0;
}
开发者ID:aalex,项目名称:tempi,代码行数:35,代码来源:proto.c


示例4: gb_player_show_controls

gboolean
gb_player_show_controls (GbPlayer *self)
{
	ClutterEffectTemplate *effect_template;
	gint x, y;
	ClutterKnot t_knot[2];
	ClutterKnot b_knot[2];
	ClutterKnot c_knot[2];
	if ((!self->priv->playing) || (clutter_timeline_is_playing (self->priv->show_hide_timeline)))
		return FALSE;
	
	clutter_timeline_start(self->priv->show_hide_timeline);
	effect_template = clutter_effect_template_new (self->priv->show_hide_timeline, &on_alpha);
	clutter_actor_get_position (self->priv->title_group, &x, &y);
	t_knot[0].x = x;
	t_knot[0].y = y;
	t_knot[1].x= -20;
	t_knot[1].y= 20;
	clutter_actor_get_position (self->priv->window_buttons_group, &x, &y);
	b_knot[0].x = x;
	b_knot[0].y = y;
	b_knot[1].x=  640 - 200;
	b_knot[1].y=  20;
	clutter_actor_get_position (self->priv->window_buttons_group, &x, &y);
	c_knot[0].x = x;
	c_knot[0].y = y;
	c_knot[1].x=  ((640 / 2) - (400 / 2));
	c_knot[1].y=  480 - 70 - 30;
 
	clutter_effect_fade (effect_template, self->priv->title_group, 0xff, NULL, NULL);
	clutter_effect_fade (effect_template, self->priv->window_buttons_group, 0xff, NULL, NULL);
	clutter_effect_fade (effect_template, self->priv->controls_group, 0xff, NULL, NULL);
	g_object_unref (effect_template);
	return FALSE;
}
开发者ID:gabrielfalcao,项目名称:happy-time,代码行数:35,代码来源:gb-player.c


示例5: on_key_press_event

static void
on_key_press_event (ClutterStage    *stage,
                    ClutterKeyEvent *event,
                    gpointer         user_data)
{
  TestThreadData *data;

  switch (clutter_key_event_symbol (event))
    {
    case CLUTTER_s:
      clutter_label_set_text (CLUTTER_LABEL (help_label), "Press 'q' to quit");

      clutter_timeline_start (timeline);
      
      data = test_thread_data_new ();
      data->stage = g_object_ref (stage);
      data->label = g_object_ref (count_label);
      data->progress = g_object_ref (progress_rect);
      data->timeline = g_object_ref (timeline);
      g_thread_create (test_thread_func, data, FALSE, NULL);
      break;
    case CLUTTER_q:
      clutter_main_quit ();
      break;
    }
}
开发者ID:archlinuxarm-n900,项目名称:clutter08,代码行数:26,代码来源:test-threads.c


示例6: st_theme_node_transition_new

StThemeNodeTransition *
st_theme_node_transition_new (StThemeNode *from_node,
                              StThemeNode *to_node,
                              guint        duration)
{
  StThemeNodeTransition *transition;

  g_return_val_if_fail (ST_IS_THEME_NODE (from_node), NULL);
  g_return_val_if_fail (ST_IS_THEME_NODE (to_node), NULL);

  duration = st_theme_node_get_transition_duration (to_node);

  transition = g_object_new (ST_TYPE_THEME_NODE_TRANSITION,
                             NULL);

  transition->priv->old_theme_node = g_object_ref (from_node);
  transition->priv->new_theme_node = g_object_ref (to_node);

  transition->priv->timeline = clutter_timeline_new (duration);

  transition->priv->timeline_completed_id =
    g_signal_connect (transition->priv->timeline, "completed",
                      G_CALLBACK (on_timeline_completed), transition);
  transition->priv->timeline_new_frame_id =
    g_signal_connect (transition->priv->timeline, "new-frame",
                      G_CALLBACK (on_timeline_new_frame), transition);

  clutter_timeline_set_progress_mode (transition->priv->timeline, CLUTTER_EASE_IN_OUT_QUAD);

  clutter_timeline_start (transition->priv->timeline);

  return transition;
}
开发者ID:cosimoc,项目名称:gnome-shell,代码行数:33,代码来源:st-theme-node-transition.c


示例7: mx_expander_update

static void
mx_expander_update (MxExpander *expander)
{
  MxExpanderPrivate *priv = expander->priv;

  if (priv->expanded)
    {
      clutter_actor_set_name (priv->arrow, "mx-expander-arrow-open");
      mx_stylable_set_style_class (MX_STYLABLE (expander), "open-expander");
    }
  /* closed state is set when animation is finished */

  if (!priv->child)
    return;

  /* setup and start the expansion animation */
  if (!priv->expanded)
    {
      clutter_actor_hide (priv->child);
      clutter_timeline_set_direction (priv->timeline,
                                      CLUTTER_TIMELINE_BACKWARD);
    }
  else
    {
      clutter_timeline_set_direction (priv->timeline,
                                      CLUTTER_TIMELINE_FORWARD);
    }


  if (!clutter_timeline_is_playing (priv->timeline))
    clutter_timeline_rewind (priv->timeline);

  clutter_timeline_start (priv->timeline);
}
开发者ID:3v1n0,项目名称:mx,代码行数:34,代码来源:mx-expander.c


示例8: main

int
main(int argc, char **argv)
{
  TestState state;

  clutter_init(&argc, &argv);
  
  state.timeline = 
    clutter_timeline_new (TEST_TIMELINE_FRAME_COUNT,
                          TEST_TIMELINE_FPS);
  clutter_timeline_set_loop (state.timeline, TRUE);
  g_signal_connect (G_OBJECT(state.timeline),
                    "new-frame",
                    G_CALLBACK(new_frame_cb),
                    &state);
  g_signal_connect (G_OBJECT(state.timeline),
                    "completed",
                    G_CALLBACK(completed_cb),
                    &state);

  state.prev_frame = -1;
  state.completion_count = 0;
  state.passed = TRUE;

  clutter_timeline_start (state.timeline);
  
  clutter_main();
  
  return EXIT_FAILURE;
}
开发者ID:archlinuxarm-n900,项目名称:clutter08,代码行数:30,代码来源:test-timeline-dup-frames.c


示例9: stepper_move_on

static void
stepper_move_on (StScrollBarPrivate *priv,
                 gint                mode)
{
  ClutterAnimation *a;
  ClutterTimeline *t;
  GValue v = { 0, };
  double value, inc;

  a = g_object_new (CLUTTER_TYPE_ANIMATION,
                    "object", priv->adjustment,
                    "duration", (guint)(PAGING_SUBSEQUENT_REPEAT_TIMEOUT * st_slow_down_factor),
                    "mode", mode,
                    NULL);

  g_signal_connect (a, "completed", G_CALLBACK (stepper_animation_completed_cb),
                    NULL);

  g_object_get (priv->adjustment,
                "step-increment", &inc,
                "value", &value,
                NULL);

  if (priv->stepper_forward)
    value = value + inc;
  else
    value = value - inc;

  g_value_init (&v, G_TYPE_DOUBLE);
  g_value_set_double (&v, value);
  clutter_animation_bind (a, "value", &v);

  t = clutter_animation_get_timeline (a);
  clutter_timeline_start (t);
}
开发者ID:Jem777,项目名称:Cinnamon,代码行数:35,代码来源:st-scroll-bar.c


示例10: start_entry

static void
start_entry (ClutterScoreEntry *entry)
{
  ClutterScorePrivate *priv = entry->score->priv;

  /* timelines attached to a marker might already be playing when we
   * end up here from the ::completed handler, so we need to perform
   * this check to avoid restarting those timelines
   */
  if (clutter_timeline_is_playing (entry->timeline))
    return;

  entry->complete_id = g_signal_connect (entry->timeline,
                                         "completed",
                                         G_CALLBACK (on_timeline_completed),
                                         entry);

  CLUTTER_NOTE (SCHEDULER, "timeline [%p] ('%lu') started",
                entry->timeline,
                entry->id);

  if (G_UNLIKELY (priv->running_timelines == NULL))
    priv->running_timelines = g_hash_table_new (NULL, NULL);

  g_hash_table_insert (priv->running_timelines,
                       GUINT_TO_POINTER (entry->id),
                       entry);

  clutter_timeline_start (entry->timeline);

  g_signal_emit (entry->score, score_signals[TIMELINE_STARTED], 0,
                 entry->timeline);
}
开发者ID:gramozeka,项目名称:GSB-NEW,代码行数:33,代码来源:clutter-score.c


示例11: show_helper_text_title

static void
show_helper_text_title (CalibArea *area)
{
  ClutterTransition *transition;

  gfloat height = clutter_actor_get_height (area->helper_text_title);
  clutter_actor_set_y (area->helper_text_title,
                       - clutter_actor_get_height (area->helper_text_title));
  clutter_actor_show (area->helper_text_title);

  transition = clutter_property_transition_new ("y");
  clutter_timeline_set_progress_mode (CLUTTER_TIMELINE (transition),
                                      CLUTTER_EASE_OUT);
  clutter_timeline_set_duration (CLUTTER_TIMELINE (transition),
                                 HELP_TEXT_ANIMATION_DURATION);
  clutter_transition_set_animatable (transition,
                                     CLUTTER_ANIMATABLE (area->helper_text_title));
  clutter_transition_set_from (transition, G_TYPE_FLOAT, -height);
  clutter_transition_set_to (transition, G_TYPE_FLOAT, 0.0);

  g_signal_connect (CLUTTER_TIMELINE (transition),
                    "completed",
                    G_CALLBACK (on_helper_text_title_shown),
                    area);

  clutter_timeline_start (CLUTTER_TIMELINE (transition));

  g_clear_object (&area->helper_msg_timeline);
  area->helper_msg_timeline = transition;
}
开发者ID:Amphiboly,项目名称:gnome-control-center,代码行数:30,代码来源:calibrator-gui.c


示例12: test_timeline_interpolate

void
test_timeline_interpolate (TestConformSimpleFixture *fixture, 
			   gconstpointer data)
{
  TestState state;

  state.timeline = 
    clutter_timeline_new (TEST_TIMELINE_DURATION);
  clutter_timeline_set_loop (state.timeline, TRUE);
  g_signal_connect (G_OBJECT(state.timeline),
		    "new-frame",
		    G_CALLBACK(new_frame_cb),
		    &state);
  g_signal_connect (G_OBJECT(state.timeline),
		    "completed",
		    G_CALLBACK(completed_cb),
		    &state);

  state.completion_count = 0;
  state.new_frame_counter = 0;
  state.passed = TRUE;
  state.expected_frame = 0;

  g_get_current_time (&state.start_time);
  clutter_timeline_start (state.timeline);
  
  clutter_main();

  g_object_unref (state.timeline);
}
开发者ID:Docworld,项目名称:chromiumos,代码行数:30,代码来源:test-timeline-interpolate.c


示例13: mex_content_box_toggle_open

static void
mex_content_box_toggle_open (MexContentBox *box)
{
  MexContentBoxPrivate *priv = box->priv;
  gboolean close_notified, next_is_open;
  const gchar *mimetype;

  /* search history items should not appear in the "open" state */
  mimetype = mex_content_get_metadata (priv->content,
                                       MEX_CONTENT_METADATA_MIMETYPE);
  if (!g_strcmp0 (mimetype, "x-mex/search"))
    return;


  /* if the close animation was cancelled then no notify for the closed state
   * will have been sent, therefore notify for the opened state does not need
   * to be emitted */
  close_notified = (!priv->is_open
                    && !clutter_timeline_is_playing (priv->timeline));

  next_is_open = !priv->is_open;

  if (next_is_open)
    {
      /* opening */
      clutter_timeline_set_direction (priv->timeline,
                                      CLUTTER_TIMELINE_FORWARD);
      mx_stylable_set_style_class (MX_STYLABLE (box), "open");

      /* refresh the action list */
      mex_content_view_set_content (MEX_CONTENT_VIEW (priv->action_list),
                                    priv->content);

      priv->extras_visible = TRUE;
      if (close_notified)
        g_object_notify_by_pspec (G_OBJECT (box), properties[PROP_OPEN]);

      mex_push_focus (MX_FOCUSABLE (priv->action_list));
    }
  else
    {
      priv->is_closing = TRUE;

      /* closing */
      mex_push_focus (MX_FOCUSABLE (priv->tile));
      clutter_timeline_set_direction (priv->timeline,
                                      CLUTTER_TIMELINE_BACKWARD);

      priv->is_closing = FALSE;
      priv->extras_visible = TRUE;
    }

  if (!clutter_timeline_is_playing (priv->timeline))
    clutter_timeline_rewind (priv->timeline);

  clutter_timeline_start (priv->timeline);

  priv->is_open = next_is_open;
}
开发者ID:Cyrene,项目名称:media-explorer,代码行数:59,代码来源:mex-content-box.c


示例14: test_texture_quality_main

G_MODULE_EXPORT gint
test_texture_quality_main (int argc, char *argv[])
{
  ClutterTimeline  *timeline;
  ClutterAlpha     *alpha;
  ClutterBehaviour *depth_behavior;
  ClutterActor     *stage;
  ClutterActor     *image;
  ClutterColor      stage_color = { 0x12, 0x34, 0x56, 0xff };
  ClutterFog        stage_fog = { 10.0, -50.0 };
  GError           *error;

  clutter_init (&argc, &argv);

  stage = clutter_stage_get_default ();
  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
  clutter_stage_set_use_fog (CLUTTER_STAGE (stage), TRUE);
  clutter_stage_set_fog (CLUTTER_STAGE (stage), &stage_fog);

  g_signal_connect (stage,
                    "button-press-event", G_CALLBACK (clutter_main_quit),
                    NULL);

  error = NULL;
  image = clutter_texture_new_from_file (argv[1]?argv[1]:"redhand.png", &error);
  if (error)
    g_error ("Unable to load image: %s", error->message);

  if (!argv[1])
    g_print ("Hint: the redhand.png isn't a good test image for this test.\n"
             "This test can take any clutter loadable image as an argument\n");

  /* center the image */
  clutter_actor_set_position (image, 
    (clutter_actor_get_width (stage) - clutter_actor_get_width (image))/2,
    (clutter_actor_get_height (stage) - clutter_actor_get_height (image))/2);
  clutter_container_add (CLUTTER_CONTAINER (stage), image, NULL);

  timeline = clutter_timeline_new (5000);
  g_signal_connect (timeline,
                    "completed", G_CALLBACK (timeline_completed),
                    NULL);

  alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
  depth_behavior = clutter_behaviour_depth_new (alpha, -2500, 400);
  clutter_behaviour_apply (depth_behavior, image);

  clutter_actor_show (stage);
  clutter_timeline_start (timeline);

  g_timeout_add (10000, change_filter, image);

  clutter_main ();

  g_object_unref (depth_behavior);
  g_object_unref (timeline);

  return EXIT_SUCCESS;
}
开发者ID:Docworld,项目名称:chromiumos,代码行数:59,代码来源:test-texture-quality.c


示例15: test_viewport_main

G_MODULE_EXPORT int
test_viewport_main (int argc, char *argv[])
{
  ClutterTimeline  *timeline;
  ClutterAlpha     *alpha;
  ClutterBehaviour *r_behave;
  ClutterActor     *stage;
  ClutterActor     *hand;
  ClutterColor      stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
  gchar            *file;

  clutter_init (&argc, &argv);

  stage = clutter_stage_get_default ();

  clutter_stage_set_color (CLUTTER_STAGE (stage),
		           &stage_color);

  /* Make a hand */
  file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
  hand = clutter_texture_new_from_file (file, NULL);
  if (!hand)
    g_error("Unable to load image '%s'", file);

  g_free (file);

  clutter_actor_set_position (hand, 300, 200);
  clutter_actor_set_clip (hand, 20, 21, 132, 170);
  clutter_actor_set_anchor_point (hand, 86, 125);
  clutter_actor_show (hand);
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), hand);

  /* Make a timeline */
  timeline = clutter_timeline_new (7692);
  clutter_timeline_set_loop (timeline, TRUE);

  /* Set an alpha func to power behaviour */
  alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);

  /* Create a behaviour for that alpha */
  r_behave = clutter_behaviour_rotate_new (alpha,
					   CLUTTER_Z_AXIS,
					   CLUTTER_ROTATE_CW,
					   0.0, 360.0); 

  /* Apply it to our actor */
  clutter_behaviour_apply (r_behave, hand);

  /* start the timeline and thus the animations */
  clutter_timeline_start (timeline);

  clutter_actor_show_all (stage);

  clutter_main();

  g_object_unref (r_behave);

  return 0;
}
开发者ID:gramozeka,项目名称:GSB-NEW,代码行数:59,代码来源:test-viewport.c


示例16: timeline_completed

/* each time the timeline animating the label completes, swap the direction */
static void
timeline_completed (ClutterTimeline *timeline,
                    gpointer         user_data)
{
  clutter_timeline_set_direction (timeline,
                                  !clutter_timeline_get_direction (timeline));
  clutter_timeline_start (timeline);
}
开发者ID:Distrotech,项目名称:clutter,代码行数:9,代码来源:test-pixmap.c


示例17: main

int main(int argc, char *argv[]) {
    GstElement *pipeline, *sink;
    ClutterTimeline *timeline;
    ClutterActor *stage, *texture;

    /* clutter-gst takes care of initializing Clutter and GStreamer */
    if (clutter_gst_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) {
        g_error ("Failed to initialize clutter\n");
        return -1;
    }

    stage = clutter_stage_get_default ();

    /* Make a timeline */
    timeline = clutter_timeline_new (1000);
    g_object_set(timeline, "loop", TRUE, NULL);

    /* Create new texture and disable slicing so the video is properly mapped onto it */
    texture = CLUTTER_ACTOR (g_object_new (CLUTTER_TYPE_TEXTURE, "disable-slicing", TRUE, NULL));
    g_signal_connect (texture, "size-change", G_CALLBACK (size_change), NULL);

    /* Build the GStreamer pipeline */
    pipeline = gst_parse_launch ("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);

    /* Instantiate the Clutter sink */
    sink = gst_element_factory_make ("autocluttersink", NULL);
    if (sink == NULL) {
        /* Revert to the older cluttersink, in case autocluttersink was not found */
        sink = gst_element_factory_make ("cluttersink", NULL);
    }
    if (sink == NULL) {
        g_printerr ("Unable to find a Clutter sink.\n");
        return -1;
    }

    /* Link GStreamer with Clutter by passing the Clutter texture to the Clutter sink*/
    g_object_set (sink, "texture", texture, NULL);

    /* Add the Clutter sink to the pipeline */
    g_object_set (pipeline, "video-sink", sink, NULL);

    /* Start playing */
    gst_element_set_state (pipeline, GST_STATE_PLAYING);

    /* start the timeline */
    clutter_timeline_start (timeline);

    /* Add texture to the stage, and show it */
    clutter_group_add (CLUTTER_GROUP (stage), texture);
    clutter_actor_show_all (stage);

    clutter_main();

    /* Free resources */
    gst_element_set_state (pipeline, GST_STATE_NULL);
    gst_object_unref (pipeline);
    return 0;
}
开发者ID:huamulan,项目名称:gst-sdk-tutorial,代码行数:58,代码来源:basic-tutorial-15.c


示例18: mx_toggle_set_active

void
mx_toggle_set_active (MxToggle *toggle,
                      gboolean  active)
{
  MxTogglePrivate *priv;

  g_return_if_fail (MX_IS_TOGGLE (toggle));

  priv = toggle->priv;

  if (priv->active != active
      || (priv->position > 0 && priv->position < 1))
    {
      ClutterTimeline *timeline;

      priv->active = active;

      if (active)
        mx_stylable_set_style_pseudo_class (MX_STYLABLE (toggle), "checked");
      else
        mx_stylable_set_style_pseudo_class (MX_STYLABLE (toggle), NULL);

      g_object_notify (G_OBJECT (toggle), "active");


      /* don't run an animation if the actor is not mapped */
      if (!CLUTTER_ACTOR_IS_MAPPED (CLUTTER_ACTOR (toggle)))
        {
          priv->position = (active) ? 1 : 0;
          return;
        }

      timeline = clutter_alpha_get_timeline (priv->alpha);

      if (active)
        clutter_timeline_set_direction (timeline, CLUTTER_TIMELINE_FORWARD);
      else
        clutter_timeline_set_direction (timeline, CLUTTER_TIMELINE_BACKWARD);

      if (clutter_timeline_is_playing (timeline))
        return;

      clutter_timeline_rewind (timeline);

      if (priv->drag_offset > -1)
        {
          clutter_alpha_set_mode (priv->alpha, CLUTTER_LINEAR);
          clutter_timeline_advance (timeline, priv->position * 300);
        }
      else
        {
          clutter_alpha_set_mode (priv->alpha, CLUTTER_EASE_IN_OUT_CUBIC);
        }

      clutter_timeline_start (timeline);
    }
}
开发者ID:ManMower,项目名称:mx,代码行数:57,代码来源:mx-toggle.c


示例19: gesture_end

static void
gesture_end (ClutterGestureAction *gesture,
             ClutterActor         *actor)
{
  ClutterPanAction *self = CLUTTER_PAN_ACTION (gesture);
  ClutterPanActionPrivate *priv = self->priv;
  gfloat velocity, velocity_x, velocity_y;
  gfloat delta_x, delta_y;
  gfloat tau;
  gint duration;

  clutter_gesture_action_get_release_coords (CLUTTER_GESTURE_ACTION (self), 0, &priv->release_x, &priv->release_y);

  if (!priv->should_interpolate)
    {
      priv->state = PAN_STATE_INACTIVE;
      return;
    }

  priv->state = PAN_STATE_INTERPOLATING;

  clutter_gesture_action_get_motion_delta (gesture, 0, &delta_x, &delta_y);
  velocity = clutter_gesture_action_get_velocity (gesture, 0, &velocity_x, &velocity_y);

  /* Exponential timing constant v(t) = v(0) * exp(-t/tau)
   * tau = 1000ms / (frame_per_second * - ln(decay_per_frame))
   * with frame_per_second = 60 and decay_per_frame = 0.95, tau ~= 325ms
   * see http://ariya.ofilabs.com/2011/10/flick-list-with-its-momentum-scrolling-and-deceleration.html */
  tau = 1000.0f / (reference_fps * - logf (priv->deceleration_rate));

  /* See where the decreasing velocity reaches $min_velocity px/ms
   * v(t) = v(0) * exp(-t/tau) = min_velocity
   * t = - tau * ln( min_velocity / |v(0)|) */
  duration = - tau * logf (min_velocity / (ABS (velocity) * priv->acceleration_factor));

  /* Target point: x(t) = v(0) * tau * [1 - exp(-t/tau)] */
  priv->target_x = velocity_x * priv->acceleration_factor * tau * (1 - exp ((float)-duration / tau));
  priv->target_y = velocity_y * priv->acceleration_factor * tau * (1 - exp ((float)-duration / tau));

  if (ABS (velocity) * priv->acceleration_factor > min_velocity && duration > FLOAT_EPSILON)
    {
      priv->interpolated_x = priv->interpolated_y = 0.0f;
      priv->deceleration_timeline = clutter_timeline_new (duration);
      clutter_timeline_set_progress_mode (priv->deceleration_timeline, CLUTTER_EASE_OUT_EXPO);

      g_signal_connect (priv->deceleration_timeline, "new_frame",
                        G_CALLBACK (on_deceleration_new_frame), self);
      g_signal_connect (priv->deceleration_timeline, "stopped",
                        G_CALLBACK (on_deceleration_stopped), self);
      clutter_timeline_start (priv->deceleration_timeline);
    }
  else
    {
      emit_pan_stopped (self, actor);
    }
}
开发者ID:UIKit0,项目名称:clutter,代码行数:56,代码来源:clutter-pan-action.c


示例20: mnb_spinner_start

void
mnb_spinner_start (MnbSpinner *spinner)
{
  MnbSpinnerPrivate *priv = MNB_SPINNER (spinner)->priv;

  priv->frame = 0;

  if (priv->timeline)
    clutter_timeline_start (priv->timeline);
}
开发者ID:phmccarty,项目名称:dawati-shell,代码行数:10,代码来源:mnb-spinner.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ clvalue函数代码示例发布时间:2022-05-30
下一篇:
C++ clutter_stage_set_color函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap