Trait components::TimelineExt[][src]

pub trait TimelineExt: 'static {
Show methods pub fn add_marker(&self, marker_name: &str, progress: f64);
pub fn add_marker_at_time(&self, marker_name: &str, msecs: u32);
pub fn advance(&self, msecs: u32);
pub fn advance_to_marker(&self, marker_name: &str);
pub fn get_auto_reverse(&self) -> bool;
pub fn get_cubic_bezier_progress(
        &self
    ) -> Option<(InternalPoint, InternalPoint)>;
pub fn get_current_repeat(&self) -> i32;
pub fn get_delay(&self) -> u32;
pub fn get_delta(&self) -> u32;
pub fn get_direction(&self) -> TimelineDirection;
pub fn get_duration(&self) -> u32;
pub fn get_duration_hint(&self) -> i64;
pub fn get_elapsed_time(&self) -> u32;
pub fn get_progress(&self) -> f64;
pub fn get_progress_mode(&self) -> AnimationMode;
pub fn get_repeat_count(&self) -> i32;
pub fn get_step_progress(&self) -> Option<(i32, StepMode)>;
pub fn has_marker(&self, marker_name: &str) -> bool;
pub fn is_playing(&self) -> bool;
pub fn list_markers(&self, msecs: i32) -> Vec<GString, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
;
pub fn pause(&self);
pub fn remove_marker(&self, marker_name: &str);
pub fn rewind(&self);
pub fn set_auto_reverse(&self, reverse: bool);
pub fn set_cubic_bezier_progress(
        &self,
        c_1: &InternalPoint,
        c_2: &InternalPoint
    );
pub fn set_delay(&self, msecs: u32);
pub fn set_direction(&self, direction: TimelineDirection);
pub fn set_duration(&self, msecs: u32);
pub fn set_progress_func(
        &self,
        func: Option<Box<dyn Fn(&Timeline, f64, f64) + 'static, Global>>
    );
pub fn set_progress_mode(&self, mode: AnimationMode);
pub fn set_repeat_count(&self, count: i32);
pub fn set_step_progress(&self, n_steps: i32, step_mode: StepMode);
pub fn skip(&self, msecs: u32);
pub fn start(&self);
pub fn stop(&self);
pub fn connect_completed<F>(&self, f: F) -> SignalHandlerId
    where
        F: 'static + Fn(&Self)
;
pub fn connect_marker_reached<F>(&self, f: F) -> SignalHandlerId
    where
        F: 'static + Fn(&Self, &str, i32)
;
pub fn connect_new_frame<F>(&self, f: F) -> SignalHandlerId
    where
        F: 'static + Fn(&Self, i32)
;
pub fn connect_paused<F>(&self, f: F) -> SignalHandlerId
    where
        F: 'static + Fn(&Self)
;
pub fn connect_started<F>(&self, f: F) -> SignalHandlerId
    where
        F: 'static + Fn(&Self)
;
pub fn connect_stopped<F>(&self, f: F) -> SignalHandlerId
    where
        F: 'static + Fn(&Self, bool)
;
pub fn connect_property_auto_reverse_notify<F>(
        &self,
        f: F
    ) -> SignalHandlerId
    where
        F: 'static + Fn(&Self)
;
pub fn connect_property_delay_notify<F>(&self, f: F) -> SignalHandlerId
    where
        F: 'static + Fn(&Self)
;
pub fn connect_property_direction_notify<F>(&self, f: F) -> SignalHandlerId
    where
        F: 'static + Fn(&Self)
;
pub fn connect_property_duration_notify<F>(&self, f: F) -> SignalHandlerId
    where
        F: 'static + Fn(&Self)
;
pub fn connect_property_progress_mode_notify<F>(
        &self,
        f: F
    ) -> SignalHandlerId
    where
        F: 'static + Fn(&Self)
;
pub fn connect_property_repeat_count_notify<F>(
        &self,
        f: F
    ) -> SignalHandlerId
    where
        F: 'static + Fn(&Self)
;
}

Trait containing all Timeline methods.

Implementors

Timeline, Transition

Required methods

pub fn add_marker(&self, marker_name: &str, progress: f64)[src]

Adds a named marker that will be hit when the timeline has reached the specified progress.

Markers are unique string identifiers for a given position on the timeline. Once self reaches the given progress of its duration, if will emit a ::marker-reached signal for each marker attached to that particular point.

