static void
clutter_behaviour_ellipse_alpha_notify (ClutterBehaviour *behave,
                                        gdouble           alpha)
{
    ClutterBehaviourEllipse *self = CLUTTER_BEHAVIOUR_ELLIPSE (behave);
    ClutterBehaviourEllipsePrivate *priv = self->priv;
    gfloat start, end;
    gfloat angle = 0;
    knot3d knot;

    /* we do everything in single precision because it's easier, even
     * though all the parameters are stored in double precision for
     * consistency with the equivalent ClutterActor API
     */
    start = priv->angle_start;
    end   = priv->angle_end;

    if (priv->direction == CLUTTER_ROTATE_CW && start >= end)
        end += 360;
    else if (priv->direction == CLUTTER_ROTATE_CCW && start <= end)
        end -= 360;

    angle = (end - start) * alpha + start;

    clutter_behaviour_ellipse_advance (self, angle, &knot);

    knot.x += priv->center.x;
    knot.y += priv->center.y;

    clutter_behaviour_actors_foreach (behave, actor_apply_knot_foreach, &knot);
}
static void
clutter_behaviour_rotate_alpha_notify (ClutterBehaviour *behaviour,
                                       gdouble           alpha_value)
{
  ClutterBehaviourRotate *rotate_behaviour;
  ClutterBehaviourRotatePrivate *priv;
  RotateFrameClosure closure;
  gdouble start, end;

  rotate_behaviour = CLUTTER_BEHAVIOUR_ROTATE (behaviour);
  priv = rotate_behaviour->priv;

  closure.angle = 0;
  start         = priv->angle_start;
  end           = priv->angle_end;

  if (priv->direction == CLUTTER_ROTATE_CW && start >= end)
    end += 360.0;
  else if (priv->direction == CLUTTER_ROTATE_CCW && start <= end)
    end -= 360.0;

  closure.angle = (end - start) * alpha_value + start;

  clutter_behaviour_actors_foreach (behaviour,
				    alpha_notify_foreach,
				    &closure);
}
Exemplo n.º 3
0
static void
clutter_behaviour_path_alpha_notify (ClutterBehaviour *behave,
                                     gdouble           alpha_value)
{
  ClutterBehaviourPath *pathb = CLUTTER_BEHAVIOUR_PATH (behave);
  ClutterBehaviourPathPrivate *priv = pathb->priv;
  ClutterKnot position;
  guint knot_num;

  if (priv->path)
    knot_num = clutter_path_get_position (priv->path, alpha_value, &position);
  else
    {
      memset (&position, 0, sizeof (position));
      knot_num = 0;
    }

  clutter_behaviour_actors_foreach (behave,
                                    actor_apply_knot_foreach,
                                    &position);

  if (knot_num != priv->last_knot_passed)
    {
      g_signal_emit (behave, path_signals[KNOT_REACHED], 0, knot_num);
      priv->last_knot_passed = knot_num;
    }
}
static void
clutter_behaviour_alpha_notify (ClutterBehaviour *behave,
                                gdouble           alpha_value)
{
  ClutterBehaviourOpacityPrivate *priv;
  guint8 opacity;

  priv = CLUTTER_BEHAVIOUR_OPACITY (behave)->priv;

  opacity = alpha_value
            * (priv->opacity_end - priv->opacity_start)
            + priv->opacity_start;

  CLUTTER_NOTE (BEHAVIOUR, "alpha: %.4f, opacity: %u",
                alpha_value,
                opacity);

  clutter_behaviour_actors_foreach (behave,
				    alpha_notify_foreach,
				    GUINT_TO_POINTER ((guint) opacity));
}