From 44d925bb4a600c3493ece68112770d8c55cdb744 Mon Sep 17 00:00:00 2001 From: Michael Leuschel <leuschel@uni-duesseldorf.de> Date: Sat, 20 May 2023 10:39:58 +0200 Subject: [PATCH] minimal example using new VisB DEFINITIONS Signed-off-by: Michael Leuschel <leuschel@uni-duesseldorf.de> --- Button/button_def.mch | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Button/button_def.mch diff --git a/Button/button_def.mch b/Button/button_def.mch new file mode 100644 index 0000000..f8d3665 --- /dev/null +++ b/Button/button_def.mch @@ -0,0 +1,30 @@ +MACHINE button_def +// An example that uses the new feature to use VisB DEFINITIONS +DEFINITIONS + "LibraryStrings.def"; + VISB_JSON_FILE == ""; + VISB_SVG_BOX == rec(height:200, width:240); + VISB_SVG_OBJECTS == rec(svg_class:"circle", `id`:"button", + cx:"100",cy:"100", r:"80", + stroke:"black", `stroke-width`:"3"); + VISB_SVG_UPDATES == rec(`id`:"button", + fill: IF button=TRUE THEN "green" ELSE "red" END); + VISB_SVG_HOVERS == rec(`id`:"button", stroke:"gray", + `stroke-width`:"5") +VARIABLES + button +INVARIANT + button:BOOL +INITIALISATION + button := FALSE +OPERATIONS + press_button = PRE button=FALSE THEN + button:=TRUE + END; + toggle_button = BEGIN + button:= bool(button=FALSE) + END; + set_button(newVal) = PRE newVal:BOOL THEN + button := bool(newVal=TRUE) + END +END \ No newline at end of file -- GitLab