A marker can be removed with TimelineExt::remove_marker. The timeline can be advanced to a marker using TimelineExt::advance_to_marker.

See also: TimelineExt::add_marker_at_time

marker_name

the unique name for this marker

progress

the normalized value of the position of the martke

pub fn add_marker_at_time(&self, marker_name: &str, msecs: u32)[src]

Adds a named marker that will be hit when the timeline has been running for msecs milliseconds.

Markers are unique string identifiers for a given position on the timeline. Once self reaches the given msecs, it will emit a ::marker-reached signal for each marker attached to that position.

A marker can be removed with TimelineExt::remove_marker. The timeline can be advanced to a marker using TimelineExt::advance_to_marker.

See also: TimelineExt::add_marker

marker_name

the unique name for this marker

msecs

position of the marker in milliseconds

pub fn advance(&self, msecs: u32)[src]

Advance timeline to the requested point. The point is given as a time in milliseconds since the timeline started.

The self will not emit the Timeline::new-frame signal for the given time. The first ::new-frame signal after the call to TimelineExt::advance will be emit the skipped markers.

msecs

Time to advance to

pub fn advance_to_marker(&self, marker_name: &str)[src]

Advances self to the time of the given marker_name.

Like TimelineExt::advance, this function will not emit the Timeline::new-frame for the time where marker_name is set, nor it will emit Timeline::marker-reached for marker_name.

marker_name

the name of the marker

pub fn get_auto_reverse(&self) -> bool[src]

Retrieves the value set by TimelineExt::set_auto_reverse.

Returns

true if the timeline should automatically reverse, and false otherwise

pub fn get_cubic_bezier_progress(
    &self
) -> Option<(InternalPoint, InternalPoint)>
[src]

Retrieves the control points for the cubic bezier progress mode.

c_1

return location for the first control point of the cubic bezier, or None

c_2

return location for the second control point of the cubic bezier, or None

Returns

true if the self is using a cubic bezier progress more, and false otherwise

pub fn get_current_repeat(&self) -> i32[src]

Retrieves the current repeat for a timeline.

Repeats start at 0.

Returns

the current repeat

pub fn get_delay(&self) -> u32[src]

Retrieves the delay set using TimelineExt::set_delay.

Returns

the delay in milliseconds.

pub fn get_delta(&self) -> u32[src]

Retrieves the amount of time elapsed since the last Timeline::new-frame signal.

This function is only useful inside handlers for the ::new-frame signal, and its behaviour is undefined if the timeline is not playing.

Returns

the amount of time in milliseconds elapsed since the last frame

pub fn get_direction(&self) -> TimelineDirection[src]

Retrieves the direction of the timeline set with TimelineExt::set_direction.

Returns

the direction of the timeline

pub fn get_duration(&self) -> u32[src]

Retrieves the duration of a Timeline in milliseconds. See TimelineExt::set_duration.

Returns

the duration of the timeline, in milliseconds.

pub fn get_duration_hint(&self) -> i64[src]

Retrieves the full duration of the self, taking into account the current value of the Timeline:repeat-count property.

If the Timeline:repeat-count property is set to -1, this function will return G_MAXINT64.

The returned value is to be considered a hint, and it’s only valid as long as the self hasn’t been changed.

Returns

the full duration of the Timeline

pub fn get_elapsed_time(&self) -> u32[src]

Request the current time position of the timeline.

Returns

current elapsed time in milliseconds.

pub fn get_progress(&self) -> f64[src]

The position of the timeline in a normalized [-1, 2] interval.

The return value of this function is determined by the progress mode set using TimelineExt::set_progress_mode, or by the progress function set using TimelineExt::set_progress_func.

Returns

the normalized current position in the timeline.

pub fn get_progress_mode(&self) -> AnimationMode[src]

Retrieves the progress mode set using TimelineExt::set_progress_mode or TimelineExt::set_progress_func.

Returns

a AnimationMode

pub fn get_repeat_count(&self) -> i32[src]

Retrieves the number set using TimelineExt::set_repeat_count.

Returns

the number of repeats

pub fn get_step_progress(&self) -> Option<(i32, StepMode)>[src]

Retrieves the parameters of the step progress mode used by self.

n_steps

return location for the number of steps, or None

step_mode

return location for the value change policy, or None

Returns

true if the self is using a step progress mode, and false otherwise

