/**
 * champlain_tile_display_content:
 * @self: the #ChamplainTile
 *
 * Displays the tile's content.
 *
 * Since: 0.8
 */
void
champlain_tile_display_content (ChamplainTile *self)
{
  g_return_if_fail (CHAMPLAIN_TILE (self));

  ChamplainTilePrivate *priv = self->priv;
  ClutterAnimation *animation;

  if (!priv->content_actor || priv->content_displayed || !priv->content_group)
    return;

  clutter_container_add_actor (CLUTTER_CONTAINER (priv->content_group), priv->content_actor);
  g_object_unref (priv->content_actor);
  priv->content_displayed = TRUE;

  clutter_actor_set_opacity (CLUTTER_ACTOR (priv->content_actor), 0);
  if (priv->fade_in)
    {
      animation = clutter_actor_animate (CLUTTER_ACTOR (priv->content_actor),
            CLUTTER_EASE_IN_CUBIC,
            500,
            "opacity", 255,
            NULL);
    }
  else
    {
      animation = clutter_actor_animate (CLUTTER_ACTOR (priv->content_actor),
            CLUTTER_LINEAR,
            150,
            "opacity", 255,
            NULL);
    }

  g_signal_connect (animation, "completed", G_CALLBACK (fade_in_completed), self);
}
Esempio n. 2
0
static void
animate_end_game (void)
{
  int i;
  for (i = 0; i < properties->numworms; i++) {
    clutter_actor_animate (worms[i]->actors, CLUTTER_EASE_IN_QUAD, 500,
                           "opacity", 0,
                           "scale-x", 0.4, "scale-y", 0.4,
                           "fixed::scale-center-x",
                           (gfloat) worms[i]->xhead * properties->tilesize,
                           "fixed::scale-center-y",
                           (gfloat) worms[i]->yhead * properties->tilesize,
                           NULL);
  }

  for ( i = 0; i < boni->numbonuses; i++) {
    clutter_actor_animate (boni->bonuses[i]->actor, CLUTTER_EASE_IN_QUAD, 500,
                           "opacity", 0,
                           "scale-x", 0.4, "scale-y", 0.4,
                           "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
                           NULL);

  }

  g_signal_connect_after (
    clutter_actor_animate (board->level, CLUTTER_EASE_IN_QUAD, 700,
                           "scale-x", 0.4, "scale-y", 0.4,
                           "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
                           "opacity", 0,
                           NULL),
    "completed", G_CALLBACK (end_game_anim_cb), NULL);

}
Esempio n. 3
0
static void
mex_clock_bin_notify_focused_cb (MxFocusManager *manager,
                                 GParamSpec     *pspec,
                                 MexClockBin    *self)
{
  ClutterActor *parent = NULL;
  MexClockBinPrivate *priv = self->priv;
  ClutterActor *focused = (ClutterActor *)
    mx_focus_manager_get_focused (manager);

  while (focused)
    {
      parent = clutter_actor_get_parent (focused);
      if (focused == (ClutterActor *)self)
        {
          clutter_actor_animate (CLUTTER_ACTOR (priv->clock_hbox),
                                 CLUTTER_EASE_OUT_QUAD,
                                 150, "opacity", 0x00, NULL);
          return;
        }
      focused = parent;
    }

  clutter_actor_animate (CLUTTER_ACTOR (priv->clock_hbox),
                         CLUTTER_EASE_OUT_QUAD, 150,
                         "opacity", 0xff, NULL);
}
Esempio n. 4
0
static gboolean
mex_player_set_controls_visible (MexPlayer *player,
                                 gboolean   visible)
{
  MexPlayerPrivate *priv = player->priv;
  gfloat pos;
  ClutterStage *stage;
  MxFocusManager *fmanager;

  stage = (ClutterStage*) clutter_actor_get_stage (CLUTTER_ACTOR (player));
  fmanager = mx_focus_manager_get_for_stage (stage);

  pos = clutter_actor_get_height (priv->controls);
  if (visible)
    {
      priv->controls_prev_visible = FALSE;
      priv->controls_visible = TRUE;

      mx_widget_set_disabled (MX_WIDGET (priv->controls), FALSE);

      clutter_actor_animate (priv->controls, CLUTTER_EASE_IN_SINE, 250,
                             "opacity", 0xff,
                             "anchor-y", 0.0,
                             NULL);

      mex_player_restart_timer (player);

      if (priv->related_tile)
        {
          mx_focus_manager_push_focus_with_hint (fmanager,
                                                 MX_FOCUSABLE (priv->related_tile),
                                                 MX_FOCUS_HINT_PRIOR);

          g_object_unref (priv->related_tile);
          priv->related_tile = NULL;
        }
      else
        {
          mx_focus_manager_push_focus (fmanager, MX_FOCUSABLE (priv->controls));
        }
    }

  if (!visible)
    {
      priv->controls_visible = FALSE;
      clutter_actor_animate (priv->controls, CLUTTER_EASE_IN_SINE, 250,
                             "opacity", 0x00,
                             "anchor-y", -pos,
                             NULL);

      if (priv->hide_controls_source)
        {
          g_source_remove (priv->hide_controls_source);
          priv->hide_controls_source = 0;
        }
    }

  return TRUE;
}
Esempio n. 5
0
static void
expander_box_open_notify (MexExpanderBox *box,
                          GParamSpec     *pspec,
                          MexColumn      *column)
{
  MexColumnPrivate *priv = MEX_COLUMN (column)->priv;
  GList *l;
  MexShadow *shadow;
  ClutterColor shadow_color = { 0, 0, 0, 128 };

  if (mex_expander_box_get_open (box))
    {
      for (l = priv->children; l; l = l->next)
        {
          if (l->data != box)
            clutter_actor_animate (l->data, CLUTTER_EASE_IN_OUT_QUAD, 200,
                                   "opacity", 56, NULL);
        }
      clutter_actor_animate (priv->header, CLUTTER_EASE_IN_OUT_QUAD, 200,
                             "opacity", 56, NULL);

      /* Restore the opened box to full opacity */
      clutter_actor_animate (CLUTTER_ACTOR (box), CLUTTER_EASE_IN_OUT_QUAD, 200,
                             "opacity", 255, NULL);

      shadow = mex_shadow_new (CLUTTER_ACTOR (box));
      mex_shadow_set_paint_flags (shadow,
                                  MEX_TEXTURE_FRAME_TOP | MEX_TEXTURE_FRAME_BOTTOM);
      mex_shadow_set_radius_y (shadow, 25);
      mex_shadow_set_color (shadow, &shadow_color);

      g_object_set_qdata (G_OBJECT (box), _item_shadow_quark (), shadow);

      priv->open_boxes ++;
    }
  else
    {
      priv->open_boxes --;
    }

  if (priv->open_boxes == 0)
    {
      /* restore all children to full opacity */
      for (l = priv->children; l; l = l->next)
        {
          clutter_actor_animate (l->data, CLUTTER_EASE_IN_OUT_QUAD, 200,
                                 "opacity", 255, NULL);
        }
      clutter_actor_animate (priv->header, CLUTTER_EASE_IN_OUT_QUAD, 200,
                             "opacity", 255, NULL);

      shadow = g_object_get_qdata (G_OBJECT (box), _item_shadow_quark ());
      if (shadow)
        {
          g_object_unref (shadow);
          g_object_set_qdata (G_OBJECT (box), _item_shadow_quark (), NULL);
        }
    }
}
Esempio n. 6
0
void ease_welcome_actor_unfade (EaseWelcomeActor* self) {
#line 206 "ease-welcome-actor.vala"
	g_return_if_fail (self != NULL);
#line 208 "ease-welcome-actor.vala"
	self->priv->is_selected = TRUE;
#line 209 "ease-welcome-actor.vala"
	clutter_actor_animate ((ClutterActor*) self->priv->slide_actor, (gulong) EASE_WELCOME_ACTOR_FADE_EASE, (guint) EASE_WELCOME_ACTOR_FADE_TIME, "opacity", 255, NULL);
#line 210 "ease-welcome-actor.vala"
	clutter_actor_animate ((ClutterActor*) self->priv->hilight_rect, (gulong) EASE_WELCOME_ACTOR_FADE_EASE, (guint) EASE_WELCOME_ACTOR_FADE_TIME, "opacity", 255, NULL);
#line 349 "ease-welcome-actor.c"
}
Esempio n. 7
0
void ease_welcome_actor_fade (EaseWelcomeActor* self) {
#line 196 "ease-welcome-actor.vala"
	g_return_if_fail (self != NULL);
#line 198 "ease-welcome-actor.vala"
	self->priv->is_selected = FALSE;
#line 199 "ease-welcome-actor.vala"
	clutter_actor_animate ((ClutterActor*) self->priv->slide_actor, (gulong) EASE_WELCOME_ACTOR_FADE_EASE, (guint) EASE_WELCOME_ACTOR_FADE_TIME, "opacity", EASE_WELCOME_ACTOR_FADE_OPACITY, NULL);
#line 200 "ease-welcome-actor.vala"
	clutter_actor_animate ((ClutterActor*) self->priv->hilight_rect, (gulong) EASE_WELCOME_ACTOR_FADE_EASE, (guint) EASE_WELCOME_ACTOR_FADE_TIME, "opacity", 0, NULL);
#line 332 "ease-welcome-actor.c"
}
Esempio n. 8
0
static void
mex_column_remove (ClutterContainer *container,
                   ClutterActor     *actor)
{
  GList *link_;

  MexColumn *self = MEX_COLUMN (container);
  MexColumnPrivate *priv = self->priv;

  link_ = g_list_find (priv->children, actor);

  if (!link_)
    {
      g_warning (G_STRLOC ": Trying to remove an unknown child");
      return;
    }

  if (priv->current_focus == actor)
    {
      priv->current_focus = link_->next ? link_->next->data :
        (link_->prev ? link_->prev->data : NULL);
      priv->has_focus = FALSE;
    }

  /* Remove the old actor */
  g_object_ref (actor);

  clutter_actor_unparent (actor);
  priv->children = g_list_delete_link (priv->children, link_);
  priv->n_items --;

  /* children may not be at full opacity if the item removed was "open" */
  if (MEX_IS_EXPANDER_BOX (actor)
      && mex_expander_box_get_open (MEX_EXPANDER_BOX (actor)))
    {
      GList *l;

      for (l = priv->children; l; l = l->next)
        clutter_actor_animate (l->data, CLUTTER_EASE_IN_OUT_QUAD, 200,
                               "opacity", 255, NULL);

      clutter_actor_animate (priv->header, CLUTTER_EASE_IN_OUT_QUAD, 200,
                             "opacity", 255, NULL);
    }

  g_signal_emit_by_name (self, "actor-removed", actor);

  g_object_unref (actor);
}
Esempio n. 9
0
static void
content_box_open_notify (MexContentBox *box,
                         GParamSpec    *pspec,
                         MexColumn     *column)
{
  MexColumnPrivate *priv = MEX_COLUMN (column)->priv;
  GList *l;
  ClutterActorMeta *shadow;

  if (mex_content_box_get_open (box))
    {
      for (l = priv->children; l; l = l->next)
        {
          if (l->data != box)
            clutter_actor_animate (l->data, CLUTTER_EASE_IN_OUT_QUAD, 200,
                                   "opacity", 56, NULL);
        }

      shadow = (ClutterActorMeta*) clutter_actor_get_effect (CLUTTER_ACTOR (box),
                                                             "shadow");
      clutter_actor_meta_set_enabled (shadow, TRUE);

      /* Restore the opened box to full opacity */
      clutter_actor_animate (CLUTTER_ACTOR (box), CLUTTER_EASE_IN_OUT_QUAD, 200,
                             "opacity", 255, NULL);

      priv->open_boxes ++;
    }
  else
    {
      priv->open_boxes --;
    }

  if (priv->open_boxes == 0)
    {
      /* restore all children to full opacity */
      for (l = priv->children; l; l = l->next)
        {
          clutter_actor_animate (l->data, CLUTTER_EASE_IN_OUT_QUAD, 200,
                                 "opacity", 255, NULL);
        }
      shadow = (ClutterActorMeta*) clutter_actor_get_effect (CLUTTER_ACTOR (box),
                                                             "shadow");
      clutter_actor_meta_set_enabled (shadow, FALSE);
    }

  g_object_notify (G_OBJECT (column), "opened");
}
Esempio n. 10
0
File: mx-menu.c Progetto: jku/mx
static void
mx_menu_button_clicked_cb (ClutterActor *box,
                           MxAction     *action)
{
  MxMenu *menu;

  menu = MX_MENU (clutter_actor_get_parent (box));

  /* set the menu unreactive to prevent other items being hilighted */
  clutter_actor_set_reactive ((ClutterActor*) menu, FALSE);


  g_object_ref (menu);
  g_object_ref (action);

  g_signal_emit (menu, signals[ACTION_ACTIVATED], 0, action);
  g_signal_emit_by_name (action, "activated");

  clutter_actor_animate (CLUTTER_ACTOR (menu), CLUTTER_LINEAR, 250,
                         "opacity", (guchar) 0,
                         "signal-swapped::completed", clutter_actor_hide, menu,
                         NULL);

  g_object_unref (action);
  g_object_unref (menu);
}
Esempio n. 11
0
File: mx-menu.c Progetto: jku/mx
static gboolean
mx_menu_event (ClutterActor *actor,
               ClutterEvent *event)
{
  /* We swallow mouse events so that they don't fall through to whatever's
   * beneath us.
   */
  switch (event->type)
    {
    case CLUTTER_MOTION:
    case CLUTTER_BUTTON_PRESS:
    case CLUTTER_BUTTON_RELEASE:
    case CLUTTER_SCROLL:
      return TRUE;

    case CLUTTER_KEY_PRESS:
    case CLUTTER_KEY_RELEASE:
      /* hide the menu if the escape key was pressed */
      if (((ClutterKeyEvent*) event)->keyval == CLUTTER_KEY_Escape
          && CLUTTER_ACTOR_IS_VISIBLE (actor))
        {
          clutter_actor_set_reactive (actor, FALSE);
          clutter_actor_animate (actor, CLUTTER_LINEAR, 250,
                                 "opacity", (guchar) 0,
                                 "signal-swapped::completed",
                                 clutter_actor_hide,
                                 actor,
                                 NULL);
        }

    default:
      return FALSE;
    }
}
Esempio n. 12
0
/*
 * Simple TV-out like effect.
 */
