Skip to content

add full revolution support for VisualTransition#170

Open
T1mL3arn wants to merge 1 commit into
ceramic-engine:masterfrom
T1mL3arn:revolution-tween
Open

add full revolution support for VisualTransition#170
T1mL3arn wants to merge 1 commit into
ceramic-engine:masterfrom
T1mL3arn:revolution-tween

Conversation

@T1mL3arn

@T1mL3arn T1mL3arn commented Jun 6, 2026

Copy link
Copy Markdown
Contributor
  • tween now supports rotations like 720 degrees (2 revolutions)
  • new option, old way is intact

Comparison:

sdfsdfsd

Example scene

Details
import ceramic.Text;
import ceramic.Visual;
import ceramic.Timer;
import ceramic.Quad;
import ceramic.Color;
import ceramic.Scene;

class RevolutionScene extends Scene {

	var v1:Visual;
	var v2:Visual;
	var visualRotation = 210.0;

	override function create() {
		super.create();

		v1 = buildVisual(app.screen.width * 0.33, app.screen.height*0.5, Color.CRIMSON, 'Rotation');
		v2 = buildVisual(app.screen.width * 0.66, app.screen.height*0.5, Color.CYAN, 'Revolution');

		tweenRotation();
		tweenRevolution();

		add(v1);
		add(v2);
	}

	function tweenRotation() {
		v1.transition(QUAD_EASE_IN_OUT, 2.0, props -> {
			props.rotation = v1.rotation + visualRotation;
		}).onComplete(this, () -> Timer.delay(this, 0.5, tweenRotation));
	}

	function tweenRevolution() {
		v2.transition(QUAD_EASE_IN_OUT, 2.0, props -> {
			props.revolution = v2.rotation + visualRotation;
		}).onComplete(this, () -> Timer.delay(this, 0.5, tweenRevolution));
	}

	function buildVisual(x:Float, y:Float, color:Color, text = 'hello'):Visual {
		var t = new Text();
		t.color = color;
		t.content = text;
		t.pointSize = 32;
		t.pos(x,y);
		t.anchor(0.5,0.5);
		return t;
	}
}

- tween now supports rotations like 720 degrees (2 revolutions)
- new option, old way is intact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant