Java源码示例:org.pushingpixels.trident.ease.Spline

示例1
public MercuryLoading() {
    this.setValue(0);
    this.setMaximum(3000);
    this.setForeground(AppThemeColor.TEXT_NICKNAME);
    this.setBackground(AppThemeColor.ADR_FOOTER_BG);

    this.setUI(new MercuryLoadingUi(this));

    this.progressTl = new Timeline(this);
    this.progressTl.setDuration(2400);
    this.progressTl.addPropertyToInterpolate("value", this.getMaximum(), 0);
    this.progressTl.setEase(new Spline(1));
    this.progressTl.addCallback(new TimelineCallbackAdapter() {
        @Override
        public void onTimelineStateChanged(Timeline.TimelineState oldState, Timeline.TimelineState newState, float durationFraction, float timelinePosition) {
            swapColors();
        }
    });
}
 
示例2
public AbstractRadial() {
      super();
      lcdTimeline = new Timeline(this);
      lcdValue = 0;
      lcdUnitString = getUnitString();
      ledPosition = new Point2D.Double(0.6, 0.4);
      userLedPosition = new Point2D.Double(0.3, 0.4);
      INNER_BOUNDS = new Rectangle(200, 200);
      GAUGE_BOUNDS = new Rectangle(200, 200);
      FRAMELESS_BOUNDS = new Rectangle(200, 200);
      FRAMELESS_OFFSET = new Point2D.Double(0, 0);
      transparentSectionsEnabled = false;
      transparentAreasEnabled = false;
      expandedSectionsEnabled = false;
      tickmarkDirection = Direction.CLOCKWISE;
      timeline = new Timeline(this);
      STANDARD_EASING = new Spline(0.5f);
      RETURN_TO_ZERO_EASING = new Sine();
horizontalAlignment = SwingConstants.CENTER;
verticalAlignment = SwingConstants.CENTER;
      lcdTextVisible = true;
      LCD_BLINKING_TIMER = new Timer(500, this);
      addComponentListener(this);
  }
 
示例3
public AbstractLinear() {
    super();
    INNER_BOUNDS = new Rectangle(120, 300);
    startingFromZero = false;
    transparentSectionsEnabled = false;
    transparentAreasEnabled = false;
    ledPosition = new Point2D.Double((getInnerBounds().width - 18.0 - 16.0) / getInnerBounds().width, 0.453271028);
    userLedPosition = new Point2D.Double(18.0 / getInnerBounds().width, 0.453271028);
    lcdValue = 0;
    lcdTimeline = new Timeline(this);
    lcdUnitString = getUnitString();
    lcdInfoString = "";
    timeline = new Timeline(this);
    STANDARD_EASING = new Spline(0.5f);
    RETURN_TO_ZERO_EASING = new Sine();
    lcdTextVisible = true;
    LCD_BLINKING_TIMER = new Timer(500, this);
    addComponentListener(this);
}
 
示例4
/**
     * Sets custom pulse behavior - higher frame rate, lower frame rate or dynamic frame rate.
     * <p>
     * By default, Trident timelines are driven by a dedicated thread that wakes up every 40ms and
     * updates all the timelines. When the CPU is not heavily used this results in 25 frames-per-second
     * refresh rate for Trident-driven UI animations - consistent with the frame rate of theatrical films
     * and non-interlaced PAL television standard.
     * <p>
     * (see https://kenai.com/projects/trident/pages/CustomPulseSource)
     *
     * Must be run before any instance of Timeline is created in the application otherwise it will
     * generate the "cannot replace the pulse source thread once it's running..." error.
     */
//    static {
//        try {
//            TridentConfig.getInstance().setPulseSource(() -> {
//                try {
//                    Thread.sleep(30);
//                } catch (InterruptedException ex) {
//                    LOGGER.log(Level.WARNING, null, ex);
//                }
//            });
//        } catch (RuntimeException ex) {
//            LOGGER.log(Level.WARNING, ex.getMessage());
//        }
//    }

    CardFlowTimeline(TimelineCallback aCallback, long durationMs) {
        setDuration(durationMs);
        setEase(new Spline(0.8f));
        addCallback(aCallback);
    }
 
