Browse Source

Go back to the old ear-wiggling Android animation.

But keep the new code so we can easily test new animations when we have them.

This change includes tbao's de-interlace script, plus a one-liner that's
necessary to play the animation at the correct speed when there's no
progress bar showing. (This was always a bug, it's just way more noticeable
when your animation only has 7 frames.)

Bug: http://b/28316654
Bug: http://b/26548285
Change-Id: I32c601c352d6be235d1b44f14fca7e125defd77d
Elliott Hughes 5 years ago
parent
commit
692941be79
100 changed files with 48 additions and 14 deletions
  1. 48
    14
      interlace-frames.py
  2. BIN
      res-hdpi/images/loop00.png
  3. BIN
      res-hdpi/images/loop01.png
  4. BIN
      res-hdpi/images/loop02.png
  5. BIN
      res-hdpi/images/loop03.png
  6. BIN
      res-hdpi/images/loop04.png
  7. BIN
      res-hdpi/images/loop05.png
  8. BIN
      res-hdpi/images/loop06.png
  9. BIN
      res-hdpi/images/loop07.png
  10. BIN
      res-hdpi/images/loop08.png
  11. BIN
      res-hdpi/images/loop09.png
  12. BIN
      res-hdpi/images/loop10.png
  13. BIN
      res-hdpi/images/loop11.png
  14. BIN
      res-hdpi/images/loop12.png
  15. BIN
      res-hdpi/images/loop13.png
  16. BIN
      res-hdpi/images/loop14.png
  17. BIN
      res-hdpi/images/loop15.png
  18. BIN
      res-hdpi/images/loop16.png
  19. BIN
      res-hdpi/images/loop17.png
  20. BIN
      res-hdpi/images/loop18.png
  21. BIN
      res-hdpi/images/loop19.png
  22. BIN
      res-hdpi/images/loop20.png
  23. BIN
      res-hdpi/images/loop21.png
  24. BIN
      res-hdpi/images/loop22.png
  25. BIN
      res-hdpi/images/loop23.png
  26. BIN
      res-hdpi/images/loop24.png
  27. BIN
      res-hdpi/images/loop25.png
  28. BIN
      res-hdpi/images/loop26.png
  29. BIN
      res-hdpi/images/loop27.png
  30. BIN
      res-hdpi/images/loop28.png
  31. BIN
      res-hdpi/images/loop29.png
  32. BIN
      res-hdpi/images/loop30.png
  33. BIN
      res-hdpi/images/loop31.png
  34. BIN
      res-hdpi/images/loop32.png
  35. BIN
      res-hdpi/images/loop33.png
  36. BIN
      res-hdpi/images/loop34.png
  37. BIN
      res-hdpi/images/loop35.png
  38. BIN
      res-hdpi/images/loop36.png
  39. BIN
      res-hdpi/images/loop37.png
  40. BIN
      res-hdpi/images/loop38.png
  41. BIN
      res-hdpi/images/loop39.png
  42. BIN
      res-hdpi/images/loop40.png
  43. BIN
      res-hdpi/images/loop41.png
  44. BIN
      res-hdpi/images/loop42.png
  45. BIN
      res-hdpi/images/loop43.png
  46. BIN
      res-hdpi/images/loop44.png
  47. BIN
      res-hdpi/images/loop45.png
  48. BIN
      res-hdpi/images/loop46.png
  49. BIN
      res-hdpi/images/loop47.png
  50. BIN
      res-hdpi/images/loop48.png
  51. BIN
      res-hdpi/images/loop49.png
  52. BIN
      res-hdpi/images/loop50.png
  53. BIN
      res-hdpi/images/loop51.png
  54. BIN
      res-hdpi/images/loop52.png
  55. BIN
      res-hdpi/images/loop53.png
  56. BIN
      res-hdpi/images/loop54.png
  57. BIN
      res-hdpi/images/loop55.png
  58. BIN
      res-hdpi/images/loop56.png
  59. BIN
      res-hdpi/images/loop57.png
  60. BIN
      res-hdpi/images/loop58.png
  61. BIN
      res-hdpi/images/loop59.png
  62. BIN
      res-hdpi/images/loop60.png
  63. BIN
      res-hdpi/images/loop61.png
  64. BIN
      res-hdpi/images/loop62.png
  65. BIN
      res-hdpi/images/loop63.png
  66. BIN
      res-hdpi/images/loop64.png
  67. BIN
      res-hdpi/images/loop65.png
  68. BIN
      res-hdpi/images/loop66.png
  69. BIN
      res-hdpi/images/loop67.png
  70. BIN
      res-hdpi/images/loop68.png
  71. BIN
      res-hdpi/images/loop69.png
  72. BIN
      res-hdpi/images/loop70.png
  73. BIN
      res-hdpi/images/loop71.png
  74. BIN
      res-hdpi/images/loop72.png
  75. BIN
      res-hdpi/images/loop73.png
  76. BIN
      res-hdpi/images/loop74.png
  77. BIN
      res-hdpi/images/loop75.png
  78. BIN
      res-hdpi/images/loop76.png
  79. BIN
      res-hdpi/images/loop77.png
  80. BIN
      res-hdpi/images/loop78.png
  81. BIN
      res-hdpi/images/loop79.png
  82. BIN
      res-hdpi/images/loop80.png
  83. BIN
      res-hdpi/images/loop81.png
  84. BIN
      res-hdpi/images/loop82.png
  85. BIN
      res-hdpi/images/loop83.png
  86. BIN
      res-hdpi/images/loop84.png
  87. BIN
      res-hdpi/images/loop85.png
  88. BIN
      res-hdpi/images/loop86.png
  89. BIN
      res-hdpi/images/loop87.png
  90. BIN
      res-hdpi/images/loop88.png
  91. BIN
      res-hdpi/images/loop89.png
  92. BIN
      res-hdpi/images/loop90.png
  93. BIN
      res-mdpi/images/loop00.png
  94. BIN
      res-mdpi/images/loop01.png
  95. BIN
      res-mdpi/images/loop02.png
  96. BIN
      res-mdpi/images/loop03.png
  97. BIN
      res-mdpi/images/loop04.png
  98. BIN
      res-mdpi/images/loop05.png
  99. BIN
      res-mdpi/images/loop06.png
  100. 0
    0
      res-mdpi/images/loop07.png

