Back to project page unknown-pleasures.
The source code is released under:
Creative Commons Attribution NonCommercial NoDerivs (CC-NC-ND) THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTE...
If you think the Android project unknown-pleasures listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/** * OriginalCover.java/*from w ww . j a v a 2s. co m*/ * Author: marek.brodziak@gmail.com * Created: Jun 2, 2014 * Copyright 2014 by miniti */ package pl.miniti.android.pleasures.animation; import java.util.ArrayList; import java.util.Collections; import java.util.List; import android.graphics.Path; /** * Delivers a set of paths defining the original Unknown Pleasures album cover */ public class OriginalCover { /** * Number of rendered lines */ public static final int SIZE = 80; /** * List of all cover paths, limited by SIZE */ private static final List<Path> paths = new ArrayList<Path>(); /** * Array of x values for each cover line */ private static final float[][] X = new float[SIZE][]; /** * Array of y values for each cover line */ private static final float[][] Y = new float[SIZE][]; // statically initialize the cover static { X[0] = of(0f, 0.37f, .46f, .52f, .62f, .7f, 2f); Y[0] = of(0f, 0f, -.055f, -0.03f, -0.05f, 0f, 0f); X[1] = of(0f, .26f, .35f, .45f, .52f, .67f, .73f, 2f); Y[1] = of(0f, 0f, -.06f, -.035f, -.02f, -.035f, 0f, 0f); X[2] = of(0f, .31f, .39f, .43f, .51f, .7f, 2f); Y[2] = of(0f, 0f, -.1f, -.035f, -.068f, 0f, 0f); X[3] = of(0f, .35f, .42f, .48f, .52f, .55f, .6f, .65f, 2f); Y[3] = of(0f, 0f, -.12f, -.03f, -.07f, -.028f, -.06f, 0f, 0f); X[4] = of(0f, .32f, .39f, .42f, .45f, .52f, .53f, .57f, .61f, .7f, 2f); Y[4] = of(0f, 0f, -.06f, -.035f, -.05f, -.01f, -.02f, -.015f, -.06f, 0f, 0f); X[5] = of(0f, .32f, .37f, .47f, .58f, .63f, .71f, 2f); Y[5] = of(0f, 0f, -.08f, 0f, 0f, -.03f, 0f, 0f); X[6] = of(0f, .29f, .32f, .54f, .63f, .75f, 2f); Y[6] = of(0f, 0f, -.068f, -.03f, -.058f, 0f, 0f); X[7] = of(0f, .28f, .35f, .39f, .48f, .52f, 2f); Y[7] = of(0f, 0f, -.07f, -.127f, -.03f, 0f, 0f); X[8] = of(2f); Y[8] = of(); X[9] = of(0f, .35f, .41f, .45f, .5f, .55f, .61f, .7f, 2f); Y[9] = of(0f, 0f, -.08f, -.07f, -.04f, -.08f, -.04f, 0f, 0f); X[10] = of(0f, .28f, .33f, .35f, .39f, .41f, .45f, .5f, .6f, 0.62f, 0.72f, 2f); Y[10] = of(0f, 0f, -.13f, -.1f, -.14f, -.05f, -.07f, -.035f, -.036f, -.065f, 0f, 0f); X[11] = of(0f, .25f, .32f, .37f, .4f, .45f, .495f, .57f, .61f, 0.73f, 2f); Y[11] = of(0f, 0f, -.07f, -.075f, -.09f, -.05f, -.06f, -.035f, -.04f, 0f, 0f); X[12] = of(0f, .35f, .41f, .5f, .55f, .65f, 2f); Y[12] = of(0f, 0f, -.08f, -.06f, -.09f, 0f, 0f); X[13] = of(0f, .3f, .44f, .49f, .56f, .61f, .66f, 2f); Y[13] = of(0f, 0f, -.068f, -.04f, -.03f, -.07f, 0f, 0f); X[14] = of(0f, .26f, .31f, .41f, .45f, .55f, .62f, .72f, 2f); Y[14] = of(0f, 0f, -.075f, -.055f, -.07f, -.02f, -.085f, 0f, 0f); X[15] = of(0f, .27f, .35f, .39f, .75f, 2f); Y[15] = of(0f, 0f, -.08f, -.013f, 0f, 0f); X[16] = of(0f, .28f, .39f, .5f, .53f, .6f, .62f, 2f); Y[16] = of(0f, 0f, -.06f, -.03f, -.07f, -.06f, 0f, 0f); X[17] = of(0f, .4f, .52f, .55f, .6f, .7f, 2f); Y[17] = of(0f, 0f, -.07f, -.05f, -.07f, 0f, 0f); X[18] = of(0f, .25f, .34f, .41f, .49f, .55f, .6f, .63f, .66f, .71f, 2f); Y[18] = of(0f, 0f, -.08f, -.06f, -.15f, -.02f, -.06f, -.02f, -.055f, 0f, 0f); X[19] = of(0f, .3f, .4f, .45f, .61f, .74f, 2f); Y[19] = of(0f, 0f, -.16f, -.035f, -.05f, 0f, 0f); X[20] = of(0f, .37f, .46f, .51f, .54f, .65f, 2f); Y[20] = of(0f, 0f, -.07f, -.05f, -.065f, 0f, 0f); X[21] = of(0f, .35f, .44f, .52f, 2f); Y[21] = of(0f, 0f, -.145f, 0f, 0f); X[22] = of(0f, .31f, .39f, .41f, .45f, .51f, 2f); Y[22] = of(0f, 0f, -.08f, -.03f, -.075f, 0f, 0f); X[23] = of(0f, .28f, .35f, .4f, .49f, .58f, .63f, .78f, 2f); Y[23] = of(0f, 0f, -.08f, -.04f, -.06f, -.04f, -.06f, 0f, 0f); X[24] = of(0f, .3f, .39f, .66f, 2f); Y[24] = of(0f, 0f, -.08f, 0f, 0f); X[25] = of(0f, .31f, .43f, .535f, .59f, .66f, 2f); Y[25] = of(0f, 0f, -0.15f, -.035f, -.09f, 0f, 0f); X[26] = of(0f, .3f, .4f, .65f, .72f, 2f); Y[26] = of(0f, 0f, -.035f, -.04f, 0f, 0f); X[27] = of(0f, .29f, .345f, .43f, .49f, .52f, .65f, .74f, 2f); Y[27] = of(0f, 0f, -.17f, -.06f, -.08f, -.04f, -.065f, 0f, 0f); X[28] = of(0f, .3f, .39f, .42f, .7f, 2f); Y[28] = of(0f, 0f, -.12f, -.04f, 0f, 0f); X[29] = of(0f, .34f, .43f, .5f, .6f, 2f); Y[29] = of(0f, 0f, -.11f, -.05f, 0f, 0f); X[30] = of(0f, .31f, .42f, .51f, .57f, .63f, .69f, 2f); Y[30] = of(0f, 0f, -.07f, -.035f, -.08f, -.09f, 0f, 0f); X[31] = of(0f, .27f, .33f, .39f, .45f, .49f, .56f, .63f, .7f, 2f); Y[31] = of(0f, 0f, -.13f, -.07f, -.095f, -.08f, -.05f, -.08f, 0f, 0f); X[32] = of(0f, .25f, .33f, .4f, .58f, .63f, .77f, 2f); Y[32] = of(0f, 0f, -.07f, -.095f, -.035f, -.05f, 0f, 0f); X[33] = of(0f, .32f, .42f, .69f, 2f); Y[33] = of(0f, 0f, -.09f, 0f, 0f); X[34] = of(0f, .28f, .38f, .42f, .45f, .55f, .61f, .68f, 2f); Y[34] = of(0f, 0f, -.06f, -.02f, -.1f, -.03f, -.06f, 0f, 0f); X[35] = of(0f, .27f, .345f, .55f, .64f, .76f, 2f); Y[35] = of(0f, 0f, -.07f, -.02f, -.06f, 0f, 0f); X[36] = of(0f, .28f, .32f, .48f, .58f, .64f, .73f, 2f); Y[36] = of(0f, 0f, -.065f, -.06f, -.03f, -.055f, 0f, 0f); X[37] = of(0f, .335f, .435f, .49f, .63f, 2f); Y[37] = of(0f, 0f, -.1f, -.06f, 0f, 0f); X[38] = of(0f, .38f, .45f, .54f, .62f, .7f, 2f); Y[38] = of(0f, 0f, -.05f, -.005f, -.06f, 0f, 0f); X[39] = of(0f, .56f, .64f, .68f, 2f); Y[39] = of(0f, 0f, -.04f, 0f, 0f); X[40] = of(0f, .38f, .47f, .73f, 2f); Y[40] = of(0f, 0f, -.07f, 0f, 0f); X[41] = of(2f); Y[41] = of(); X[42] = of(0f, .3f, .4f, .71f, 2f); Y[42] = of(0f, 0f, -.1f, 0f, 0f); X[43] = of(0f, .26f, .44f, .52f, .57f, .7f, 2f); Y[43] = of(0f, 0f, -.08f, -.05f, -.08f, 0f, 0f); X[44] = of(0f, .3f, .38f, .48f, 2f); Y[44] = of(0f, 0f, -.15f, 0f, 0f); X[45] = of(0f, .29f, .48f, .57f, .65f, .73f, 2f); Y[45] = of(0f, 0f, -.09f, -.06f, -.074f, 0f, 0f); X[46] = of(0f, .27f, .41f, .56f, .63f, .76f, 2f); Y[46] = of(0f, 0f, -.07f, -.025f, -.08f, 0f, 0f); X[47] = of(2f); Y[47] = of(); X[48] = of(0f, .3f, .37f, .5f, .575f, .68f, 2f); Y[48] = of(0f, 0f, -.12f, -.085f, -.1f, 0f, 0f); X[49] = of(2f); Y[49] = of(); X[50] = of(0f, .28f, .355f, .44f, 2f); Y[50] = of(0f, 0f, -.15f, 0f, 0f); X[51] = of(0f, .26f, .37f, .45f, .5f, .63f, .76f, 2f); Y[51] = of(0f, 0f, -.07f, -.16f, -.09f, -.091f, 0f, 0f); X[52] = of(0f, .3f, .43f, .57f, 2f); Y[52] = of(0f, 0f, -.1f, 0f, 0f); X[53] = of(0f, .28f, .34f, .4f, .46f, .51f, .56f, .71f, 2f); Y[53] = of(0f, 0f, -.09f, -.04f, -.09f, -.05f, -.1f, 0f, 0f); X[54] = of(0f, .28f, .34f, .55f, .59f, .65f, .78f, 2f); Y[54] = of(0f, 0f, -.08f, -.035f, -.07f, -.08f, 0f, 0f); X[55] = of(0f, .3f, .35f, .37f, .4f, .48f, .68f, .77f, 2f); Y[55] = of(0f, 0f, -.065f, -.05f, -.09f, -.05f, -.051f, 0f, 0f); X[56] = of(0f, .28f, .45f, .52f, .7f, 2f); Y[56] = of(0f, 0f, -.11f, -.07f, 0f, 0f); X[57] = of(0f, .24f, .34f, .4f, .47f, .54f, .74f, 2f); Y[57] = of(0f, 0f, -.06f, -.03f, -.085f, -.03f, 0f, 0f); X[58] = of(0f, .28f, .35f, .41f, .48f, .55f, .65f, .76f, 2f); Y[58] = of(0f, 0f, -.09f, -.03f, -.087f, -.03f, -.07f, 0f, 0f); X[59] = of(0f, .27f, .395f, .49f, .72f, 2f); Y[59] = of(0f, 0f, -.07f, -.05f, 0f, 0f); X[60] = of(0f, .26f, .45f, .7f, 2f); Y[60] = of(0f, 0f, -.07f, 0f, 0f); X[61] = of(0f, .23f, .37f, .54f, .66f, .74f, 2f); Y[61] = of(0f, 0f, -.06f, -.02f, -.05f, 0f, 0f); X[62] = of(0f, .29f, .39f, .48f, .64f, .75f, 2f); Y[62] = of(0f, 0f, -.11f, -.02f, -.021f, 0f, 0f); X[63] = of(0f, .33f, .44f, .52f, .7f, 2f); Y[63] = of(0f, 0f, -.1f, -.04f, 0f, 0f); X[64] = of(0f, .27f, .33f, .55f, .63f, .7f, 2f); Y[64] = of(0f, 0f, -.07f, -.02f, -.04f, 0f, 0f); X[65] = of(0f, .27f, .39f, .5f, .63f, .76f, 2f); Y[65] = of(0f, 0f, -.07f, -.02f, -.05f, 0f, 0f); X[66] = of(0f, .34f, .43f, .49f, .75f, 2f); Y[66] = of(0f, 0f, -.09f, -.03f, 0f, 0f); X[67] = of(0f, .28f, .35f, .4f, .44f, .47f, .55f, .64f, 2f); Y[67] = of(0f, 0f, -.06f, -.04f, -.06f, -.04f, -.039f, 0f, 0f); X[68] = of(0f, .29f, .34f, .37f, .4f, .44f, .48f, .56f, .65f, .77f, 2f); Y[68] = of(0f, 0f, -.07f, -.06f, -.08f, -.06f, -.07f, -.04f, -.05f, 0f, 0f); X[69] = of(0f, .35f, .43f, .51f, .59f, .67f, 2f); Y[69] = of(0f, 0f, -.08f, -.05f, -.07f, 0f, 0f); X[70] = of(0f, .27f, .36f, .44f, .71f, 2f); Y[70] = of(0f, 0f, -.08f, -.05f, 0f, 0f); X[71] = of(0f, .27f, .36f, .44f, .71f, 2f); Y[71] = of(0f, 0f, -.07f, -.04f, 0f, 0f); X[72] = of(0f, .26f, .31f, .38f, .44f, .5f, 2f); Y[72] = of(0f, 0f, -.06f, -.03f, -.04f, 0f, 0f); X[73] = of(0f, .38f, .48f, .54f, .63f, .74f, 2f); Y[73] = of(0f, 0f, -.05f, -.02f, -.06f, 0f, 0f); X[74] = of(0f, .27f, .35f, .45f, 2f); Y[74] = of(0f, 0f, -.08f, 0f, 0f); X[75] = of(0f, .3f, .37f, .46f, 2f); Y[75] = of(0f, 0f, -.2f, 0f, 0f); X[76] = of(0f, .28f, .4f, .52f, .65f, .74f, 2f); Y[76] = of(0f, 0f, -.09f, -.03f, -.04f, 0f, 0f); X[77] = of(0f, .36f, .45f, .55f, 2f); Y[77] = of(0f, 0f, -.04f, 0f, 0f); X[78] = of(0f, .29f, .34f, .46f, .59f, .66f, .7f, 2f); Y[78] = of(0f, 0f, -.07f, -.05f, -.02f, -.07f, 0f, 0f); X[79] = of(2f); Y[79] = of(); for (int i = 0; i < SIZE; ++i) { paths.add(AnimatorUtil.peeks(X[i], Y[i], 0f)); } } /** * List of original cover paths * * @return statically calculated original cover */ public static final List<Path> paths() { return Collections.unmodifiableList(paths); } /** * Returns original cover paths which may be widened by a given offset * * @param xOffset * widen by offset * @return list of calculated paths */ public static final List<Path> paths(float xOffset) { List<Path> offseted = new ArrayList<Path>(); for (int i = 0; i < SIZE; ++i) { offseted.add(AnimatorUtil.peeks(X[i], Y[i], xOffset)); } return offseted; } /** * Makes the code a bit cleaner * * @param fs * array of floats * @return array of floats... */ private static float[] of(float... fs) { return fs; } }