我创建了一个包含 3 个状态动画的 .riv 文件:开始、处理、结束,它们位于“状态机”中。Rive 团队最近宣布了一项具有动态变化动画的新功能,它就是“状态机”。不确定如何在flutter项目中使用它,即如何动态改变动画的值。如果有人需要一些代码,没问题,我可以提供。此外,链接到 rive 的“状态机” https://www.youtube.com/watch?v=0ihqZANziCk。我没有找到与此新功能相关的任何示例。请帮忙!谢谢。
由于以下异常,无法运行 flutter 应用程序
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':rive_common:buildCMakeDebug[arm64-v8a]'.
> Build command failed.
Error while executing process /home/toku/Android/Sdk/cmake/3.18.1/bin/ninja with arguments {-C /home/toku/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/rive_common-0.0.1/android/.cxx/Debug/2c2j2ru1/arm64-v8a rive_text}
ninja: Entering directory `/home/toku/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/rive_common-0.0.1/android/.cxx/Debug/2c2j2ru1/arm64-v8a'
[1/63] Building CXX object CMakeFiles/rive_text.dir/home/toku/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/rive_common-0.0.1/ios/rive-cpp/src/rive_counter.cpp.o
FAILED: CMakeFiles/rive_text.dir/home/toku/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/rive_common-0.0.1/ios/rive-cpp/src/rive_counter.cpp.o
In file included from /home/toku/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/rive_common-0.0.1/ios/rive-cpp/src/rive_counter.cpp:5:
In file included from ../../../../../ios/rive-cpp/include/rive/rive_counter.hpp:8:
In file included from ../../../../../ios/rive-cpp/include/rive/rive_types.hpp:59:
/snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Run Code Online (Sandbox Code Playgroud)
我使用的是flutter版本3.3.10,rive:^0.10.0,
我已经完成了 …
我需要制作一个10-15分钟的配音动画。据我所知,lottie 和 rive 的动画不支持音频。将音轨与动画并行运行是一个好的解决方案吗?有人担心可能会出现不同步。有人解决过类似的问题吗?
我是 flutter 新手,对此一无所知,我从 rive 应用程序创建了一个简单的设计,并尝试在 flutter 应用程序上运行,但动画不运行。我从 flutter 下载的动画作品很少起作用,有些不起作用,下面链接上的一个也不起作用。它只是静态的 png 图像。我尝试将动画名称更改为idle或center,但仍然不起作用。
这是我正在使用的代码,
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:rive/rive.dart';
class ExampleAnimation extends StatefulWidget {
const ExampleAnimation({Key? key}) : super(key: key);
@override
_ExampleAnimationState createState() => _ExampleAnimationState();
}
class _ExampleAnimationState extends State<ExampleAnimation> {
void _togglePlay() {
if (_controller == null) {
return;
}
setState(() => _controller!.isActive = !_controller!.isActive);
}
bool get isPlaying => _controller?.isActive ?? false;
Artboard? _riveArtboard;
RiveAnimationController? _controller;
@override
void initState() {
super.initState();
rootBundle.load('assets/rive/new.riv').then(
(data) async …Run Code Online (Sandbox Code Playgroud) 更新:我在底部添加了一个 codesanbox,其中更详细地说明了我需要做什么。
所以我不太了解 React 中的类是如何工作的,我是 React 的新手并且使用过 useState 一点点,但从来不知道如何处理类。我正在使用这个 react 包,它有一个示例,说明如何使用控制器使您使用现在称为 rive 的flare 构建交互式动画。https://github.com/2d-inc/Flare-React#readme
我想要实现的是当我将鼠标悬停在生成的画布元素上时,要么运行不同的动画,要么再次运行相同的动画。我可以在 flate(rive) 中创建第二个动画,它仍然会在同一个 .flr 文件中输出,然后我应该能够在控制器中引用它并在悬停时运行它,只是坚持如何做那部分,或者甚至让这个控制器工作。需要注意的一件事是我可以让动画在没有控制器的情况下正常运行。
在文档中,他们有这个示例代码
class PenguinController extends FlareComponent.Controller
{
constructor()
{
super();
this._MusicWalk = null;
this._Walk = null;
this._WalkTime = 0;
}
initialize(artboard)
{
this._MusicWalk = artboard.getAnimation("music_walk");
this._Walk = artboard.getAnimation("walk");
}
advance(artboard, elapsed)
{
// advance the walk time
this._WalkTime += elapsed;
const { _MusicWalk: musicWalk, _Walk: walk, _WalkTime: walkTime } = this;
// mix the two animations together by applying …Run Code Online (Sandbox Code Playgroud) 众所周知,Rive是一个非常有用的动画工具,可以创建漂亮的动画,我们可以将这些动画添加到我们的应用程序中。但是我们如何使用Rive App 和flare_flutter 插件来实现以及如何创建一个超酷的动画呢?
我刚刚为我的 flutter 小部件成功 flutter-flare
但我找不到将其用于背景(容器)的示例
这可能吗?