1 package net.miginfocom.layout;
7 * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (miglayout (at) miginfocom (dot) com)
10 * Redistribution and use in source and binary forms, with or without modification,
11 * are permitted provided that the following conditions are met:
12 * Redistributions of source code must retain the above copyright notice, this list
13 * of conditions and the following disclaimer.
14 * Redistributions in binary form must reproduce the above copyright notice, this
15 * list of conditions and the following disclaimer in the documentation and/or other
16 * materials provided with the distribution.
17 * Neither the name of the MiG InfoCom AB nor the names of its contributors may be
18 * used to endorse or promote products derived from this software without specific
19 * prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
27 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
35 import java.io.Serializable;
38 * @author Mikael Grev, MiG InfoCom AB
42 public class AnimSpec implements Serializable
44 // public static final AnimSpec OFF = new AnimSpec(-1, 0, 0);
45 public static final AnimSpec DEF = new AnimSpec(0, 0, 0.2f, 0.2f);
47 private final int prio;
48 private final int durMillis;
49 private final float easeIn, easeOut;
52 * @param prio The animation priority. When added with the general animation priority of the layout the animation will
53 * be done if the resulting value is > 0.
54 * @param durMillis Duration in milliseconds. <=0 means default value should be used and > 0 is the number of millis
55 * @param easeIn 0 is linear (no ease). 1 is max ease. Always clamped between these values.
56 * @param easeOut 0 is linear (no ease). 1 is max ease. Always clamped between these values.
58 public AnimSpec(int prio, int durMillis, float easeIn, float easeOut)
61 this.durMillis = durMillis;
62 this.easeIn = LayoutUtil.clamp(easeIn, 0, 1);
63 this.easeOut = LayoutUtil.clamp(easeOut, 0, 1);
67 * @return The animation priority. When added with the general animation priority of the layout the animation will
68 * be done if the resulting value is > 0.
70 public int getPriority()
76 * @param defMillis Default used if the millis in the spec is set to "default".
77 * @return Duration in milliseconds. <=0 means default value should be used and > 0 is the number of millis
79 public int getDurationMillis(int defMillis)
81 return durMillis > 0 ? durMillis : defMillis;
85 * @return Duration in milliseconds. <= 0 means default value should be used and > 0 is the number of millis
87 public int getDurationMillis()
93 * @return A value between 0 and 1 where 0 is no ease in and 1 is maximum ease in.
95 public float getEaseIn()
101 * @return A value between 0 and 1 where 0 is no ease out and 1 is maximum ease out.
103 public float getEaseOut()