AniFrame: A Programming Language for 2D Drawing and Frame-Based Animation

Mark Edward M. Gonzales,Hans Oswald A. Ibrahim,Elyssia Barrie H. Ong,Ryan Austin Fernandez
2024-04-16
Abstract: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
Programming Languages,Human-Computer Interaction,Multimedia
What problem does this paper attempt to address?
The main problem that this paper attempts to solve is that existing programming languages and libraries are not intuitive enough for beginners and are difficult to be used for creative coding, especially in terms of drawing and animation. Specifically: 1. **Complexity of Existing Tools**: Many existing creative coding languages and libraries (such as p5.js, Cinder, etc.) require users to have a certain programming foundation, and their syntax and semantics may not be intuitive enough for beginners. For example, p5.js uses curly braces to define code blocks, which is inherited from JavaScript, and Cinder interfaces with OpenGL, which is a steep learning curve for programmers without experience in graphics APIs. 2. **Obstacles of Object - Oriented Programming**: Most existing domain - specific languages in the animation field (such as ActionScript 3.0 and Processing) follow the object - oriented programming paradigm. Although this helps in structuring and modularizing the code, it is too complicated for simple drawing and animation tasks and increases the learning difficulty for beginners. 3. **Lack of Fine - Grained Control**: Existing tools are usually not flexible enough in animation control and cannot provide fine - grained control, such as explicitly specifying the target object of the animation and its starting and ending frames. 4. **High Learning Curve**: The learning curve of existing tools is relatively high. Especially for beginners without a programming background or with less experience, it takes a lot of time and energy to master these tools. To solve these problems, the author proposes AniFrame, a domain - specific language (DSL) designed specifically for 2D drawing and frame - based animation. The main features of AniFrame include: - **Support for Animation - Specific Constructions**: It provides animation - specific data types (such as color, coordinates), operations (such as color mixing, simplified object combination), and built - in functions (such as shapes and affine transformations). - **Fine - Grained Control**: It adopts a frame - based strategy. Programmers can explicitly specify the objects to be animated as well as the starting and ending frames of the animation sequence. They can also configure the frame rate and the total number of frames. - **Reducing the Learning Curve**: It adopts a Python - like syntax, limits the number of keywords and control structures, and tries to make the keywords close to their semantic intentions (for example, using `Text` instead of `string`). Type inference makes specifying data types optional. - **Computational Expressive Power**: It supports common mathematical operations, built - in trigonometric functions, and user - defined recursive functions to achieve complex animation effects, such as fractals. Through these features, AniFrame aims to provide beginners with a more intuitive, easy - to - learn, and powerful creative coding tool, thereby promoting the development of artistic expression and computational thinking.