Exemplo n.º 1
0
static void
layout_manager_real_end_animation (ClutterLayoutManager *manager)
{
    ClutterTimeline *timeline;
    ClutterAlpha *alpha;

    alpha = g_object_get_qdata (G_OBJECT (manager), quark_layout_alpha);
    if (alpha == NULL)
        return;

    timeline = clutter_alpha_get_timeline (alpha);
    g_assert (timeline != NULL);

    if (clutter_timeline_is_playing (timeline))
        clutter_timeline_stop (timeline);

    g_signal_handlers_disconnect_by_func (timeline,
                                          G_CALLBACK (clutter_layout_manager_end_animation),
                                          manager);
    g_signal_handlers_disconnect_by_func (timeline,
                                          G_CALLBACK (clutter_layout_manager_layout_changed),
                                          manager);

    g_object_set_qdata (G_OBJECT (manager), quark_layout_alpha, NULL);

    clutter_layout_manager_layout_changed (manager);
}
Exemplo n.º 2
0
/* An alpha function that goes from 0->1->0 along a sine. */
gdouble
label_opacity_alpha_func (ClutterAlpha *alpha,
                          gpointer unused)
{
  ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);
  return sin (clutter_timeline_get_progress (timeline) * M_PI);
}
Exemplo n.º 3
0
static gdouble
my_ramp_func (ClutterAlpha *alpha,
              gpointer      unused)
{
  ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);

  return clutter_timeline_get_progress (timeline);
}
Exemplo n.º 4
0
static gdouble
aisleriot_slot_sine_animation_mode (ClutterAlpha *alpha,
                                    gpointer data)
{
  ClutterTimeline *tl = clutter_alpha_get_timeline (alpha);

  return sin (clutter_timeline_get_progress (tl) * G_PI);
}
Exemplo n.º 5
0
gdouble
sine_alpha (ClutterAlpha *alpha,
            gpointer      dummy G_GNUC_UNUSED)
{
  ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);

  return sin (clutter_timeline_get_progress (timeline) * G_PI);
}
Exemplo n.º 6
0
static gdouble
my_sine_wave (ClutterAlpha *alpha,
              gpointer      dummy G_GNUC_UNUSED)
{
    ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);
    gdouble progress = clutter_timeline_get_progress (timeline);

    return sin (progress * G_PI);
}
Exemplo n.º 7
0
/* This must return a value between 0 and 1.0
 *
 * This will be called as many times per seconds as specified in our call to clutter_timeline_new().
 *
 */
gdouble
on_alpha (ClutterAlpha *alpha, gpointer data G_GNUC_UNUSED)
{
  /* Get the position in the timeline,
   *  so we can base our value upon it:
   */
  ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);
  return clutter_timeline_get_progress (timeline);
}
Exemplo n.º 8
0
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);
    }
}
Exemplo n.º 9
0
gdouble
double_ramp_alpha (ClutterAlpha *alpha,
                   gpointer      dummy G_GNUC_UNUSED)
{
  ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);
  gdouble progress = clutter_timeline_get_progress (timeline);

  if (progress >= 0.5)
    return 1.0 - progress;

  return progress;
}
Exemplo n.º 10
0
static ClutterAlpha *
layout_manager_real_begin_animation (ClutterLayoutManager *manager,
                                     guint                 duration,
                                     gulong                mode)
{
    ClutterTimeline *timeline;
    ClutterAlpha *alpha;

    alpha = g_object_get_qdata (G_OBJECT (manager), quark_layout_alpha);
    if (alpha != NULL)
    {
        clutter_alpha_set_mode (alpha, mode);

        timeline = clutter_alpha_get_timeline (alpha);
        clutter_timeline_set_duration (timeline, duration);
        clutter_timeline_rewind (timeline);

        return alpha;
    };

    timeline = clutter_timeline_new (duration);

    alpha = clutter_alpha_new_full (timeline, mode);

    /* let the alpha take ownership of the timeline */
    g_object_unref (timeline);

    g_signal_connect_swapped (timeline, "completed",
                              G_CALLBACK (clutter_layout_manager_end_animation),
                              manager);
    g_signal_connect_swapped (timeline, "new-frame",
                              G_CALLBACK (clutter_layout_manager_layout_changed),
                              manager);

    g_object_set_qdata_full (G_OBJECT (manager),
                             quark_layout_alpha, alpha,
                             (GDestroyNotify) g_object_unref);

    clutter_timeline_start (timeline);

    return alpha;
}