pub fn has_marker(&self, marker_name: &str) -> bool[src]

Checks whether self has a marker set with the given name.

marker_name

the name of the marker

Returns

true if the marker was found

pub fn is_playing(&self) -> bool[src]

Queries state of a Timeline.

Returns

true if timeline is currently playing

pub fn list_markers(&self, msecs: i32) -> Vec<GString, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Retrieves the list of markers at time msecs. If msecs is a negative integer, all the markers attached to self will be returned.

msecs

the time to check, or -1

n_markers

the number of markers returned

Returns

a newly allocated, None terminated string array containing the names of the markers. Use g_strfreev when done.

pub fn pause(&self)[src]

Pauses the Timeline on current frame

pub fn remove_marker(&self, marker_name: &str)[src]

Removes marker_name, if found, from self.

marker_name

the name of the marker to remove

pub fn rewind(&self)[src]

Rewinds Timeline to the first frame if its direction is TimelineDirection::Forward and the last frame if it is TimelineDirection::Backward.

pub fn set_auto_reverse(&self, reverse: bool)[src]

Sets whether self should reverse the direction after the emission of the Timeline::completed signal.

Setting the Timeline:auto-reverse property to true is the equivalent of connecting a callback to the Timeline::completed signal and changing the direction of the timeline from that callback; for instance, this code:

static void
reverse_timeline (Timeline *timeline)
{
  TimelineDirection dir = timeline_get_direction (timeline);

  if (dir == TIMELINE_FORWARD)
    dir = TIMELINE_BACKWARD;
  else
    dir = TIMELINE_FORWARD;

  timeline_set_direction (timeline, dir);
}
...
  timeline = timeline_new (1000);
  timeline_set_repeat_count (timeline, -1);
  g_signal_connect (timeline, "completed",
                    G_CALLBACK (reverse_timeline),
                    NULL);

can be effectively replaced by:

  timeline = timeline_new (1000);
  timeline_set_repeat_count (timeline, -1);
  timeline_set_auto_reverse (timeline);

reverse

true if the self should reverse the direction

pub fn set_cubic_bezier_progress(
    &self,
    c_1: &InternalPoint,
    c_2: &InternalPoint
)
[src]

Sets the Timeline:progress-mode of self to AnimationMode::CubicBezier, and sets the two control points for the cubic bezier.

The cubic bezier curve is between (0, 0) and (1, 1). The X coordinate of the two control points must be in the [ 0, 1 ] range, while the Y coordinate of the two control points can exceed this range.

c_1

the first control point for the cubic bezier

c_2

the second control point for the cubic bezier

pub fn set_delay(&self, msecs: u32)[src]

Sets the delay, in milliseconds, before self should start.

msecs

delay in milliseconds

pub fn set_direction(&self, direction: TimelineDirection)[src]

Sets the direction of self, either TimelineDirection::Forward or TimelineDirection::Backward.

direction

the direction of the timeline

pub fn set_duration(&self, msecs: u32)[src]

Sets the duration of the timeline, in milliseconds. The speed of the timeline depends on the Timeline:fps setting.

msecs

duration of the timeline in milliseconds

pub fn set_progress_func(
    &self,
    func: Option<Box<dyn Fn(&Timeline, f64, f64) + 'static, Global>>
)
[src]

Sets a custom progress function for self. The progress function will be called by TimelineExt::get_progress and will be used to compute the progress value based on the elapsed time and the total duration of the timeline.

If func is not None, the Timeline:progress-mode property will be set to AnimationMode::CustomMode.

If func is None, any previously set progress function will be unset, and the Timeline:progress-mode property will be set to AnimationMode::Linear.

func

a progress function, or None

data

data to pass to func

notify

a function to be called when the progress function is removed or the timeline is disposed

pub fn set_progress_mode(&self, mode: AnimationMode)[src]

Sets the progress function using a value from the AnimationMode enumeration. The mode cannot be AnimationMode::CustomMode or bigger than AnimationMode::AnimationLast.

mode

the progress mode, as a AnimationMode

pub fn set_repeat_count(&self, count: i32)[src]

Sets the number of times the self should repeat.

If count is 0, the timeline never repeats.

If count is -1, the timeline will always repeat until it’s stopped.

count

the number of times the timeline should repeat

pub fn set_step_progress(&self, n_steps: i32, step_mode: StepMode)[src]

