Monster Brain Dev Blog Android Dev. Game Dev. Web Hobbyist.

Lottie JSON Structure for Animation

Lottie (Link) is an awesome animation library for web, android and ios, for creating animation files from aftereffects. However if you want to edit a lottie json file, it’s hard because the keys were abbreviated so as to reduce the size I guess.

There’s no official record of this. So python lottie docs had done a good job of decoding the json keys. Here are the main keys, I’ve extracted from their site.

Animation

Lottie name Type Description Attribute
layers list of Layer List of Composition Layers.   layers
v str Bodymovin Version.   version
fr float Frames per second.   frame_rate
ip float The time when the composition work area begins, in frames.   in_point
op float The time when the composition work area ends.   out_point
w int Composition Width.   width
h int Composition Height.   height
nm str Composition name.   name
ddd 0-1 int Composition has 3-D layers.   threedimensional
assets list of Asset source items that can be used in multiple places.   assets
fonts FontList Available fonts.   fonts
chars list of Chars source chars for text layers   chars

Image

Lottie name Type Description Attribute
h float Image Height.   height
w float Image Width.   width
id str Image ID.   id
p str Image name.   image
u str Image path.   image_path
e 0-1 int Image data is stored as a data: url.   is_embedded

Transform

Lottie name Type Description Attribute
a MultiDimensional Transform Anchor Point.   anchor_point
p PositionValue Transform Position.   position
s MultiDimensional Transform Scale.   scale
r Value Transform Rotation.   rotation
o Value Transform Opacity.   opacity
sk Value Transform Skew.   skew
sa Value Transform Skew Axis.   skew_axis

MultiDimensional

Lottie name Type Description Attribute
k list of float Non-animated value.   value
ix int Property index.   property_index
a 0-1 int Whether it's animated.   animated
k list of OffsetKeyframe Keyframe list.   keyframes

For more properties

Find the full list of properties here

keywords: Lottie json, lottie structure,lottie json format, lottie json edit

Growing Todo List. Shrinking Time.

I’ve been keeping a github repo for the stuffs to do later (read, procrastinate forever :)). The list have been getting bigger and bigger, and the free time seems to be getting smaller and smaller. Time flies so fast. Maybe they are not that priority in my mind right now.

Feel free to check it out (why? Maybe It’ll inspire you to start your own)

Work to do List

*Feel free to contribute – never mind … *

Simple Star Rating Jquery Plugin

Stumbled across a small jquery plugin for showing star ratings on github. Decided to expand on it and make a demo page, so that people stumbling across can still find it useful. Thanks to the original author.

Here’s the Plugin demo

img

Forked from

View source / Contribute

*Feel free to contribute few todo stuffs *

Super Coder Web - A Game of Html + Css + Js

We are (or I am?) proud to announce yet another experimental and educational game in the beginning of the year 2019. Super Web Coder - A Game of Html + Css + Js, where you arrange the code to get the target website design as shown. Currently only a single demo level is available for playing. Your feedback is greatly appreciated.

Here’s the game in action

img

You can play it here

Inspired by

View the source on Github

Feel free to contribute new levels or fork it to use it for other coding or games as well

Thanks for playing!

UTF-8 encoding issue in spring MVC Ajax

Recently I needed to work with a spring mvc project, with non-english characters (malayalam characters for eg.) The MySQL database table was indeed utf-8 by default and we can directly enter the non-english characters in there easily. The problem being the response from the controller was being shown as a string of characters like ???.

So begins with this Stack Overflow answer, there was a blog page which offered three solutions. However the hosting was down, have to access it via wayback machine. I’m posting the first solution here, because many replied that’s the solution that worked for them.

Solution 1: Don’t use @ResponseBody. Return void in the controller, and use HtppServletResponse to return string with valid formatting.

here’s my code

@RequestMapping("getRandomArticle")
public void getRandomArticle(
	HttpServletRequest request, HttpServletResponse response) throws IOException {

	response.addHeader("Content-Type", "text/html;charset=UTF-8");
	response.setCharacterEncoding("UTF-8");
	
	List stuffs = dao.getRandomData();
	
	ServletOutputStream responseClient = response.getOutputStream();
	
	String jsonString = new Gson().toJson(stuffs.get(0));
	byte[] utf8JsonString = jsonString.getBytes("UTF-8");
	responseClient.write(utf8JsonString);
	responseClient.close();
}

I hope this is helpful for someone out there :)