# Skinnable Speedometer

![](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-9a40f202d1d6457f66567d16cdd0ffa2ef3747b2%2Fgreenmodern.png?alt=media)

## Overview

This **Demo Project** consists of a *speedometer* whose visual presentation can be altered while maintaining the functionality. Thus, it showcases **Incari's** ability to alter and reuse **Assets** in order to fully customize the *User Interface*.

### Themes

<div><figure><img src="https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-c7d256e04556a06b729987b2c88cf22403ee2505%2Fbluetheme.png?alt=media" alt=""><figcaption><p>Blue Theme.</p></figcaption></figure> <figure><img src="https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-371473649b06ddce55fbeedbfc62732c63167eba%2Fgreentheme.png?alt=media" alt=""><figcaption><p>Green Theme.</p></figcaption></figure></div>

The primary distinction between these two *speedometers* lies in their color themes. While one *speedometer* goes for a cool blue color palette, the other adopts a vibrant green one. The choice of colors not only affects the aesthetic appeal but can also influence the user experience. The dynamic and bold hues on one *speedometer* may evoke a sense of urgency or excitement, whereas the softer tones on the alternative *speedometer* might convey a calm and composed atmosphere. Ultimately, the difference in color serves as a visual cue that can subtly shape the driver's perception and behavior on the road.

### Views

<div><figure><img src="https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-c7d256e04556a06b729987b2c88cf22403ee2505%2Fbluetheme.png?alt=media" alt=""><figcaption><p>Classic View.</p></figcaption></figure> <figure><img src="https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-f456680a8f22dd7af02c33ffd30099bf6e64d66e%2Fbluemodern.png?alt=media" alt=""><figcaption><p>Modern View.</p></figcaption></figure></div>

The disparity between two *speedometers* lies in their distinct styles, or view. One *speedometer* relies on a soft, round, classic display design. In contrast, the other *speedometer* embraces clean lines, digital displays, and a modern aesthetic. The choice of style not only reflects aesthetic preferences but also impacts the overall feel and atmosphere within the vehicle. The modern view may appeal to those seeking a high-tech and futuristic driving experience, while the classic view caters to enthusiasts who appreciate a simple and relaxed ambiance in their vehicle's instrumentation. The difference in style thus contributes to a diverse range of visual preferences and driving aesthetics among users.

### Instructions

![](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-7d659cdfbef9efc7d10321b6d62e0990f9435ddd%2Finstructions.png?alt=media)

Although all four *speedometer* types look visually different, their functionality remains the same and can be managed by the same instructions.

* `↑` indicates going up in gear.
* `↓` indicates going down in gear.
* `O` simulates the oil temperature change.
* `←` commands the left indicator.
* `H` controls the hazard lights.
* `V` changes the *speedometer* view.
* `W` causes acceleration (this is only available in *drive* and *reverse*).
* `S` brakes.
* `F` simulates the fuel level change.
* `→` commands the right indicator.
* `T` changes the *speedometer*'s theme color.

## Logic

The **Logic** for switching the speedometer's theme and view is described below:

### Switching Theme

![Logic that Controls the Speedometer's Theme.](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-5301e0b72dd9976be7d6438a24d5f26d84ae9ad5%2Fcontrolthemeimage.png?alt=media)

Once the user presses `T`, the `currentColorIndex` is incremented and the **Logic** checks that the index is within the bounds of `theme_arr-str_colors` (which is an **Array** that allows the user to store as many colors as they wish). This way, the number of colors can be altered dynamically and an infinite amount of color themes can be added. It is also possible to add primary, secondary, tertiary, and quaternary colors associated with that theme name to their respective arrays. These arrays, as can be seen in the **Logic**, are used for storing the specific color choices for different themes and can be modified as needed.

If this current index is less than the length of the **Array** of **Strings** given at the start, this means that there is a next value in the **Array** of themes and it continues to this next one and selects that data. However, if it is not less than the length, this means all the values of the **Array** have been cycled through and it starts at the 'beginning' with an index of 0. This is stored as the `theme_int_currentColorIndex`.

Whenever there is a change, this triggers `On theme_int_currentColorIndex Change`, which sets and returns the **String** value at the specified index.

![Logic that Updates the Speedometer's Theme Part 1.](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-5327c62a8b98721a1ac6662579041fad9b29f4c2%2Fthemeupdate1.png?alt=media)

When `theme_int_currentColor` changes, it triggers the four blocks of **Logic** in the `Theme Update` grouping. These apply to the four shades of the theme's color. In the above image, the two blocks of **Logic** visible set the **Color** values for the primary and secondary **Objects** of the *speedometer*.

![Logic that Updates the Speedometer's Theme Part 2.](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-2603a5efdcb99e430d0c0854ab19a304f298869d%2Fthemeupdate2.png?alt=media)

In the above image, the two blocks of **Logic** visible set the **Color** values for the tertiary and quaternary **Objects** of the *speedometer*.

### Switching View

![Logic that Changes the Speedometer's View.](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-1ac6893273ead43aae90f091525e516b5da4c493%2Fcontrolviewimage.png?alt=media)

Pressing `V` triggers the **Toggle Node** and sets a variable to either 0 or 1, and stores this value in `theme_int_currentValue` to later change the theme.

![Logic that Updates the Speedometer's View Part 1.](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-158eccfca8997255eb13c26f22d834b9f9a54067%2Fviewupdate3.png?alt=media)

The first block of the `View Update` **Logic** is triggered by the change of the `theme_int_currentValue` variable. Depending on the resulting variable of either 0 or 1, it provokes use of the **FadeTo Node** between the current and changed view. Furthermore, **Objects** for speed and time are being reused between different views by simple move and scale actions with the **MoveTo Action Node** and **ScaleToAction Node**, allowing the user to create specific transitions between different views without duplicating **Objects**.

![Logic that Updates the Speedometer's View Part 2.](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-e1143ddf34d5beb029492e9e3309f070fd298836%2Fviewupdate4.png?alt=media)

The next block of **Logic** takes the values of the variables for acceleration, time, etc. and updates the view. This **Logic** shown above continues in the image below.

![Logic that Updates the Speedometer's View Part 3.](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-bbb2304376784d10b12614a10ed3b9bf3c7ca75c%2Fviewupdate5.png?alt=media)
