Search in sources :

Example 1 with JFXKeyValue

use of com.jfoenix.transitions.JFXKeyValue in project JFoenix by jfoenixadmin.

the class JFXDrawer method addAnimatedKeyValue.

public void addAnimatedKeyValue(Node node, List<JFXDrawerKeyValue<?>> values) {
    Collection<JFXKeyValue<?>> modifiedValues = new ArrayList<>();
    for (JFXDrawerKeyValue value : values) {
        JFXKeyValue modifiedValue = JFXKeyValue.builder().setEndValueSupplier(() -> currentValue.get(value.getTarget()).get()).setAnimateCondition(() -> node.getScene() != null && value.isValid()).setTargetSupplier(() -> value.getTarget()).setInterpolator(value.getInterpolator()).build();
        modifiedValues.add(modifiedValue);
        currentValue.put(value.getTarget(), isClosed() ? value.getCloseValueSupplier() : value.getOpenValueSupplier());
        initValues.put(value.getTarget(), value);
    }
    animatedValues.addAll(modifiedValues);
    final JFXKeyFrame keyFrame = new JFXKeyFrame(duration, modifiedValues.toArray(new JFXKeyValue[0]));
    try {
        translateTimer.addKeyFrame(keyFrame);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : JFXDrawerKeyValue(com.jfoenix.transitions.JFXDrawerKeyValue) JFXKeyFrame(com.jfoenix.transitions.JFXKeyFrame) JFXKeyValue(com.jfoenix.transitions.JFXKeyValue) ArrayList(java.util.ArrayList)

Aggregations

JFXDrawerKeyValue (com.jfoenix.transitions.JFXDrawerKeyValue)1 JFXKeyFrame (com.jfoenix.transitions.JFXKeyFrame)1 JFXKeyValue (com.jfoenix.transitions.JFXKeyValue)1 ArrayList (java.util.ArrayList)1