static void
destroy (MetaPlugin *plugin, MetaWindowActor *window_actor)
{
  MetaWindowType type;
  ClutterActor *actor = CLUTTER_ACTOR (window_actor);
  MetaWindow *meta_window = meta_window_actor_get_meta_window (window_actor);

  type = meta_window_get_window_type (meta_window);

  if (type == META_WINDOW_NORMAL)
    {
      ClutterAnimation *animation;
      EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
      ActorPrivate *apriv = get_actor_private (window_actor);

      animation = clutter_actor_animate (actor,
                                         CLUTTER_EASE_OUT_QUAD,
                                         DESTROY_TIMEOUT,
                                         "opacity", 0,
                                         "scale-x", 0.8,
                                         "scale-y", 0.8,
                                         NULL);
      apriv->tml_destroy = clutter_animation_get_timeline (animation);
      data->plugin = plugin;
      data->actor = actor;
      g_signal_connect (apriv->tml_destroy, "completed",
                        G_CALLBACK (on_destroy_effect_complete),
                        data);
    }
  else
    meta_plugin_destroy_completed (plugin, window_actor);
}
/* change the texture size with +/- */
static gboolean
key_press_cb (ClutterActor *actor,
              ClutterEvent *event,
              gpointer      user_data)
{
  ClutterActor *texture;
  gfloat texture_width, texture_height;
  guint key_pressed;

  texture = CLUTTER_ACTOR (user_data);
  clutter_actor_get_size (texture, &texture_width, &texture_height);

  key_pressed = clutter_event_get_key_symbol (event);

  if (key_pressed == CLUTTER_KEY_plus)
    {
      texture_width *= 1.0 + TEXTURE_SIZE_STEP;
      texture_height *= 1.0 + TEXTURE_SIZE_STEP;
    }
  else if (key_pressed == CLUTTER_KEY_minus)
    {
      texture_width *= 1.0 - TEXTURE_SIZE_STEP;
      texture_height *= 1.0 - TEXTURE_SIZE_STEP;
    }

  if (texture_width <= TEXTURE_SIZE_MAX && texture_width >= TEXTURE_SIZE_MIN)
    clutter_actor_animate (texture, CLUTTER_EASE_OUT_CUBIC, 500,
                           "width", texture_width,
                           "height", texture_height,
                           NULL);

  return TRUE;
}
Esempio n. 14
0
static void
mex_column_view_opened_cb (MexColumn     *column,
                           GParamSpec    *pspec,
                           MexColumnView *column_view)
{
  MexColumnViewPrivate *priv = column_view->priv;

  if (mex_column_get_opened (column))
    clutter_actor_animate (priv->header,
                           CLUTTER_EASE_IN_OUT_QUAD, 200,
                           "opacity", 56, NULL);
  else
    clutter_actor_animate (priv->header,
                           CLUTTER_EASE_IN_OUT_QUAD, 200,
                           "opacity", 255, NULL);
}
/* Setup the video texture once its size is known */
void size_change (ClutterActor *texture, gint width, gint height, gpointer user_data) {
    ClutterActor *stage;
    gfloat new_x, new_y, new_width, new_height;
    gfloat stage_width, stage_height;
    ClutterAnimation *animation = NULL;

    stage = clutter_actor_get_stage (texture);
    if (stage == NULL)
        return;

    clutter_actor_get_size (stage, &stage_width, &stage_height);

    /* Center video on window and calculate new size preserving aspect ratio */
    new_height = (height * stage_width) / width;
    if (new_height <= stage_height) {
        new_width = stage_width;

        new_x = 0;
        new_y = (stage_height - new_height) / 2;
    } else {
        new_width  = (width * stage_height) / height;
        new_height = stage_height;

        new_x = (stage_width - new_width) / 2;
        new_y = 0;
    }
    clutter_actor_set_position (texture, new_x, new_y);
    clutter_actor_set_size (texture, new_width, new_height);
    clutter_actor_set_rotation (texture, CLUTTER_Y_AXIS, 0.0, stage_width / 2, 0, 0);
    /* Animate it */
    animation = clutter_actor_animate (texture, CLUTTER_LINEAR, 10000, "rotation-angle-y", 360.0, NULL);
    clutter_animation_set_loop (animation, TRUE);
}
Esempio n. 16
0
/*
 * The Nature of Maximize operation is such that it is difficult to do a visual
 * effect that would work well. Scaling, the obvious effect, does not work that
 * well, because at the end of the effect we end up with window content bigger
 * and differently laid out than in the real window; this is a proof concept.
 *
 * (Something like a sound would be more appropriate.)
 */
