Dynamic Icons
Overview
Dynamic icons allow for interactive and responsive vector graphics. They can respond to variables, perform calculations, and conditionally render different elements.
Enabling Dynamic Mode
To create a dynamic icon, the first line of the ICN file must be @dynamic:
@dynamic
// rest of the icon codeVariables
Variables from the environment can be accessed using the $ prefix:
$variableNameExample:
@dynamic
c #fff
line 0 0 $mouseX $mouseY // Draws line to mouse positionConditional Rendering
Basic Syntax
Example:
Operations
Comparison Operators
==Equal to!Not equal to<Less than>Greater than
Arithmetic Operators
+Addition-Subtraction/Division*Multiplication%Modulo^Power
Mathematical Functions
sinSine (degrees)cosCosine (degrees)tanTangent (degrees)sqrtSquare rootabsAbsolute valuefloorRound downceilRound uproundRound to nearest integerlogNatural logarithmexpExponential
Example: Clock Icon
Order of Evaluation
Operations are evaluated from left to right. For example:
Evaluation steps:
10 + 10→20 < 20 - 2020 < 20 - 20→false - 20false - 20→-20
Last updated
Was this helpful?