Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork38
GUI for live easing/property curves editing
License
mojs/mojs-curve-editor
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
GUI for live easing/property curves editing.
MojsCurveEditor
is a GUI plugin for interactive custom easings and property curves editing while crafting your animations. It is part ofmojs
tools.
TheMojsCurveEditor
depends onmojs >= 0.225.2
, tween autoupdates available formojs >= 0.276.2
. Please make sure you've linkedmojs library first.
#npmnpm install @mojs/curve-editor#cdn<script src="https://cdn.jsdelivr.net/npm/@mojs/curve-editor"></script>
ImportMojsCurveEditor
constructor inside your code, depending on your environment:
constMojsCurveEditor=require('mojs-curve-editor').default;// orimportMojsCurveEditorfrom'@mojs/curve-editor';
If you installed it with script link - you should have
MojsCurveEditor
global
ConstructMojsCurveEditor
with the next options:
constmojsCurve=newMojsCurveEditor({// name of the Curve you are working on. The name is used to// identify record in `localStorage` to restore the state from// when page gets reloaded, so please specify unique names if// you use more than one editor on the same page.name:'bounce curve'});
After that you can "connect" the curve with yourmojs
modules by passing a "sample" of the curve to theeasing
property of the module, like this:
constmojsCurve=newMojsCurveEditor();consttween=newmojs.Tween({easing:mojsCurve.getEasing()});// orconstshape=newmojs.Shape({easing:mojsCurve.getEasing()});// or as `property curve`consthtml=newmojs.Html({el:'#js-el',x:{0:100,curve:mojsCurve.getEasing()}});
Eachtween
/module
should have it's out sample of the curve, this means you need to callmojsCurve.getEasing()
send thesample
of the curve to theeasing
property of modules.
If you usemojs>0.276.5
the state of the modules with the curvesample
will be updated automatically.
ThegetEasing
function receives options hash:
easing:mojsCurve.getEasing({// `transform` function that pipes through the current value// of the curve so you can transform ittransform:(k)=>{returnk;}});
After you are happy with the curve you made, you need to change thesample
,mojsCurve.getEasing()
calls, with the actual path data that you can get by clicking on thecode
button:
consthtml=newmojs.Html({el:'#js-el',x:{0:100,easing:'M0, 100 L100, 0'}});
Constructor accepts the next options:
constcurveEditor=newMojsCurveEditor({// name of the curve editorname:'bounce curve'// if should preserve state on page reloadsisSaveState:true,// start path - will be loaded on initialization of the curve,// e.g. before any user modifications were made. Path of 'M0, 100 L100, 0' is set by default.startPath:'M0, 100 L100, 0',// callback on path change, accepts path stringonChange:function(path){},// if should hide when minimized - useful when you try to embedisHiddenOnMin:false});
curveEditor// get `easing function` of the curve.getEasing()// maximize the curve editor.maximize()// minimize the curve editor.minimize()// toggle `maximize/minimize` methods regarding editor's state.toggleSize();
alt + z
-undo
curve actionalt + x
-redo
curve actionalt + d
-delete
selected point(s)- [3 times]
alt + \
-reset
curve
All shortcuts work only for active editor - it should haveorange mojs logo indicator at bottom left.
Installwebpack globally:
[sudo] npm install webpack -g
Install dependencies withnpm:
[sudo] npm install
Runwebpack:
webpack
Please make sure you started afeature branch
with thefeature name
(better from thedev
branch) before making changes.
About
GUI for live easing/property curves editing
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors7
Uh oh!
There was an error while loading.Please reload this page.