+ 48
- 14
interlace-frames.py View File

@@ -1,3 +1,4 @@
1
+#!/usr/bin/env python
1 2
 # Copyright (C) 2014 The Android Open Source Project
2 3
 #
3 4
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,19 +14,16 @@
13 14
 # limitations under the License.
14 15
 
15 16
 """
16
-Script to take a set of frames (PNG files) for a recovery animation and turn
17
-it into a single output image which contains the input frames interlaced by
18
-row. Run with the names of all the input frames on the command line. Specify
19
-the name of the output file with -o (or --output), and optionally specify the
20
-number of frames per second (FPS) with --fps (default: 20).
21
-
22
-e.g.
23
-interlace-frames.py --fps 20 --output output.png frame0.png frame1.png frame3.png
17
+Script to take a set of frames (PNG files) for a recovery animation
18
+and turn it into a single output image which contains the input frames
19
+interlaced by row.  Run with the names of all the input frames on the
20
+command line, in order, followed by the name of the output file.
24 21
 """
25 22
 
26 23
 from __future__ import print_function
27 24
 
28 25
 import argparse
26
+import os.path
29 27
 import sys
30 28
 try:
31 29
   import Image
@@ -35,7 +33,7 @@ except ImportError:
35 33
   sys.exit(1)
36 34
 
37 35
 
38
-def interlace(output, fps, inputs):
36
+def interlace(output, inputs):
39 37
   frames = [Image.open(fn).convert("RGB") for fn in inputs]
40 38
   assert len(frames) > 0, "Must have at least one input frame."
