import os
from _bootstrap import ensure_skill_scripts_on_path
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
SKILL_ROOT, _ = ensure_skill_scripts_on_path(CURRENT_DIR)
from jy_wrapper import JyProject
HTML_TEMPLATE = """
Web VFX Intro
"""
def main() -> None:
project = JyProject(project_name="Web_To_Video_Intro_Demo", overwrite=True)
html_path = os.path.join(CURRENT_DIR, "__web_intro_demo.html")
with open(html_path, "w", encoding="utf-8") as f:
f.write(HTML_TEMPLATE)
print("Recording web animation and importing to timeline...")
seg = project.add_web_asset_safe(
html_path=html_path,
start_time="0s",
duration="5s",
track_name="VideoTrack",
)
if seg is None:
raise RuntimeError("Web-to-Video import failed.")
audio_path = os.path.join(SKILL_ROOT, "assets", "audio.mp3")
if os.path.exists(audio_path):
project.add_audio_safe(audio_path, start_time="0s", duration="5s", track_name="BGM_Track")
project.add_text_simple(
"Web to Video Intro",
start_time="0.4s",
duration="2.4s",
track_name="TitleTrack",
anim_in="复古打字机",
)
result = project.save()
print(f"Draft generated: {result.get('draft_path')}")
if __name__ == "__main__":
main()