A JSX component that wraps a pointer to the engine’s CYIAbstractTimeline
.
You can call the imperative playback methods such as play(), stop(), and so on, with TimelineRef.
However, TimelineRef is not immediately available — instead you get it from the parameter of the onLoad callback prop, and either use it immediately or cache it for later use.
TimelineRef searches recursively downwards through the tree starting at its parent node for a marker which matches the name prop.
For more contextual information regarding animations and TimelineRef, see the Animations topic.
import React, { Component } from 'react';
import { AppRegistry } from 'react-native';
import { Composition, TimelineRef } from '@youi/react-native-youi';
export default class TestTimelineRef extends Component {
constructor(props) {
super(props);
}
onTimelineLoaded = timeline => timeline.play();
onTimelineCompleted = () => console.log('Timeline completed');
render() {
return (
<Composition source="PDP_Main">
<TimelineRef
name="In"
onCompositionDidLoad={this.onTimelineLoaded}
onCompleted={this.onTimelineCompleted}
/>
</Composition>
);
}
}
AppRegistry.registerComponent('YiReactApp', () => TestTimelineRef);
name
AE timeline name.
Type | Required |
---|---|
string | Yes |
direction
Set to either forward
or reverse
.
You can change the direction that the timeline created in After Effects plays in.
This prop defaults to forward
.
<TimelineRef
name='MyTimeline'
direction='reverse'
...
>
Type | Required |
---|---|
enum (‘forward’, ‘reverse’) | No |
loop
You can set a timeline to loop indefinitely through the loop
prop, which takes a boolean value.
Default is False.
<TimelineRef
name='MyTimeline'
loop={true}
...
>
Type | Required |
---|---|
bool | No |
onCompositionDidLoad
Called when load completes successfully. Provides a reference to this TimelineRef.
Type | Required |
---|---|
function | No |
onAborted
Called when the timeline execution is aborted by the Abort()
function.
Type | Required |
---|---|
function | No |
Note The onAborted
prop is not supported on Roku.
onCompleted
Called when playback of the timeline completes normally.
Type | Required |
---|---|
function | No |
Note The onCompleted
prop is not supported on Roku as the prop gets called immediately instead of when the timeline completes.
onPaused
Called whenever the timeline stops playing, including if the timeline execution completes normally.
Type | Required |
---|---|
function | No |
Note The onPaused
prop is not supported on Roku as the prop may get triggered unexpectedly.
onPlay
Called whenever the timeline starts playing (from any position).
Type | Required |
---|---|
function | No |
onStarted
Called when playback of the timeline is initiated by one of the Start()
functions.
Type | Required |
---|---|
function | No |
onCompletedForward
Called when playback of the timeline completes normally. Triggered only when direction is forward.
Type | Required |
---|---|
function | No |
Note The onCompletedForward
prop is not supported on Roku as the prop gets called immediately instead of when the timeline completes.
onPausedForward
Called whenever the timeline stops playing, including if the timeline execution completes normally. Triggered only when direction is forward.
Type | Required |
---|---|
function | No |
Note The onPausedForward
prop is not supported on Roku as the prop may get triggered unexpectedly.
onPlayForward
Called whenever the timeline starts playing (from any position). Triggered only when direction is forward.
Type | Required |
---|---|
function | No |
onStartedForward
Called when playback of the timeline is initiated by one of the Start()
functions.
Triggered only when direction is forward.
Type | Required |
---|---|
function | No |
onCompletedReverse
Called when playback of the timeline completes normally. Triggered only when direction is reverse.
Type | Required |
---|---|
function | No |
Note The onCompletedReverse
prop is not supported on Roku as the prop gets called immediately instead of when the timeline completes.
onPausedReverse
Called whenever the timeline stops playing, including if the timeline execution completes normally. Triggered only when direction is reverse.
Type | Required |
---|---|
function | No |
Note The onPausedReverse
prop is not supported on Roku as the prop may get triggered unexpectedly.
onPlayReverse
Called whenever the timeline starts playing (from any position). Triggered only when direction is reverse.
Type | Required |
---|---|
function | No |
onStartedReverse
Called when playback of the timeline is initiated by one of the Start()
functions.
Triggered only when direction is reverse.
Type | Required |
---|---|
function | No |
Start()
Start()
Starts playback of this timeline from the beginning (or from the end if the current direction is reverse).
The onPlay
and onStarted
props are triggered, along with either onPlayForward
and onStartedForward
, or onPlayReverse
and onStartedReverse
(depending on the current direction).
The onPaused
, onPausedForward
, and onPausedReverse
props are not triggered.
Stop()
Stop()
Stops playback of this timeline and moves to the end of the timeline (or beginning, depending on the playback direction).
The onPaused
and onCompleted
props are triggered, along with either onPausedForward
and onCompletedForward
, or onPausedReverse
and onCompletedReverse
(depending on the current direction).
Note Stop()
is not supported on Cloud Solution.
Pause()
Pause()
Pauses this timeline at its current execution point.
Does not reset position.
The onPaused
prop is triggered, along with the onPausedForward
or onPausedReverse
prop (depending on the current direction).
Note Pause()
is not supported on Cloud Solution.
Play()
Play()
Resumes playback of this timeline from the current execution point in the current direction.
The onPlay
prop is triggered, along with the onPlayForward
or onPlayReverse
prop (depending on the current direction).
Abort()
Abort()
Pauses this timeline at its current execution point.
Does not reset position.
Unlike [Pause()](#method-Method4)
, this function does not trigger the OnPaused
, onPausedForward
, and onPausedReverse
props.
Instead, the onAborted
prop is triggered.
Note Abort()
is not supported on Cloud Solution.
Seek()
seek(fPercentage)
Seeks to the given percentage within the timeline.
Values of fPercentage
must be between 0.0 and 1.0.
WARNING This function ignores the playback direction of the timeline.
Parameters:
Name | Type | Required | Description |
---|---|---|---|
fPercentage | float | Yes | Percentage to seek to. |
Note Seek()
is not supported on Cloud Solution.