This is a simple web-based application that allows you to write animations with an external Domain Specific Language, and then generate JS code to place on your own web apps.
The live application can be found here!
There are also some demo animations available here!
- Code Editor: Get compiling errors and warnings directly on the editor & console
- Animation Previewer: You can preview what the animation will look like before copying the generated code on your HTML/JS Apps
- Minimalist App: All you have to do is write some code and press a button! Easy as can be :)
Keyframes can be pictured as a state in which a particular shape will be in. One keyframe can be applied multiple times to multiple shapes.
Keyframe:
id: 1
type: slerp
color: red
scale: [1, 1]
rotation: 90
position: [30,30]
opacity: 100%
time: 2s
id
- this is UNIQUE, and this value will be used to reference this keyframetype
- can either belerp
(linear interpolation) orslerp
(spherical linear interpolation).color
- a simple color in hexadecimal form (i.e. #rrggbb) or in plain english text (i.e. red, orange, blue, ...)scale
- simple array[x, y]
coordinates, the finalx
andy
scale of the shape where this animation will be applied toposition
- simple array[x, y]
coordinates, which will be the canvas position where the shape will be in after the animation is overrotation
- rotation angle (clockwise and in degrees)opacity
- opacity of the shape in percentage (0-100%)time
- the amount of time (in seconds) that will take for a shape to be in this keyframe state
Shape:
id: ola
type: circle
color: #f48024
position: [200,200]
size: 100px
animation: [1, 3]
id
- this is UNIQUEtype
- can either becircle
,square
ortriangle
color
- a simple color in hexadecimal form (i.e. #rrggbb) or in plain english text (i.e. red, orange, blue, ...)size
- the size of the shape (in pixels)animation
- simple array with keyframe animationsid
s that will be executed in order.position
- simple array [x, y] coordinates, which will be the initial canvas position where the shape will be in
- TypeScript because using plain JS would be too easy!
- Parsimmon for DSL parsing and some syntax analysis
- React / CRA as a frontend framework for faster application development.
- Tailwind CSS as a style library for faster ✨ styling ✨ and component building!
This project is a very simple React Application, so it should be easy to navigate around.
All the "important" code is in the src/dsl
folder, that just receives and outputs regular strings to React Components!
You can find more information below!
.
├── craco.config.js # CRA config
├── demos # text files with demo animations
│ └── ...
├── package.json # Project dependencies
├── public # public assets
│ └── ...
├── README.md
├── src # source code folder
│ ├── assets # dynamic assets
│ ├── components # React components
│ ├── dsl # DSL code (parser, analyzer, generator and animation)
│ ├── index.tsx
│ ├── pages # web app pages
│ ├── react-app-env.d.ts
│ ├── reportWebVitals.ts
│ ├── setupTests.ts
│ └── styles # main css files
├── tailwind.config.js # tailwind CSS config
├── tsconfig.json # TypeScript Config
└── yarn.lock
- More customizable shapes (hexagons, and so on)
- Relative transformations:
- Use translation vectors instead of absolute canvas coordinates
- Accept new measure units:
time
could be represented in millisecondssize
could be represented withrem
s orem
s orcm
scolor
could also be represented in RGB(A) formatopacity
could be replaced with alpha value incolor
property
- Accept new animation types (for now we are just using keyframe animations)
- Provide more informative errors and warnings directly in the editor
- Support comments on language
- ✨ 3D canvas ✨
This project was bootstrapped with Create React App.
In the project directory, you can run:
yarn start
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
yarn build
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.