Added covers, cross-fade
This commit is contained in:
1 parent
0f2b2e55af
commit
e618c91415
29 files changed
+40462
-29
No files matched your search
@@ -240,6 +240,33 @@ namespace ZL {
|
||||
std::cerr << "[script] rotate_object: object '" << name << "' not found\n";
|
||||
});
|
||||
|
||||
// fade_object(name, target_alpha, duration_sec [, on_complete])
|
||||
api.set_function("fade_object",
|
||||
[game](const std::string& name, float targetAlpha,
|
||||
float durationSec, sol::object onComplete) {
|
||||
for (auto& intObj : game->interactiveObjects) {
|
||||
if (intObj.loadedObject.name != name) continue;
|
||||
if (intObj.isAnimating) {
|
||||
std::cerr << "[script] fade_object: '" << name << "' is already animating\n";
|
||||
return;
|
||||
}
|
||||
std::function<void()> cb;
|
||||
if (onComplete.is<sol::protected_function>()) {
|
||||
sol::protected_function fn = onComplete.as<sol::protected_function>();
|
||||
cb = [fn]() mutable {
|
||||
auto res = fn();
|
||||
if (!res.valid()) {
|
||||
sol::error err = res;
|
||||
std::cerr << "[script] fade_object on_complete error: " << err.what() << "\n";
|
||||
}
|
||||
};
|
||||
}
|
||||
intObj.fadeTo(targetAlpha, durationSec, std::move(cb));
|
||||
return;
|
||||
}
|
||||
std::cerr << "[script] fade_object: object '" << name << "' not found\n";
|
||||
});
|
||||
|
||||
// scale_object(name, target_scale, duration_sec [, on_complete])
|
||||
api.set_function("scale_object",
|
||||
[game](const std::string& name, float targetScale,
|
||||
|
||||
Reference in new issue
Block a user