From 282ba661d1377d40f6628c5529c1512037372626 Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Wed, 24 Jan 2024 19:32:10 -0800 Subject: [PATCH] update the sample code and link to a live CodePen example --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 4649e94..650e740 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,17 @@ compiler). ## Index +- [Demo](#demo) - [Install](#install) - [Usage](#usage) - [Documentation](#documentation) - [Benchmarks](#benchmarks) - [Tests](#tests) +## Demo + +[Live demo on CodePen.](https://codepen.io/trusktr/pen/abMLVxa?editors=1010) + ## Install Install using NPM: @@ -76,6 +81,16 @@ solver.addConstraint(new kiwi.Constraint(new kiwi.Expression([-1, right], left, solver.updateVariables() console.assert(right.value() === 500) + +// later, update the constraints and re-calculate +setTimeout(() => { + solver.suggestValue(left, 200) + solver.suggestValue(width, 600) + + solver.updateVariables() // update + + console.assert(right.value() === 800) +}, 2000) ``` ## Documentation