hi,recently,i find a sketch plugin can modify the properties of the sketch elements in real time. it is very interesting.
Does anyone have an idea how is this function implemented.
above is the detailed operation:
@kevgski Can you help me,thanks.
Sure! Not entirely sure what part you are stuck on. The core concept is pretty simple. You’d have an array of styles for each button and changing what item is selected in the dropdown would then update the currently selected object accordingly.
What part are you not sure about? If I was trying to implement this, I wouldn’t worry about the UI part so much and just focus on the code to manage the different states of the buttons/objects. The UI part is pretty simple to add in later.
kevgski a button,it maybe simple. above is complex example,not only changed the color, but also changed the layout and complex style like this(include style and layout).
if use the code to manage the style and layout,i feel is diffcult:
janily Hiya Janily,
I made a small example showing how to insert sketch objects via a user interface. You can use a similar pattern depending on how you want to create your components and where you want to source them. Here I just source them from artboards that start with “object”. I’ll add some more comments in my code to explain what is going on.
https://github.com/KevinGutowski/ObjectSwap/blob/master/ObjectSwap.sketchplugin/Contents/Sketch/script.js
This is the Fusion Cool Plugin, maybe you can read some article below to know how it work.
Plugin Download: https://fusion.design/tool Plugin Help: https://fusion.design/help.html#/design-use-cool Custom Components for Fusion Cool: https://fusion.design/help.html#/dev-biz Development History of Fusion Cool: https://regx.vip/post/fusioncool-history/
After reading you will find the magic editor in fusion cool is powered by html2sketch.
kevgski kevgski,thank you very much,it is very helpful to me.