4 ms·
Does this library support dynamic rendering? I tried to add extra elements to the illustration after rendering it to the canvas and it doesn't appear to work. I
by The_Amp_Walrus 7y ago
Does this library support dynamic rendering? I tried to add extra elements to the illustration after rendering it to the canvas and it doesn't appear to work. I might be using the API incorrectly though - is the idea that you can use this library to produce a static model which can then be transformed (eg. rotated), but can't be extended after the first render?
- jmiskovic 7y agoDid you try to call updateGraph() after adding elements? It seems like it should do the trick. [] https://zzz.dog/api#anchor-updategraph https://zzz.dog/api#anchor-updategraph
- The_Amp_Walrus 7y agoThis was my initial attempt using an Illustration https://codepen.io/anon/pen/NVORrZ https://codepen.io/anon/pen/NVORrZ This is my 2nd attempt using the docs you linked https://codepen.io/anon/pen/QRZKxy?editors=0010 https://codepen.io/anon/pen/QRZKxy?editors=0010 What do you think - is updateGraph + render supposed to work more than once?
- falsedan 7y agoNo, the underlying flatgraph (which is used to generate the drawing commands) is cached and only updated on first call. Reset it by calling scene.updateFlatGraph(); after adding new shapes, before updating the graph & rendering (see https://github.com/metafizzy/zdog/blob/master/js/anchor.js#L126 https://github.com/metafizzy/zdog/blob/master/js/anchor.js#L...) edit: made an issue https://github.com/metafizzy/zdog/issues/21 https://github.com/metafizzy/zdog/issues/21
- The_Amp_Walrus 7y agoCheers!