Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is the canvas animation on Apple watch site implemented?

In apple watch site:, you can see the section below when you scroll down a little bit:

enter image description here

The watch in the left is not a static picture but an attractive animation actually. When I view the DOM element in the inspector of Chrome, I find it is a canvas element:

enter image description here

When I check the downloaded files, I find images like this:

enter image description here

This looks quite cryptic for me. What is the name of the technique apple used here which can generate animation on canvas from cluttered pictures? Is there any libraries for doing this?

like image 669
Hanfei Sun Avatar asked Sep 18 '15 07:09

Hanfei Sun


1 Answers

Seems to me like they're using a custom algorithm, with each line of the image representing the animation for the relative line of the canvas.

But to confirm and/or simulate it, you should read the JavaScript source code (if it's not obfuscated too much).

like image 122
Zorgatone Avatar answered Oct 16 '22 17:10

Zorgatone