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

Bezier Curve #48

Closed
wants to merge 5 commits into from
Closed

Bezier Curve #48

wants to merge 5 commits into from

Conversation

kefniark
Copy link
Owner

@kefniark kefniark commented Mar 10, 2019

Description

Implement basic bezier curve

  • Check for spine improvement
  • Check for autorotation along the curve
  • Do we also need quadratic curve? (only 1 control point where current cubic has 2)
  • Check for arc curve (https://www.redblobgames.com/articles/curved-paths/)
  • Sequence of curve / arc / tween
  • Compute Sequence speed (need to calculate the speed based on sub tween distance and overall duration)
  • Convert to plugin (to keep the core small)
  • Write tests + jsdoc

Issue

#40

API

// Normal cubic bezier curve (2 control point)
Fatina.curve(bunny1, {
	ctr1: { x: bunny1.x + 200, y: bunny1.y - 20 },
	ctr2: { x: bunny1.x + 800, y: bunny1.y + 550 },
	to: { x: bunny1.x + 80, y: bunny1.y - 240 },
	duration: 2500
}).start();

// Quadratic bezier curve (1 control point)
Fatina.curve(bunny2, {
	ctr1: { x: bunny2.x + 200, y: bunny2.y - 20 },
	to: { x: bunny2.x + 80, y: bunny2.y - 240 },
        easing: 'quadratic',
	duration: 2500
}).start();

// Arc (1 control point)
Fatina.arc(bunny3, {
	ctr1: { x: bunny3.x + 200, y: bunny3.y - 20 },
	to: { x: bunny3.x + 80, y: bunny3.y - 240 },
	duration: 2500
}).start();

Screenshot

image

@coveralls
Copy link

coveralls commented Mar 10, 2019

Coverage Status

Coverage decreased (-0.6%) to 99.168% when pulling 3ad8e79 on bezier into afa8dc9 on develop.

@kefniark
Copy link
Owner Author

kefniark commented Apr 6, 2019

image

By default, Fatina APIs remains really similar to v2, bezier and preset need to be loaded as plugin

In HTML:

<script src="./fatina.js"></script>
<script src="./fatinaPreset.js"></script>
// ...
<script>
    Fatina.init();
    Fatina.loadPlugin(fatinaPreset.get());

    Fatina.shake(obj).start();

With Node:

import Fatina, { IControl } from 'fatina';
import * as FatinaPluginPreset from 'fatina/build/plugins/fatinaPreset.js';
// ...
Fatina.init();
Fatina.loadPlugin(FatinaPluginPreset.get());

@kefniark
Copy link
Owner Author

too many conflicts and outdated API, still want to bring that in the lib one day

@kefniark kefniark closed this Jan 24, 2022
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.

2 participants