Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlTransformAnimation rotate: xxx beInfinite doesn't work #188

Closed
Nyan11 opened this issue Nov 4, 2022 · 7 comments
Closed

BlTransformAnimation rotate: xxx beInfinite doesn't work #188

Nyan11 opened this issue Nov 4, 2022 · 7 comments
Labels

Comments

@Nyan11
Copy link
Contributor

Nyan11 commented Nov 4, 2022

Hello,

I found a bug with the animation

element :=  BlElement new
		  background: Color black;
		  yourself.

element addAnimation: (BlTransformAnimation rotate: 180) beInfinite.

space := BlSpace new useAlexandrieMorphicWindowHost.

space addChild: element.
space show.

It does the first 180 spin but the debugger open with Instance of BlElementCachedExplicitTransformation did not understand #is2D.

I tested it with rotate:, scale: and translate:. Same bug each time.

I didn't manage to investigate futher. I'm on the dev-1.0 branch at d0ec7a0

@tinchodias
Copy link
Collaborator

I got the debugger too. Investigating it...

@tinchodias
Copy link
Collaborator

I fixed (or workaround) the is2D MNU and other similar subsequent, and the behavior is weird... it doesn't look like infinitely rotating an element!

Screen.Recording.2022-11-16.at.18.24.26.mov

(Code: http://ws.stfx.eu/L8NTBL0CG3QO)

For the record, what I did are two changes in BlElementCompositeTransformation:

"testing"
is2D
	"Return true if my current transformation is in 2D space, false otherwise"

	^ elementTransformations allSatisfy: [ :each | 
		  each asElementTransformation is2D ]

and:

"computation"
computeMatrix: aBlMatrix in: aRectangle

	elementTransformations reverseDo: [ :each |
		each asElementTransformation computeMatrix: aBlMatrix in: aRectangle ]

@tinchodias
Copy link
Collaborator

Only changing the angle from 180º to 40º, this happens:
(but also set animation duration to 100ms to speedup demo by 10x)
(watch up to the final)

Screen.Recording.2022-11-16.at.18.29.20.mov

(Code: http://ws.stfx.eu/N5AHZ9V9CJT)

This bug is reproducible 100% and was canvas-independent.

@tinchodias
Copy link
Collaborator

An infinite sequence animation of absolute animations DOES work:

element :=
	BlElement new
		relocate: 100@100;
		background: Color green;
		yourself.

cwAnimation := (BlTransformAnimation rotate: 180) absolute.
ccwAnimation := (BlTransformAnimation rotate: 0) absolute.

element addAnimation: (BlSequentialAnimation 
	with: cwAnimation
	with: ccwAnimation)
	beInfinite;
	yourself.

space := BlSpace new.
space addChild: element.
space show.

@tinchodias
Copy link
Collaborator

Hi, while debugging this issue, I discovered more, and reported them here:

For the record, I mentioned this issue on the weekly update: https://pharoweekly.wordpress.com/2022/11/22/bloc-update-2/

@Nyan11
Copy link
Contributor Author

Nyan11 commented Nov 22, 2022

The BlNumberTransition animation does work too:

backgroundGeometry := BlAnnulusSectorGeometry new
	innerRadius: 0.9;
	outerRadius: 100;
	startAngle: 0;
	endAngle: 360;
	yourself.

background := BlElement new
	geometry: backgroundGeometry;
	background: (Color white alpha: 0.1);
	size: 100 @ 100;
	yourself.

shape := BlElement new
	geometry: (BlAnnulusSectorGeometry new
		innerRadius: 0.9;
		outerRadius: 100;
		startAngle: 0;
		endAngle: 225;
		yourself);
	background: Color blue;
	size: 100 @ 100;
	yourself.

container := BlElement new
	size: 100 @ 100;
	addChild: background;
	addChild: shape;
	yourself.
	
space := BlSpace new.
space addChild: container.
space root background: Color black.
space show.

animation := BlNumberTransition new
	from: 0;
	to: 360;
	by: 1;
	onStepDo: [ :val :el | 
		el geometry: (backgroundGeometry
			startAngle: 0 + val % 360;
			endAngle: 225 + val % 360;
			yourself)
	];
	beInfinite;
	yourself.

shape addAnimation: animation.

Pharo_LR1SAfDPV0

@tinchodias
Copy link
Collaborator

Related: #196

tinchodias added a commit that referenced this issue Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants