Class: Clutter::State

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Overview

The Clutter::StateClass structure contains
only private data

Instance Method Summary collapse

Constructor Details

#initializeClutter::State

Creates a new Clutter::State

Instance Method Details

#durationInteger

Default duration used if an duration has not been specified for a specific
source/target state pair. The values is in milliseconds.

Returns:

  • (Integer)

    duration

#duration=(duration) ⇒ Integer

Default duration used if an duration has not been specified for a specific
source/target state pair. The values is in milliseconds.

Parameters:

  • duration (Integer)

Returns:

  • (Integer)

    duration

  • (Integer)

    duration

#get_animator(source_state_name, target_state_name) ⇒ Clutter::Animator

Retrieves the Clutter::Animator that is being used for transitioning
between the two states, if any has been set

Parameters:

  • source_state_name (String)

    the name of a source state

  • target_state_name (String)

    the name of a target state

Returns:

#get_duration(source_state_name, target_state_name) ⇒ Integer

Queries the duration used for transitions between a source and
target state pair

The semantics for the query are the same as the semantics used for
setting the duration with clutter_state_set_duration()

Parameters:

  • source_state_name (String)

    the name of the source state to
    get the duration of, or nil

  • target_state_name (String)

    the name of the source state to
    get the duration of, or nil

Returns:

  • (Integer)

    the duration, in milliseconds

#get_keys(source_state_name, target_state_name, object, property_name) ⇒ GLib::List<Clutter::StateKey>

Returns a list of pointers to opaque structures with accessor functions
that describe the keys added to an animator.

Parameters:

  • source_state_name (String)

    the source transition name to query,
    or nil for all source states

  • target_state_name (String)

    the target transition name to query,
    or nil for all target states

  • object (GObject::Object)

    the specific object instance to list keys for,
    or nil for all managed objects

  • property_name (String)

    the property name to search for, or nil
    for all properties.

Returns:

  • (GLib::List<Clutter::StateKey>)

    a
    newly allocated #GList of Clutter::StateKeys. The contents of
    the returned list are owned by the Clutter::State and should not be
    modified or freed. Use g_list_free() to free the resources allocated
    by the returned list when done using it

#remove_key(source_state_name, target_state_name, object, property_name) ⇒ nil

Removes all keys matching the search criteria passed in arguments.

Parameters:

  • source_state_name (String)

    the source state name to query,
    or nil for all source states

  • target_state_name (String)

    the target state name to query,
    or nil for all target states

  • object (GObject::Object)

    the specific object instance to list keys for,
    or nil for all managed objects

  • property_name (String)

    the property name to search for,
    or nil for all properties.

Returns:

  • (nil)

#set(source_state_name, target_state_name, first_object, first_property_name, first_mode, array) ⇒ nil

Adds multiple keys to a named state of a Clutter::State instance, specifying
the easing mode and value a given property of an object should have at a
given progress of the animation.

The mode specified is the easing mode used when going to from the previous
key to the specified key.

For instance, the code below:

|[
clutter_state_set (state, NULL, "hover",
button, "opacity", CLUTTER_LINEAR, 255,
button, "scale-x", CLUTTER_EASE_OUT_CUBIC, 1.2,
button, "scale-y", CLUTTER_EASE_OUT_CUBIC, 1.2,
NULL);
]|

will create a transition from any state (a source_state_name or NULL is
treated as a wildcard) and a state named "hover"; the
button object will have the Clutter::Actor:opacity
property animated to a value of 255 using %CLUTTER_LINEAR as the animation
mode, and the Clutter::Actor:scale-x and #ClutterActor:scale-y properties
animated to a value of 1.2 using %CLUTTER_EASE_OUT_CUBIC as the animation
mode. To change the state (and start the transition) you can use the
clutter_state_set_state() function:

|[
clutter_state_set_state (state, "hover");
]|

If a given object, state_name, property tuple already exist in the
Clutter::State instance, then the mode and value will be replaced with
the new specified values.

If a property name is prefixed with "delayed::" two additional
arguments per key are expected: a value relative to the full state time
to pause before transitioning and a similar value to pause after
transitioning, e.g.:

|[
clutter_state_set (state, "hover", "toggled",
button, "delayed::scale-x", CLUTTER_LINEAR, 1.0, 0.2, 0.2,
button, "delayed::scale-y", CLUTTER_LINEAR, 1.0, 0.2, 0.2,
NULL);
]|

will pause for 20% of the duration of the transition before animating,
and 20% of the duration after animating.

Parameters:

  • source_state_name (String)

    the name of the source state keys are being added for

  • target_state_name (String)

    the name of the target state keys are being added for

  • first_object (GObject)

    a #GObject

  • first_property_name (String)

    a property of first_object to specify a key for

  • first_mode (Clutter::gulong)

    the id of the alpha function to use

  • array (Array)

    the value first_property_name should have in target_state_name,
    followed by object, property name, mode, value tuples, terminated
    by nil

Returns:

  • (nil)

#set_animator(source_state_name, target_state_name, animator) ⇒ nil

Specifies a Clutter::Animator to be used when transitioning between
the two named states.

The animator allows specifying a transition between the state that is
more elaborate than the basic transitions allowed by the tweening of
properties defined in the Clutter::State keys.

If animator is nil it will unset an existing animator.

Clutter::State will take a reference on the passed animator, if any

Parameters:

  • source_state_name (String)

    the name of a source state

  • target_state_name (String)

    the name of a target state

  • animator (Clutter::Animator)

    a Clutter::Animator instance, or nil to
    unset an existing Clutter::Animator

Returns:

  • (nil)

#set_duration(source_state_name, target_state_name, duration) ⇒ nil

Sets the duration of a transition.

If both state names are nil the default duration for state is set.

If only target_state_name is specified, the passed duration becomes
the default duration for transitions to the target state.

If both states names are specified, the passed duration only applies
to the specified transition.

Parameters:

  • source_state_name (String)

    the name of the source state, or nil

  • target_state_name (String)

    the name of the target state, or nil

  • duration (Integer)

    the duration of the transition, in milliseconds

Returns:

  • (nil)

#set_key(source_state_name, target_state_name, object, property_name, mode, value, pre_delay, post_delay) ⇒ Clutter::State

Sets one specific end key for a state name, object, property_name
combination.

Parameters:

  • source_state_name (String)

    the source transition to specify
    transition for, or nil to specify the default fallback when a
    more specific source state doesn't exist.

  • target_state_name (String)

    the name of the transition to set a key value for.

  • object (GObject::Object)

    the #GObject to set a key for

  • property_name (String)

    the property to set a key for

  • mode (Integer)

    the id of the alpha function to use

  • value (GObject::Value)

    the value for property_name of object in state_name

  • pre_delay (Float)

    relative time of the transition to be idle in the beginning
    of the transition

  • post_delay (Float)

    relative time of the transition to be idle in the end of
    the transition

Returns:

  • (Clutter::State)

    the Clutter::State instance, allowing
    chaining of multiple calls

#stateString

The currently set target state, setting it causes the
state machine to transition to the new state, use
clutter_state_warp_to_state() to change state without
a transition.

Returns:

  • (String)

    state

#state=(state) ⇒ String

The currently set target state, setting it causes the
state machine to transition to the new state, use
clutter_state_warp_to_state() to change state without
a transition.

Parameters:

  • state (String)

Returns:

  • (String)

    state

  • (String)

    state

#statesGLib::List<String>

Gets a list of all the state names managed by this Clutter::State.

Returns:

  • (GLib::List<String>)

    a newly allocated
    #GList of state names. The contents of the returned #GList are owned
    by the Clutter::State and should not be modified or freed. Use
    g_list_free() to free the resources allocated by the returned list when
    done using it

#timelineClutter::Timeline

Gets the timeline driving the Clutter::State

Returns:

  • (Clutter::Timeline)

    the Clutter::Timeline that drives
    the state change animations. The returned timeline is owned
    by the Clutter::State and it should not be unreferenced directly

#warp_to_state(target_state_name) ⇒ Clutter::Timeline

Change to the specified target state immediately with no animation.

See clutter_state_set_state().

Parameters:

  • target_state_name (String)

    the state to transition to

Returns:

  • (Clutter::Timeline)

    the Clutter::Timeline that drives the
    state transition. The returned timeline is owned by the Clutter::State
    and it should not be unreferenced