41 39
   sizes = set()
@@ -60,21 +58,57 @@ def interlace(output, fps, inputs):
60 58
 
61 59
   meta = PngImagePlugin.PngInfo()
62 60
   meta.add_text("Frames", str(N))
63
-  meta.add_text("FPS", str(fps))
64 61
 
65 62
   out.save(output, pnginfo=meta)
66 63
 
67 64
 
65
+def deinterlace(output, input):
66
+  # Truncate the output filename extension if it's '.png'.
67
+  if os.path.splitext(output)[1].lower() == '.png':
68
+    output = output[:-4]
69
+
70
+  img2 = Image.open(input)
71
+  print(img2.mode)
72
+  palette = img2.getpalette()
73
+  img = img2.convert("RGB")
74
+  num_frames = int(img.info.get('Frames', 1))
75
+  print('Found %d frames in %s.' % (num_frames, input))
76
+  assert num_frames > 0, 'Invalid Frames meta.'
77
+
78
+  # palette = img.getpalette()
79
+  print(palette)
80
+
81
+  width, height = img.size
82
+  height /= num_frames
83
+  for k in range(num_frames):
84
+    out = Image.new('RGB', (width, height))
85
+    out.info = img.info
86
+    for i in range(width):
87
+      for j in range(height):
88
+        out.putpixel((i, j), img.getpixel((i, j * num_frames + k)))
89
+    # out.putpalette(img.getpalette(), rawmode='RGB')
90
+    out2 = out.convert(mode='P', palette=palette)
91
+    #out2 = out
92
+    print(out2.mode)
93
+    # out2.putpalette(palette)
94
+    filename = '%s%02d.png' % (output, k)
95
+    out2.save(filename)
96
+    print('Frame %d written to %s.' % (k, filename))
97
+
98
+
68 99
 def main(argv):
69
-  parser = argparse.ArgumentParser()
70
-  parser.add_argument('--fps', default=20)
100
+  parser = argparse.ArgumentParser(description='Parse')
101
+  parser.add_argument('--deinterlace', '-d', action='store_true')
71 102
   parser.add_argument('--output', '-o', required=True)
72 103
   parser.add_argument('input', nargs='+')
73 104
   args = parser.parse_args(argv)
74 105
 
75
-  interlace(args.output, args.fps, args.input)
106
+  if args.deinterlace:
107
+    # args.input is a list, and we only process the first when deinterlacing.
108
+    deinterlace(args.output, args.input[0])
109
+  else:
110
+    interlace(args.output, args.input)
76 111
 
77 112
 
78 113
 if __name__ == '__main__':
79 114
   main(sys.argv[1:])
80
-

BIN
res-hdpi/images/loop00.png View File


BIN
res-hdpi/images/loop01.png View File


BIN
res-hdpi/images/loop02.png View File


BIN
res-hdpi/images/loop03.png View File


BIN
res-hdpi/images/loop04.png View File


BIN
res-hdpi/images/loop05.png View File


BIN
res-hdpi/images/loop06.png View File


BIN
res-hdpi/images/loop07.png View File


BIN
res-hdpi/images/loop08.png View File


BIN
res-hdpi/images/loop09.png View File


BIN
res-hdpi/images/loop10.png View File


BIN
res-hdpi/images/loop11.png View File


BIN
res-hdpi/images/loop12.png View File


BIN
res-hdpi/images/loop13.png View File


BIN
res-hdpi/images/loop14.png View File


BIN
res-hdpi/images/loop15.png View File


BIN
res-hdpi/images/loop16.png View File


BIN
res-hdpi/images/loop17.png View File


BIN
res-hdpi/images/loop18.png View File


BIN
res-hdpi/images/loop19.png View File


BIN
res-hdpi/images/loop20.png View File


BIN
res-hdpi/images/loop21.png View File


BIN
res-hdpi/images/loop22.png View File


BIN
res-hdpi/images/loop23.png View File


BIN
res-hdpi/images/loop24.png View File