static void
maximize (MetaPlugin *plugin,
          MetaWindowActor *window_actor,
          gint end_x, gint end_y, gint end_width, gint end_height)
{
  MetaWindowType type;
  ClutterActor *actor = CLUTTER_ACTOR (window_actor);
  MetaWindow *meta_window = meta_window_actor_get_meta_window (window_actor);

  gdouble  scale_x    = 1.0;
  gdouble  scale_y    = 1.0;
  gfloat   anchor_x   = 0;
  gfloat   anchor_y   = 0;

  type = meta_window_get_window_type (meta_window);

  if (type == META_WINDOW_NORMAL)
    {
      ClutterAnimation *animation;
      EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
      ActorPrivate *apriv = get_actor_private (window_actor);
      gfloat width, height;
      gfloat x, y;

      apriv->is_maximized = TRUE;

      clutter_actor_get_size (actor, &width, &height);
      clutter_actor_get_position (actor, &x, &y);

      /*
       * Work out the scale and anchor point so that the window is expanding
       * smoothly into the target size.
       */
      scale_x = (gdouble)end_width / (gdouble) width;
      scale_y = (gdouble)end_height / (gdouble) height;

      anchor_x = (gdouble)(x - end_x)*(gdouble)width /
        ((gdouble)(end_width - width));
      anchor_y = (gdouble)(y - end_y)*(gdouble)height /
        ((gdouble)(end_height - height));

      clutter_actor_move_anchor_point (actor, anchor_x, anchor_y);

      animation = clutter_actor_animate (actor,
                                         CLUTTER_EASE_IN_SINE,
                                         MAXIMIZE_TIMEOUT,
                                         "scale-x", scale_x,
                                         "scale-y", scale_y,
                                         NULL);
      apriv->tml_maximize = clutter_animation_get_timeline (animation);
      data->plugin = plugin;
      data->actor = actor;
      g_signal_connect (apriv->tml_maximize, "completed",
                        G_CALLBACK (on_maximize_effect_complete),
                        data);
      return;
    }

  meta_plugin_maximize_completed (plugin, window_actor);
}
static void
mnp_clock_tile_drag_begin (MxDraggable *draggable, gfloat event_x, gfloat event_y, gint event_button, ClutterModifierType  modifiers)
{
	ClutterActor *self = CLUTTER_ACTOR (draggable);
	ClutterActor *stage = clutter_actor_get_stage (self);
	gfloat orig_x, orig_y;
	MnpClockTile *tile = (MnpClockTile *)draggable;
	gfloat width, height;
	MnpClockTilePriv *priv = tile->priv;
	clutter_actor_get_size (self, &width, &height);
	
	g_object_ref (self);

	if (priv->clone)
		clutter_actor_destroy (priv->clone);
	
	priv->clone = clutter_clone_new (self);

	tile->priv->depth = clutter_actor_get_depth (self);
	clutter_actor_get_transformed_position (self, &orig_x, &orig_y);
	//clutter_actor_reparent (self, stage);
	//clutter_actor_set_size (self, width, -1);
	//clutter_actor_raise_top (self);
	//clutter_actor_set_position (self, orig_x, orig_y);
	
	clutter_container_add_actor (CLUTTER_CONTAINER (stage), priv->clone);
	clutter_actor_set_position (priv->clone, orig_x, orig_y);
	clutter_actor_set_size (priv->clone, width, height);
	
	g_object_unref (self);

	clutter_actor_animate (self, CLUTTER_EASE_OUT_CUBIC, 250,
				"opacity", 0,
				NULL);
}
Esempio n. 18
0
static void
on_drag_begin (ClutterDragAction   *action,
               ClutterActor        *actor,
               gfloat               event_x,
               gfloat               event_y,
               ClutterModifierType  modifiers)
{
  gboolean is_copy = (modifiers & CLUTTER_SHIFT_MASK) ? TRUE : FALSE;
  ClutterActor *drag_handle = NULL;

  if (is_copy)
    {
      ClutterActor *stage = clutter_actor_get_stage (actor);

      drag_handle = clutter_rectangle_new ();
      clutter_actor_set_size (drag_handle, 48, 48);

      clutter_rectangle_set_color (CLUTTER_RECTANGLE (drag_handle),
                                   CLUTTER_COLOR_DarkSkyBlue);

      clutter_container_add_actor (CLUTTER_CONTAINER (stage), drag_handle);
      clutter_actor_set_position (drag_handle, event_x, event_y);
    }
  else
    drag_handle = actor;

  clutter_drag_action_set_drag_handle (action, drag_handle);

  /* fully desaturate the actor */
  clutter_actor_animate (actor, CLUTTER_LINEAR, 150,
                         "@effects.disable.factor", 1.0,
                         NULL);
}
Esempio n. 19
0
static void
gnibbles_worm_handle_bonus (GnibblesWorm *worm)
{
  ClutterActor *actor = NULL;

  if ((board->walls[worm->xhead][worm->yhead] != EMPTYCHAR) &&
    (board->walls[worm->xhead][worm->yhead] != WARPLETTER)) {
    actor = gnibbles_worm_get_head_actor (worm);
    g_signal_connect_after (
      clutter_actor_animate (actor, CLUTTER_EASE_OUT_QUINT, 420,
                            "scale-x", 1.45, "scale-y", 1.45,
                            "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
                            NULL),
      "completed", G_CALLBACK (worm_grok_scale_down), actor);
    gnibbles_worm_grok_bonus (worm);

    if ((board->walls[worm->xhead][worm->yhead] == BONUSREGULAR + 'A') &&
        !gnibbles_boni_fake (boni, worm->xhead, worm->yhead)) {

      gnibbles_boni_remove_bonus_final (boni, worm->xhead, worm->yhead);

      if (boni->numleft != 0)
        gnibbles_board_level_add_bonus (board, 1);

    } else
        gnibbles_boni_remove_bonus_final (boni, worm->xhead, worm->yhead);
  }

  if (board->walls[worm->xhead][worm->yhead] == WARPLETTER) {
    gnibbles_warpmanager_worm_change_pos (warpmanager, worm);
    games_sound_play ("teleport");
  }
}
Esempio n. 20
0
void
gnibbles_worm_reduce_tail (GnibblesWorm *worm, gint erasesize)
{
  gint i;
  gfloat x,y;
  ClutterActor *tmp = NULL;
  ClutterActor *group = clutter_group_new ();

  if (erasesize) {
    if (g_list_length (worm->list) <= erasesize) {
      gnibbles_worm_reset (worm);
      return;
    }

    for (i = 0; i < erasesize; i++) {
      tmp = gtk_clutter_texture_new_from_pixbuf (
              worm_pixmaps[properties->wormprops[worm->number]->color - 12]);
      clutter_actor_get_position
        (CLUTTER_ACTOR (g_list_last (worm->list)->data), &x, &y);
      clutter_actor_set_position (CLUTTER_ACTOR (tmp), x, y);
      clutter_actor_set_size (CLUTTER_ACTOR (tmp),
                              properties->tilesize,
                              properties->tilesize);
      clutter_container_add_actor (CLUTTER_CONTAINER (group), tmp);

      gnibbles_worm_move_tail_pointer (worm);
    }
    worm->length -= erasesize;
    clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);

    clutter_actor_animate (group, CLUTTER_EASE_OUT_ELASTIC, 850,
                           "opacity", 0,
                           NULL);
  }
}
Esempio n. 21
0
G_MODULE_EXPORT int
test_fbo_main (int argc, char *argv[])
{
  ClutterColor      blue   = {0x33, 0x44, 0x55, 0xff};

  ClutterActor     *fbo;
  ClutterActor     *onscreen_source;
  ClutterActor     *stage;
  ClutterAnimation *animation;
  int               x_pos = 200;
  int               y_pos = 100;

  clutter_init (&argc, &argv);

  if (clutter_feature_available (CLUTTER_FEATURE_OFFSCREEN) == FALSE)
    g_error("This test requires CLUTTER_FEATURE_OFFSCREEN");

  stage = clutter_stage_get_default ();
  clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
  clutter_stage_set_color (CLUTTER_STAGE (stage), &blue);

  /* Create the first source */
  onscreen_source = make_source();
  clutter_actor_show_all (onscreen_source);
  clutter_group_add (stage, onscreen_source);

  y_pos = (STAGE_HEIGHT/2.0) -
          (clutter_actor_get_height (onscreen_source)/2.0);
  clutter_actor_set_position (onscreen_source, x_pos, y_pos);
  x_pos += clutter_actor_get_width (onscreen_source);

  animation = clutter_actor_animate (onscreen_source,
                                     CLUTTER_LINEAR,
                                     5000, /* 1 second duration */
                                     "rotation-angle-y", 360.0f,
                                     NULL);
  clutter_animation_set_loop (animation, TRUE);

  /* Second hand = actor from onscreen_source */
  if ((fbo = clutter_texture_new_from_actor (onscreen_source)) == NULL)
    g_error("onscreen fbo creation failed");

  clutter_actor_set_position (fbo, x_pos, y_pos);
  x_pos += clutter_actor_get_width (fbo);
  clutter_group_add (stage, fbo);

  /* Third hand = actor from Second hand */
  if ((fbo = clutter_texture_new_from_actor (fbo)) == NULL)
    g_error("fbo from fbo creation failed");

  clutter_actor_set_position (fbo, x_pos, y_pos);
  x_pos += clutter_actor_get_width (fbo);
  clutter_group_add (stage, fbo);

  clutter_actor_show_all (stage);
  clutter_main ();

  return 0;
}
Esempio n. 22
0
	/*
		Hides the panel
	*/
	void WindowPanel::hide_panel() {
		if (clutter_actor_get_animation(actor_) != NULL) {
			clutter_actor_detach_animation(actor_);
		}

		clutter_actor_animate(actor_, CLUTTER_LINEAR, 500, "opacity", 0, NULL);
		hide_panel_timeout_id_ = 0;
	}
