// Copyright © SixtyFPS GmbH // SPDX-License-Identifier: MIT enum OrbiterState { front, back } export component Orbiter { in property state: OrbiterState.front; in-out property source <=> img.source; in-out property colorize <=> img.colorize; in property orbit-rotation: 0deg; in property offset: 45deg; in property radius: 220px; property internal-rotation: orbit-rotation + offset; in property orbit-attack: 180deg; in property ball-size: 60px; property zPos: sin(internal-rotation) * radius; out property scale: 0.3 + 0.7 * (zPos + radius) / (2 * radius); property infront: internal-rotation.mod(360deg) < 180deg; function isVisible() -> bool { if (infront && state == OrbiterState.front) || (!infront && state == OrbiterState.back) { return true; } else { return false; } } visible: isVisible(); Rectangle { x: cos(orbit-attack) * cos(internal-rotation) * radius; y: sin(orbit-attack) * cos(internal-rotation) * radius; img := Image { width: root.ball-size * scale; height: root.ball-size * scale; source: @image-url("images/sphere-small.png"); } } }