Search
⌃K

ActorComponent

An ActorArtboard's hierarchy is composed of components. The base class for these components is ActorComponent.
This is the manual for the old version of Rive (formerly Flare). Visit the Help Center for the new Rive here.
At its most basic level a component has a name and a parent (another component which it is somehow related to). Parent/child relationships vary depending on the context and type of the parent and child. For example, ActorNode uses parent/child relationship to created nested transform spaces. ActorFill and ActorStroke are parented to an ActorShape which they respectively fill and stroke.

Bones

implements ActorBone extends ActorBoneBase
Bones can be accessed at runtime, and you can modify the rotation of a bone using Radians and scale of a bone on the 'x' and 'y'. The position of a bone is inherited from its parent. You can access or store a reference to a named bone of an Actor.
Flutter Sample
Swift Sample
React Sample
JS Sample
C++ Sample
import 'package:flare_dart/actor_bone.dart';
...
{
ActorBone myBone = artboard.getNode("myBoneString") as ActorBone;
}
let boneNode = artboard?.getNod(name: "Bone") as? ActorBoneBase
print(boneNode?.length as Any)
import ActorBone from 'flare-react/dependencies/Flare-JS/source/ActorBone.js';
constructor()
{
super();
this._MyBone = new ActorBone();
}
initialize(artboard)
{
this._MyBone = artboard.getNode("Bone");
}
FlareExample.prototype.setActor = function(actor)
{
if(this._ActorInstance)
{
this._ActorInstance.dispose(this._Graphics);
}
const actorInstance = actor.makeInstance();
actorInstance.initialize(this._Graphics);
this._Actor = actor;
this._ActorInstance = actorInstance;
if(actorInstance)
{
actorInstance.initialize(this._Graphics);
this._MyBone = actorInstance.getNode("Bone");
console.log(this._MyBone.length);
console.log(this._MyBone.rotation);
console.log(this._MyBone.scaleX);
console.log(this._MyBone.scaleY);
}
};
...
#include "flare/actor_bone.hpp"
...
...
flare::ActorBone* bone = static_cast<flare::ActorBone*>(artboard->component("BoneString"));
printf("node's length %f\n", bone->length());
...

Nodes

implements ActorNode class
Each node in the hierarchy can be manipulated at runtime freely of the parent. You can modify the position of a node using a 2d Vector or rotation using Radians. You can access or store a reference to a named node of an Actor.
Flutter Sample
Swift Sample
React Sample
JS Sample
C++ Sample
import 'package:flare_flutter/flare_actor.dart';
import 'package:flare_flutter/flare_controller.dart';
...
{
ActorNode myNode = artboard.getNode("myNodeString");
}
let myNode = artboard?.getNode(name: "Node")
import FlareComponent from 'flare-react';
initialize(artboard)
{
this._MyNode = this._Artboard.getNode("nodeString");
}
FlareExample.prototype.setActor = function(actor)
{
if(this._ActorInstance)
{
this._ActorInstance.dispose(this._Graphics);
}
const actorInstance = actor.makeInstance();
actorInstance.initialize(this._Graphics);
this._ActorInstance = actorInstance;
if(actorInstance)
{
actorInstance.initialize(this._Graphics);
this._MyNode = actorInstance.getNode("NodeString");
console.log(this._MyBone.length);
console.log(this._MyBone.rotation);
console.log(this._MyBone.scaleX);
console.log(this._MyBone.scaleY);
}
};
...
flare::ActorNode* myNode = static_cast<flare::ActorNode*>(artboard->component("NodeStrin"));
...

Solo Nodes

implements ActorNodeSolo class
Solo Nodes are children of bones or nodes that can be toggled on one at a time. One example use case could be different hairstyles being toggled on an avatar. Access solo nodes by getting a reference to them first, then you can modify which index in the array is active.
Flutter Sample
Swift Sample
React Sample
JS Sample
C++ Sample
import 'package:flare_dart/actor_node_solo.dart';
...
{
ActorNodeSolo solo = _artboard.getNode("Solo_Name") as ActorNodeSolo;
solo.setActiveChildIndex(1);
}
soloNode = artboard?.getNode(name: "SoloNode") as? ActorNodeSolo
soloNode?.setActiveChildIndex(1)
print(soloNode?.activeChildIndex)
import ActorNodeSolo from 'flare-react/dependencies/Flare-JS/source/ActorNodeSolo.js';
constructor()
{
super();
this._SoloNode = new ActorNodeSolo();
}
initialize(artboard)
{
this._SoloNode = artboard.getNode("soloString");
this._SoloNode.setActiveChildIndex(1);
}
this._SoloNode = this._ActorInstance.getNode("Solo");
this._SoloNode.setActiveChildIndex(1);
#include "flare/actor_node_solo.hpp"
...
flare::ActorNodeSolo* soloNode = static_cast<flare::ActorNodeSolo*>(artboard->component("Mustache_Solo"));
soloNode->setActiveChildIndex(3);
printf("node's active child %d\n", soloNode->activeChildIndex());
...

