Skip to contents

The studio guide for mascot_motion_settings(). The same page is read in the mascot studio.

Try it live. The mascot studio shows this function with live controls and the generated code. In an R session with the optional packages bslib and knitr installed, run:
mascot::mascot_studio(fn = "mascot_motion_settings")
It opens on this function's guide; change a control and watch the mascot.

What each switch controls

Choose which movement suits the task before adding gestures or changing moods. Turning panel movement off still leaves the panels available.

Switch What you see move
idle The resting character breathes and blinks.
mood_change A wiggle or hop accompanies a new mood.
gestures The character performs a nod, wave or another gesture.
swap One character changes into another.
minimising The mascot travels to its round restore button.
restoring The mascot returns from its restore button.
messages Animation of the bubble, tooltip and menu.
others Movement whose switch is left at NULL, including future switches.

Which setting wins

A visitor who requests reduced motion keeps that preference even when a switch is enabled. Otherwise, an explicit named switch takes priority; a switch left at NULL uses others.

Visitor requests reduced motion
overrides enabled movement
→
Named switch
TRUE or FALSE; messages also accepts panel names
→
others
used when the switch is NULL

Three motion recipes

mascot::mascot("helper", motion = FALSE)

Result: movement is off, with reduced-motion poses and instant drag transitions.

mascot::mascot("helper", motion = mascot::mascot_motion_settings(idle = FALSE))

Result: resting breathing and blinking are off; the other switches follow the default others = TRUE, subject to the visitor’s reduced-motion preference.

mascot::mascot("helper", motion = mascot::mascot_motion_settings(others = FALSE, gestures = TRUE))

Result: only gestures are enabled; the other switches follow others = FALSE. The helper sets permission to move; it does not start a gesture.

A calm dashboard

Create the dashboard helper with the gestures-only recipe above. In a server observer, acknowledge an action with a nod:

mascot::update_mascot("helper", gesture = "nod")

Mood, bubble and status updates still work when their movement is disabled. A reduced-motion preference can suppress the nod too.

Warnings, errors and common mistakes

mascot_motion_settings(idle = "yes")
Error: could not find function "mascot_motion_settings"