Sets the Timeline:progress-mode of the self to AnimationMode::Steps and provides the parameters of the step function.

n_steps

the number of steps

step_mode

whether the change should happen at the start or at the end of the step

pub fn skip(&self, msecs: u32)[src]

Advance timeline by the requested time in milliseconds

msecs

Amount of time to skip

pub fn start(&self)[src]

Starts the Timeline playing.

pub fn stop(&self)[src]

Stops the Timeline and moves to frame 0

pub fn connect_completed<F>(&self, f: F) -> SignalHandlerId where
    F: 'static + Fn(&Self), 
[src]

The Timeline::completed signal is emitted when the timeline’s elapsed time reaches the value of the Timeline:duration property.

This signal will be emitted even if the Timeline is set to be repeating.

If you want to get notification on whether the Timeline has been stopped or has finished its run, including its eventual repeats, you should use the Timeline::stopped signal instead.

pub fn connect_marker_reached<F>(&self, f: F) -> SignalHandlerId where
    F: 'static + Fn(&Self, &str, i32), 
[src]

The ::marker-reached signal is emitted each time a timeline reaches a marker set with TimelineExt::add_marker_at_time. This signal is detailed with the name of the marker as well, so it is possible to connect a callback to the ::marker-reached signal for a specific marker with:

<informalexample>``<programlisting> timeline_add_marker_at_time (timeline, “foo”, 500); timeline_add_marker_at_time (timeline, “bar”, 750);

g_signal_connect (timeline, “marker-reached”, G_CALLBACK (each_marker_reached), NULL); g_signal_connect (timeline, “marker-reached::foo”, G_CALLBACK (foo_marker_reached), NULL); g_signal_connect (timeline, “marker-reached::bar”, G_CALLBACK (bar_marker_reached), NULL); </programlisting>``</informalexample>

In the example, the first callback will be invoked for both the “foo” and “bar” marker, while the second and third callbacks will be invoked for the “foo” or “bar” markers, respectively.

marker_name

the name of the marker reached

msecs

the elapsed time

pub fn connect_new_frame<F>(&self, f: F) -> SignalHandlerId where
    F: 'static + Fn(&Self, i32), 
[src]

The ::new-frame signal is emitted for each timeline running timeline before a new frame is drawn to give animations a chance to update the scene.

msecs

the elapsed time between 0 and duration

pub fn connect_paused<F>(&self, f: F) -> SignalHandlerId where
    F: 'static + Fn(&Self), 
[src]

The ::paused signal is emitted when TimelineExt::pause is invoked.

pub fn connect_started<F>(&self, f: F) -> SignalHandlerId where
    F: 'static + Fn(&Self), 
[src]

The ::started signal is emitted when the timeline starts its run. This might be as soon as TimelineExt::start is invoked or after the delay set in the Timeline:delay property has expired.

pub fn connect_stopped<F>(&self, f: F) -> SignalHandlerId where
    F: 'static + Fn(&Self, bool), 
[src]

The Timeline::stopped signal is emitted when the timeline has been stopped, either because TimelineExt::stop has been called, or because it has been exhausted.

This is different from the Timeline::completed signal, which gets emitted after every repeat finishes.

If the Timeline has is marked as infinitely repeating, this signal will never be emitted.

is_finished

true if the signal was emitted at the end of the timeline.

pub fn connect_property_auto_reverse_notify<F>(&self, f: F) -> SignalHandlerId where
    F: 'static + Fn(&Self), 
[src]

pub fn connect_property_delay_notify<F>(&self, f: F) -> SignalHandlerId where
    F: 'static + Fn(&Self), 
[src]

pub fn connect_property_direction_notify<F>(&self, f: F) -> SignalHandlerId where
    F: 'static + Fn(&Self), 
[src]

pub fn connect_property_duration_notify<F>(&self, f: F) -> SignalHandlerId where
    F: 'static + Fn(&Self), 
[src]

pub fn connect_property_progress_mode_notify<F>(&self, f: F) -> SignalHandlerId where
    F: 'static + Fn(&Self), 
[src]

pub fn connect_property_repeat_count_notify<F>(&self, f: F) -> SignalHandlerId where
    F: 'static + Fn(&Self), 
[src]

Loading content...

Implementors

impl<O> TimelineExt for O where
    O: IsA<Timeline>, 
[src]

Loading content...