Custom Properties

implements PropertyTypes Class
Custom Properties are variables (boolean, integer, float or string) set within an animation that can be read at runtime. For example, you can set a boolean in a frame of your animation and it will be read in code via a listener when the animation reaches that point in the timeline. One example use case could be to fire off a sound effect for a certain frame within an animation.
Flutter Sample
Swift Sample
React Sample
JS Sample
C++ Sample
...coming soon...
...coming soon...
import CustomProperty from 'flare-react/dependencies/Flare-JS/source/CustomProperty.js';
initialize(artboard)
{
this._MyNode = artboard.getNode("customPropertyNode");
}
advance(artboard, elapsed)
{
for (let props in this._MyNode._CustomProperties)
{
switch (this._MyNode._CustomProperties[props]._Name)
{
case "happy_sound":
///play our sound when the custom property changes
if (this._MyNode._CustomProperties[props]._Value === true){
//do something
}
break;
}
}
}
function _Advance(_This)
{
...
if (_This._MyNode)
{
for (let props in _This._MyNode._CustomProperties)
{
switch (_This._MyNode._CustomProperties[props]._Name)
{
case "happy_sound":
///play our sound when the custom property changes
if (_This._MyNode._CustomProperties[props]._Value === true)
{
console.log("hey yay");
}
break;
}
}
}
...
}
FlareExample.prototype.setActor = function(actor)
{
...
this._MyNode = actorInstance.getNode("Scale Node_Special Property");
...
}
...
flare::ActorNode* cpNode = static_cast<flare::ActorNode*>(artboard->component("Property"));
flare::CustomBooleanProperty* customProp = cpNode->getCustomBooleanProperty("Prop_String");
...

Events

implements ActorEvent class
You can trigger Events with a keyframe during your animation, which can run any custom code at runtime. Events can be attached to any object (this can be used to provide extra context along with Custom Properties).
Flutter Sample
Swift Sample
React Sample
JS Sample
C++ Sample
import 'package:flare_flutter/flare_actor.dart';
import 'package:flare_flutter/flare_controller.dart';
import 'package:flare_flutter/flare.dart';
...
ActorAnimation _actorAnimation ;
void initialize(FlutterActorArtboard artboard) {
///need to get the animation that has the trigger
_actorAnimation = artboard.getAnimation("animationWithTrigger");
}
bool advance(FlutterActorArtboard artboard, double elapsed) {
List<AnimationEventArgs> _animationEvents = [];
...
for (int i = 0; i < _animationLayers.length; i++) {
...
FlareAnimationLayer layer = _animationLayers[i];
_actorAnimation.triggerEvents(artboard.components, currLayerAnim, layer.time, _animationEvents);
for(var event in _animationEvents)
{
switch (event.name)
{
case "Trigger Name":
//Event is Triggered
break;
}
}
...
}
}
...
override open func advanceControls(by elapsed: Double) -> Bool {
var arrayEvent = Array<AnimationEventArgs>()
for i in 0..<controlLayers.count {
...
currentAnimTime = layer.time;
// EVENT TEST:
if(animation == nil)
{
animation = artboard.getAnimation(name: "Mustache_New")
}
animation?.triggerEvents(components: artboard.components! as! Array<ActorComponent>, fromTime: currentAnimTime, toTime: layer.time, triggerEvents: &arrayEvent)
for i in 0 ..< arrayEvent.count {
print(arrayEvent[i].name)
if(arrayEvent[i].name == "Event"){
//do something
}
}
.....
}
}
...
initialize(artboard)
{
this._ProgressTracker = artboard.getAnimation("animationWithTrigger");
}
advance(artboard, elapsed)
{
var _animationEvents = [];
var _currLayerAnim = this._SmileTime;
this._SmileTime += elapsed * 1;
this._ProgressTracker.triggerEvents(artboard._Components, _currLayerAnim, this._SmileTime, _animationEvents);
for (let event in _animationEvents)
{
switch (_animationEvents[event].name)
{
case "Event":
///play our sound when the event happens
break;
}
}
return true;
}
function _Advance(_This)
{
...
const actor = _This._ActorInstance;
...
if (actor)
{
if (_This._ProgressTracker)
{
_This._ProgressTracker.triggerEvents(actor._Components, _currLayerAnim, _This._SmileTime, _animationEvents);
}
}
for (let event in _animationEvents)
{
//console.log(_animationEvents[event]);
switch (_animationEvents[event].name)
{
case "Event":
///play our sound when the event happens
_This._Song.play();
break;
}
}
}
FlareExample.prototype.setActor = function(actor)
{
...
this._ProgressTracker = actorInstance.getAnimation("Animation");
...
}
...
int main()
{
flare::ActorAnimation* eventAnimation = artboard->animation("Mustache_New");
eventAnimation->triggerEvents(artboard,currLayerAnim, animationTime, events);
}
...

Constraints

implements ActorConstraint class
You can trigger Constraints with a keyframe during your animation, which can run any custom code at runtime. Constraints can be attached to any object.