Dynamic Equation

Comments

1 comment

  • Support Admin

    To change an equation, alter the text of the equation each time the slider value is changed. There are two ways to implement a superscript character or number: using the XML tag <sup></sup>, or the Alt-Code for the superscript character. E.g.

     <p name="myEquation">y = ax² + bx + c</p>

    <p name="myOtherEquation">y = ax<sup>2</sup> + bx + c</p>

    <slider name="aSlider" min="0" max="4" value="1">
    <onValueChanged>
    myEquation.Text = string.format("y = %.2fx² + bx + c", value)

    <![CDATA[
    myOtherEquation.FormattedText = string.format("y = %.2fx<sup>2</sup> + bx + c", value)
    ]]>
    </onValueChanged>
    </slider>

    Note that when using the XML <sup> tag, the code must be wrapped in CDATA, and FormattedText must be used. 

     

    0
    Comment actions Permalink

Please sign in to leave a comment.