Esempio n. 23
0
static void
worm_grok_scale_down (ClutterAnimation *animation, ClutterActor *actor)
{
  clutter_actor_animate (actor, CLUTTER_EASE_OUT_QUINT, 420,
                         "scale-x", 1.0, "scale-y", 1.0,
                         "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
                         NULL);
}
Esempio n. 24
0
static void
on_rect_clicked (ClutterClickAction *action,
                 ClutterActor       *rect,
                 ClutterActor       *box)
{
  if (!is_expanded)
    clutter_actor_animate (box, CLUTTER_EASE_OUT_BOUNCE, 250,
                           "width", 400.0,
                           "height", 400.0,
                           NULL);
  else
    clutter_actor_animate (box, CLUTTER_EASE_OUT_BOUNCE, 250,
                           "width", 200.0,
                           "height", 200.0,
                           NULL);

  is_expanded = !is_expanded;
}
Esempio n. 25
0
static void
hide_logo (void)
{
  g_signal_connect_after (
    clutter_actor_animate (logo, CLUTTER_EASE_IN_QUAD, 150,
                           "opacity", 0,
                           NULL),
    "completed", G_CALLBACK (on_hide_logo_completed), logo);
}
Esempio n. 26
0
void
egg_anim_fade (ClutterActor *actor,
               gulong        mode,
               guint         duration,
               gint          level)
{
	clutter_actor_animate (actor, mode, duration, "opacity", level, NULL);
	clutter_actor_set_reactive (actor, level > 0);
}
Esempio n. 27
0
gint
main (gint   argc,
      gchar *argv[])
{
   ClutterContent *image;
   ClutterActor *stage;
   ClutterActor *box;
   GdkPixbuf *pixbuf;

   if (clutter_init(&argc, &argv) != CLUTTER_INIT_SUCCESS) {
      g_printerr("Failed to initialize clutter.\n");
      return 1;
   }

   stage = clutter_stage_new();
   clutter_stage_set_title (CLUTTER_STAGE (stage), "Image Viewer");
   clutter_actor_set_size(stage, 1400, 1200);
   clutter_actor_set_position(stage, 100, 100);
   g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
   clutter_actor_show(stage);

   pixbuf = gdk_pixbuf_new_from_file("testimage_8000.png", NULL);
   g_assert(pixbuf);

   image = clutter_image_new();
   clutter_image_set_data(CLUTTER_IMAGE(image),
                          gdk_pixbuf_get_pixels(pixbuf),
                          gdk_pixbuf_get_has_alpha(pixbuf) ?
                             COGL_PIXEL_FORMAT_RGBA_8888 :
                             COGL_PIXEL_FORMAT_RGB_888,
                          gdk_pixbuf_get_width(pixbuf),
                          gdk_pixbuf_get_height(pixbuf),
                          gdk_pixbuf_get_rowstride(pixbuf),
                          NULL);
   g_object_unref(pixbuf);

   box = clutter_actor_new();
   clutter_actor_set_position(box, 0, 0);
   clutter_actor_set_height(box, 8000);
   clutter_actor_set_width(box, 1200);
   //clutter_actor_add_constraint(box, clutter_bind_constraint_new(stage, CLUTTER_BIND_WIDTH, 0.0));
   clutter_actor_set_content(box, image);
   clutter_actor_add_child(stage, box);
   clutter_actor_show(box);

   clutter_stage_set_fullscreen(CLUTTER_STAGE(stage), TRUE);

   clutter_actor_animate(box,
                         CLUTTER_EASE_IN_OUT_QUAD,
                         4000,
                         "y", -8000.0,
                         NULL);

   clutter_main();

   return 0;
}
static void
mnp_clock_area_over_in (MxDroppable *droppable, MxDraggable *draggable)
{
  clutter_actor_animate (CLUTTER_ACTOR (droppable),
                         CLUTTER_EASE_IN_CUBIC,
                         250,
                         "opacity", 255,
                         NULL);
}
static void
_expire_notification (MexNotificationArea *area,
                      MexNotification     *notification,
                      ClutterActor        *actor)
{
    MexNotificationAreaPrivate *priv = GET_PRIVATE (area);
    ClutterAnimation *animation;
    ClutterActor *last_top_actor;

    g_hash_table_remove (priv->notification_to_timeout_id, notification);
    g_hash_table_remove (priv->notification_to_actor, notification);

    g_queue_remove_all (priv->stack, actor);

    animation = clutter_actor_animate (actor,
                                       CLUTTER_EASE_OUT_QUAD,
                                       350,
                                       "opacity", 0x00,
                                       NULL);

    g_signal_connect_after (animation,
                            "completed",
                            (GCallback)_animation_completed_cb,
                            actor);

    /* Check if there is already something else in the stack. If so fade that
     * back in ... */
    last_top_actor = g_queue_peek_head (priv->stack);

    if (last_top_actor)
    {
        ClutterTimeline *timeline;

        animation = clutter_actor_animate (last_top_actor,
                                           CLUTTER_EASE_OUT_QUAD,
                                           350,
                                           "opacity", 0xff,
                                           NULL);

        timeline = clutter_animation_get_timeline (animation);

        clutter_timeline_set_delay (timeline, 450);
    }
}
Esempio n. 30
0
static gboolean
on_enter (ClutterActor *actor,
          ClutterEvent *event)
{
  clutter_actor_animate (actor, CLUTTER_LINEAR, 150,
                         "@effects.curl.period", 0.25,
                         NULL);

  return FALSE;
}