steeffeen-zz / FancyManiaLinks

ManiaLink Framework for Object-Based XML Generation
http://steeffeen.github.io/FancyManiaLinks/
GNU General Public License v3.0
6 stars 4 forks source link

Animation Manager #34

Open kremsy opened 7 years ago

kremsy commented 7 years ago

Would be cool if the Animation Manager of ManiaScript could be used somehow, some compatiblity to make the use very easy without programming ManiaScript would be amazing :D

steeffeen-zz commented 7 years ago

I definitely agree that an easy access to the animation manager would be great. However, a generic solution seems to be very difficult. (Animations could definitely be integrated in the existing script features, e.g. Toggle eases the visibility instead of hard-toggling.) Could you please tell me the most important features?

kremsy commented 7 years ago

Have to think about important features, what I have in mind would be like animating quads in / out, the toggling as you said and whole frames.

JocyW commented 7 years ago

I would find more important to be able to animate a translation in X/Y axis

PRGfx commented 7 years ago

As the animation manager just takes the target-state xml wouldn't it be handy to have something like

$targetState = clone $myControl;
$targetState->setPosition(100, 0)->setOpacity(0);
$animationFeature = new AnimationFeature($myControl, $targetState, 0, 500, AnimationHandler::EaseInOutSine);
$myControl->addClickHandler($animationFeature);

I have pretty much no clue about your API but I had the impression that the structure would be somewhat like this.

When rendering the code for the feature you would then just render your targetState control in triple quotes and this should be pretty much generic? A notation as in my pseudo example would provide everything for the signature

Add (CMlControl Control, Text XmlTarget, Integer StartTime, Integer Duration, EAnimManagerEasing EasingFunc)

If features are animatable is then decided by the AnimManager.

JocyW commented 7 years ago

I think this hardly would be a problem to implement. It gets more interesting when you want to have your animation be called on a custom event

steeffeen-zz commented 7 years ago

An issue appears when the PHP script re-sends/updates the manialink for some reason during the animation, in this case things will get messy: After the animation the PHP must send the target location to not reset the control to the start position. I guess this situation might be rather rare and therefore the issue might not be critical?

kremsy commented 7 years ago

I don't think this case would be that rare, it could easily happen, for Example if you make animations on a MapVeto Plugin where you animate the Maps out of the screen, and another map got vetoed out at same time it would stop. But on the other hand the map would be not on the screen than anyways, hard to say if this issue could make problems. Maybe @JocyW can think better of that problem.