diff --git a/Button/Z/button.json b/Button/Z/button.json new file mode 100644 index 0000000000000000000000000000000000000000..361c04ade0804e026c3ff7e7956fb9e748d9d857 --- /dev/null +++ b/Button/Z/button.json @@ -0,0 +1,30 @@ +{ + "svg": "../button.svg", + "items": [ + { + "id": "button", + "attr": "fill", + "value": "IF button=True THEN \"green\" ELSE \"red\" END" + }, + { + "id": "button", + "attr": "stroke-width", + "value": "IF ENABLED(\"pressButton\") THEN 6 ELSE 1 END", + "ignore": "is now used in hover below" + }, + { + "id": "button_%0", + "attr": "visibility", + "value": "\"hidden\"", + "repeat": [ "TRUE", "FALSE" ] + } + ], + "events": [ + { + "id": "button", + "event": "toggleButton", + "hovers": [{ "attr":"stroke-width", "enter":"6", "leave":"1"}, + { "attr":"opacity", "enter":"0.8", "leave":"1.0"}] + } + ] +} diff --git a/Button/Z/button.tex b/Button/Z/button.tex new file mode 100644 index 0000000000000000000000000000000000000000..d2e1227574b94f47d9a7a91c75f24ecaf9ee5045 --- /dev/null +++ b/Button/Z/button.tex @@ -0,0 +1,42 @@ +\documentclass[a4paper]{article} +\usepackage{fuzz} + +\begin{document} + + +\section*{Button} +\subsection*{Data types} +We define the type for booleans: +\begin{zed} + Bool ::= True | False\\ +\end{zed} + +\subsection*{State} +The current state of the button is a boolean +\begin{schema}{State} + button: Bool +\end{schema} + + +\subsection*{Operations} + +\begin{schema}{pressButton} + \Delta State +\where + button = False\\ + button' = True +\end{schema} + +\begin{schema}{toggleButton} + \Delta State +\where + button' = (\IF button= True \THEN False \ELSE True) +\end{schema} + +\begin{schema}{Init} + State\\ + \where + button = False + \end{schema} + +\end{document}