AJYN Graphics Language - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

AJYN Graphics Language

Description:

AJYN Graphics Language. PLT Project by Group JAYN. Jared Kennedy. Ananya Das. Yaniv Schiller. Neel Goyal. May 13, 2003. AJYN Features ... – PowerPoint PPT presentation

Number of Views:68
Avg rating:3.0/5.0
Slides: 14
Provided by: labu316
Category:

less

Transcript and Presenter's Notes

Title: AJYN Graphics Language


1
AJYN Graphics Language
  • PLT Project by Group JAYN
  • Jared Kennedy
  • Ananya Das
  • Yaniv Schiller
  • Neel Goyal
  • May 13, 2003

2
AJYN Features
  • A simple graphics language to model animations.
  • Compilation outputs to swf format and plays using
    any Flash player.
  • Simple model of computation allows for quick
    learning and easy use.

3
Basic Graphics Overview
  • Graphics primitives
  • Points
  • Lines
  • Rectangles
  • Ellipses
  • Polygons
  • Transformations
  • Translations
  • Rotations
  • Scales

4
Language Functionality
  • Additional AJYN features
  • Grouping
  • Groups together various graphics primitives to be
    transformed and animated as a single unit.
  • Hiding objects
  • By declaring a given object invisible over a set
    period of frames, it can be hidden temporarily
    from the scene without needing to instantiate a
    new object.

5
AJYN Syntax
  • Initializing a program
  • Program name screen width, screen height,
    total frames
  • Declaring objects
  • point id x coordinate, y coordinate
  • line id x1 coord, y1 coord, x2 coord, y2
    coord
  • rect id upper-left x, upper-left y, rect width,
    rect height
  • ellipse id center x coord, center y coord, x
    radius, y radius
  • poly id x1 coord, y1 coord, x2 coord, y2 coord,
  • Grouping
  • group id obj1, obj2, objN, x coord, y coord

6
AJYN Syntax cont
  • Transforming Objects
  • translate(id, new x pos, new y pos, start frame,
    stop frame)
  • rotate(id, rotation degrees, start frame, stop
    frame)
  • scale(id, scale size, start frame, stop frame)
  • Hiding Objects
  • setInvisible(id, start frame, stop frame)
  • Comments
  • AJYN only supports commenting of single lines
  • Comments are denoted by //

7
Compilation Process
Source
ANTLR
IR File
Backend Application including Ming API
SWF (SWIFF) Output
8
Abstract Syntax Tree
The AST for out language is a linked list
containing the elements that go into creating the
animation. It has the follow structure
Program node
Contains info declared in the Program command
Contains a vector holding shapes with an ID
number and other object parameters
Object node
Contains a vector of nodes that contain group ID
numbers along with a vector of object IDs
Groups node
Contains a vector of transformation nodes that
act on objects referenced through their IDs
Functions node
Contains information about visibility of an
object from frame to frame
Visibility node
9
Intermediate Representation
  • Corresponding IR file
  • 01 3 500 500 2160
  • 02 0
  • 12 1 4 250 250 250 150 0 0 255
  • 12 2 4 250 250 250 350 255 255 255
  • 12 3 4 250 250 250 50 0 255 0
  • 12 4 4 250 250 250 450 255 255 255
  • 14 0 4 250 250 200 200 255 0 0
  • 03 0
  • 19 10 2 1 2 250 250
  • 19 11 2 3 4 250 250
  • 04 0
  • 22 11 3 4320 0 2160
  • 22 10 3 360 0 2160
  • 09 0
  • Example Code
  • Program Clock 500, 500, 2160
  • ActiveColor 0, 0, 255
  • line L1 250, 250, 250, 150
  • ActiveColor 255, 255, 255
  • line L2 250, 250, 250 350
  • ActiveColor 0, 255, 0
  • line L3 250, 250, 250, 50
  • ActiveColor 255, 255, 255
  • line L4 250, 250, 250, 450
  • ActiveColor 255, 0, 0
  • ellipse E1 250, 250, 200, 200
  • group hours L1, L2, 250 250
  • group minutes L3, L4, 250, 250
  • rotate(minutes, 4320 , 0, 2160)
  • rotate(hours, 360, 0, 2160)

10
Backend Compilation
Our point was not to reinvent the wheel, it was
to make animations easy to use. Ming, an open
source project located on Sourceforge, replaced
Macromedia in creating an open source API for swf
files. Ming, written in C, comes with extensions
for Java, PHP and C. AJYN uses this source to
compile the actual animation file. Ming does not
handle animations in a simple fashion. Objects
must be placed on a frame by frame basis. The
backend application accepts a file containing the
intermediate representation and produces the
animations without the complexities of Ming.
11
Backend Compilation cont
  • Basic backend algorithm
  • For each frame
  • Show the objects and groups that are
    visible
  • If animations
  • Reposition/Resize the affected objects
  • Backend complexities
  • Swf does not handle ellipses and circles. It
    only handles Bezier curves. Creating an ellipse
    requires the conversion from ellipse
    specifications to a group of curved lines.
  • Issues in making objects disappear, even
    mid-animation, and then reappear in the correct
    location.

12
Sample Source Code
//Test Code for a Simple Clock Program Clock
500, 500, 2160 ActiveColor 0, 0, 255 line
L1 250, 250, 250, 150 ActiveColor 255, 255,
255 line L2 250, 250, 250, 350 group hour
L1, L2, 250, 250 ActiveColor 0, 255, 0 line
L3 250, 250, 250, 50
//Test Code Continued. ActiveColor 255, 255,
255 line L4 250, 250, 250, 450 group mins
L3, L4, 250, 250 ActiveColor 255, 0,
0 ellipse E1 250, 250, 200,
200 rotate(mins, 4230, 0, 2160) rotate(hour,
360, 30, 2160)
13
Compiled SWF File
The amazing clock
Write a Comment
User Comments (0)
About PowerShow.com