示例5
private void showPopup() {
    if (MagicAnimations.isOn(AnimationFx.CARD_FADEIN)) {
        if (opacity == 0f) {
            fadeInTimeline = new Timeline();
            fadeInTimeline.setDuration(200);
            fadeInTimeline.setEase(new Spline(0.8f));
            fadeInTimeline.addPropertyToInterpolate(
                Timeline.property("opacity")
                .on(this)
                .from(0.0f)
                .to(1.0f));
            fadeInTimeline.play();
        } else {
            opacity = 1.0f;
        }
    } else {
        opacity = 1.0f;
    }
    setVisible(true);
}
 
示例6
@Override
public void setVisible(boolean aFlag) {
    super.setVisible(aFlag);
    if (ImageHelper.isWindowTranslucencySupported()) {
        if (!aFlag) {
            setOpacity(0f);
        } else {
            fadeInTimeline = new Timeline();
            fadeInTimeline.setDuration(200);
            fadeInTimeline.setEase(new Spline(0.8f));
            fadeInTimeline.addPropertyToInterpolate(
                    Timeline.property("opacity")
                    .on(this)
                    .from(0.0f)
                    .to(1.0f));
            fadeInTimeline.play();
        }
    }
}
 
示例7
private void initCollapseAnimations(String state) {
    collapseAnimation = new Timeline(this);
    switch (state) {
        case "expand": {
            collapseAnimation.addPropertyToInterpolate("width", this.getWidth(), MAX_WIDTH);
            break;
        }
        case "collapse": {
            collapseAnimation.addPropertyToInterpolate("width", this.getWidth(), MIN_WIDTH);
        }
    }
    collapseAnimation.setEase(new Spline(1f));
    collapseAnimation.setDuration(150);
}
 
示例8
public synchronized void animateBackground()   { 
    fadeInTimeline.addPropertyToInterpolate("backgroundLabelD",  0 , 55); 
    fadeInTimeline.setDuration(1500); 
    fadeInTimeline.setEase(new Spline(0.7f)); 
    fadeInTimeline.play(); 
    //fadeInTimeline.playLoop(2, Timeline.RepeatBehavior.LOOP);
}
 
示例9
private Timeline getGrowTimeline() {
    final Timeline timeline = new Timeline(this);
    timeline.addPropertyToInterpolate("GrowRectangle", getStart(), getPreviewRectangle());
    timeline.setDuration(GROW_DURATION);
    timeline.setEase(new Spline(0.8f));
    return timeline;
}
 
示例10
private Timeline getShrinkTimeline() {
    final Timeline timeline = new Timeline(this);
    timeline.addPropertyToInterpolate("ShrinkRectangle", getPreviewRectangle(), getEnd());
    timeline.setDuration(SHRINK_DURATION);
    timeline.setEase(new Spline(0.8f));
    timeline.addCallback(new TimelineCallbackAdapter() {
        @Override
        public void onTimelineStateChanged(Timeline.TimelineState oldState, Timeline.TimelineState newState, float durationFraction, float timelinePosition) {
            if (newState == Timeline.TimelineState.DONE) {
                scenario.cancel();
            }
        }
    });
    return timeline;
}
 
示例11
private void startPulsingBorderAnimation() {
    if (GeneralConfig.get(BooleanSetting.ANIMATE_GAMEPLAY)) {
        stopPulsingBorderAnimation();
        pulseBorderTimeline.setDuration(500);
        pulseBorderTimeline.setEase(new Spline(0.8f));
        pulseBorderTimeline.addPropertyToInterpolate(
                Timeline.property("pulsingBorderOpacity").on(this).from(20).to(200));
        pulseBorderTimeline.playLoop(Timeline.RepeatBehavior.REVERSE);
    }
}
 
示例12
private void doHealAnimation() {
    if (GeneralConfig.get(BooleanSetting.ANIMATE_GAMEPLAY)) {
        final Timeline timeline = new Timeline();
        timeline.setDuration(1000);
        timeline.setEase(new Spline(0.8f));
        timeline.addPropertyToInterpolate(
                Timeline.property("healColorOpacity").on(this).from(100).to(0));
        timeline.play();
    }
}
 
示例13
private void startPulsingBorderAnimation() {
    if (MagicAnimations.isOn(AnimationFx.AVATAR_PULSE)) {
        stopPulsingBorderAnimation();
        pulseBorderTimeline.setDuration(500);
        pulseBorderTimeline.setEase(new Spline(0.8f));
        pulseBorderTimeline.addPropertyToInterpolate(
                Timeline.property("ChoiceBorderOpacity").on(this)
                    .from(20).to(CHOICE_BORDER_MAX_OPACITY)
        );
        pulseBorderTimeline.playLoop(Timeline.RepeatBehavior.REVERSE);
    }
}