Wednesday 15 April 2015

javafx - Starting multiple animations at the same time -



javafx - Starting multiple animations at the same time -

i'm trying start transition in each box of every row, successive boxes (left right) starting own transitions before previous ones finish. looked @ sequentialtransition, seems imply transitions started 1 after after previous 1 finishes.

i'm thinking need utilize paralleltransition each row, how can go doing this?

i noticed constructor paralleltransition(animation... children); possible phone call constructor 1 time animations, given how i'm instantiating each animation separately?

gridpane gp; ... (int i=0;i<gp.getrowconstraints().size();i++) { timeline tl = new timeline(); tl.setcyclecount(animation.indefinite); tl.setdelay(duration.millis((math.random() * 2500) + 500)); (int j=0;j<gp.getcolumnconstraints().size();j++) { tile t = new tile(); tl.getkeyframes().addall( new keyframe(duration.zero, new keyvalue(t.huemultiplier, 15)), new keyframe(duration.millis(5000), new keyvalue(t.huemultiplier, 1)) ); gp.add(t, j, i); } ... }

animation not start until phone call play() method of it. creating them separately in different places adding paralleltransition valid.

paralleltransition pt = new paralleltransition(); ... for(...) { timeline tl = new timeline(); ... pt.getchildren().add(tl); } ... pt.play();

javafx javafx-2 javafx-8

No comments:

Post a Comment