BIN
res-hdpi/images/loop25.png View File


BIN
res-hdpi/images/loop26.png View File


BIN
res-hdpi/images/loop27.png View File


BIN
res-hdpi/images/loop28.png View File


BIN
res-hdpi/images/loop29.png View File


BIN
res-hdpi/images/loop30.png View File


BIN
res-hdpi/images/loop31.png View File


BIN
res-hdpi/images/loop32.png View File


BIN
res-hdpi/images/loop33.png View File


BIN
res-hdpi/images/loop34.png View File


BIN
res-hdpi/images/loop35.png View File


BIN
res-hdpi/images/loop36.png View File


BIN
res-hdpi/images/loop37.png View File


BIN
res-hdpi/images/loop38.png View File


BIN
res-hdpi/images/loop39.png View File


BIN
res-hdpi/images/loop40.png View File


BIN
res-hdpi/images/loop41.png View File


BIN
res-hdpi/images/loop42.png View File


BIN
res-hdpi/images/loop43.png View File


BIN
res-hdpi/images/loop44.png View File


BIN
res-hdpi/images/loop45.png View File


BIN
res-hdpi/images/loop46.png View File


BIN
res-hdpi/images/loop47.png View File


BIN
res-hdpi/images/loop48.png View File


BIN
res-hdpi/images/loop49.png View File


BIN
res-hdpi/images/loop50.png View File


BIN
res-hdpi/images/loop51.png View File


BIN
res-hdpi/images/loop52.png View File


BIN
res-hdpi/images/loop53.png View File


BIN
res-hdpi/images/loop54.png View File


BIN
res-hdpi/images/loop55.png View File


BIN
res-hdpi/images/loop56.png View File


BIN
res-hdpi/images/loop57.png View File


BIN
res-hdpi/images/loop58.png View File


BIN
res-hdpi/images/loop59.png View File


BIN
res-hdpi/images/loop60.png View File


BIN
res-hdpi/images/loop61.png View File


BIN
res-hdpi/images/loop62.png View File


BIN
res-hdpi/images/loop63.png View File


BIN
res-hdpi/images/loop64.png View File


BIN
res-hdpi/images/loop65.png View File


BIN
res-hdpi/images/loop66.png View File


BIN
res-hdpi/images/loop67.png View File


BIN
res-hdpi/images/loop68.png View File


BIN
res-hdpi/images/loop69.png View File


BIN
res-hdpi/images/loop70.png View File


BIN
res-hdpi/images/loop71.png View File


BIN
res-hdpi/images/loop72.png View File


BIN
res-hdpi/images/loop73.png View File


BIN
res-hdpi/images/loop74.png View File


BIN
res-hdpi/images/loop75.png View File


BIN
res-hdpi/images/loop76.png View File


BIN
res-hdpi/images/loop77.png View File


BIN
res-hdpi/images/loop78.png View File


BIN
res-hdpi/images/loop79.png View File


BIN
res-hdpi/images/loop80.png View File


BIN
res-hdpi/images/loop81.png View File


BIN
res-hdpi/images/loop82.png View File


BIN
res-hdpi/images/loop83.png View File


BIN
res-hdpi/images/loop84.png View File


BIN
res-hdpi/images/loop85.png View File


BIN
res-hdpi/images/loop86.png View File


BIN
res-hdpi/images/loop87.png View File


BIN
res-hdpi/images/loop88.png View File


BIN
res-hdpi/images/loop89.png View File


BIN
res-hdpi/images/loop90.png View File


BIN
res-mdpi/images/loop00.png View File


BIN
res-mdpi/images/loop01.png View File


BIN
res-mdpi/images/loop02.png View File


BIN
res-mdpi/images/loop03.png View File


BIN
res-mdpi/images/loop04.png View File


BIN
res-mdpi/images/loop05.png View File


BIN
res-mdpi/images/loop06.png View File


+ 0
- 0
res-mdpi/images/loop07.png View File


Some files were not shown because too many files changed in this diff