Creative coding is an experimentation-heavy activity that requires translating high-level visual ideas into code. However, most languages and libraries for creative coding may not be adequately intuitive for beginners. In this paper, we present AniFrame, a domain-specific language for drawing and animation. Designed for novice programmers, it (i) features animation-specific data types, operations, and built-in functions to simplify the creation and animation of composite objects, (ii) allows for fine-grained control over animation sequences through explicit specification of the target object and the start and end frames, (iii) reduces the learning curve through a Python-like syntax, type inferencing, and a minimal set of control structures and keywords that map closely to their semantic intent, and (iv) promotes computational expressivity through support for common mathematical operations, built-in trigonometric functions, and user-defined recursion. Our usability test demonstrates AniFrame's potential to enhance readability and writability for multiple creative coding use cases. AniFrame is open-source, and its implementation and reference are available at https://github.com/memgonzales/aniframe-language.
翻译:创意编码是一项高度依赖实验的活动,要求将高层次视觉构思转化为代码。然而,大多数用于创意编码的语言和库对初学者而言可能不够直观。本文提出AniFrame,一种专用于绘图与动画的领域特定语言。该语言面向新手程序员,具有以下特点:(i) 提供动画专属数据类型、操作与内置函数,简化复合对象的创建与动画制作;(ii) 通过显式指定目标对象及起始帧与结束帧,实现对动画序列的精细控制;(iii) 采用类似Python的语法、类型推断机制以及一组与语义意图紧密映射的极简控制结构与关键字,降低学习曲线;以及(iv) 通过支持通用数学运算、内置三角函数及用户自定义递归,提升计算表达力。我们的可用性测试表明,AniFrame在多种创意编码用例中具有增强可读性与可写性的潜力。AniFrame为开源项目,其实现与参考文档参见 https://github.com/memgonzales/aniframe-language。