在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:michaelvillar/dynamics.js开源软件地址:https://github.com/michaelvillar/dynamics.js开源编程语言:CoffeeScript 100.0%开源软件介绍:Dynamics.jsDynamics.js is a JavaScript library to create physics-based animations To see some demos, check out dynamicsjs.com. UsageDownload:
Include <script src="dynamics.js"></script> You can animate CSS properties of any DOM element. var el = document.getElementById("logo")
dynamics.animate(el, {
translateX: 350,
scale: 2,
opacity: 0.5
}, {
type: dynamics.spring,
frequency: 200,
friction: 200,
duration: 1500
}) You also can animate SVG properties. var path = document.querySelector("path")
dynamics.animate(path, {
d: "M0,0 L0,100 L100,50 L0,0 Z",
fill: "#FF0000",
rotateZ: 45,
// rotateCX and rotateCY are the center of the rotation
rotateCX: 100,
rotateCY: 100
}, {
friction: 800
}) And any JavaScript object. var o = {
number: 10,
color: "#FFFFFF",
string: "10deg",
array: [ 1, 10 ]
}
dynamics.animate(o, {
number: 20,
color: "#000000",
string: "90deg",
array: [-9, 99 ]
}) Referencedynamics.animate(el, properties, options)Animates an element to the properties with the animation options.
dynamics.stop(el)Stops the animation applied on the element dynamics.css(el, properties)This is applying the CSS properties to your element with the correct browser prefixes.
dynamics.setTimeout(fn, delay)Dynamics.js has its own
Returns a unique id dynamics.clearTimeout(id)Clears a timeout that was defined earlier
dynamics.toggleSlow()Toggle a debug mode to slow down every animations and timeouts.
This is useful for development mode to tweak your animation.
This can be activated using Dynamics and propertiesdynamics.spring
dynamics.bounce
dynamics.forceWithGravity and dynamics.gravity
dynamics.easeInOut, dynamics.easeIn and dynamics.easeOut
dynamics.linearNo properties dynamics.bezier
The easiest way to output this kind of array is to use the curve creator. Here is an example: [{"x":0,"y":0,"cp":[{"x":0.2,"y":0}]},
{"x":0.5,"y":-0.4,"cp":[{"x":0.4,"y":-0.4},{"x":0.8,"y":-0.4}]},
{"x":1,"y":1,"cp":[{"x":0.8,"y":1}]}] ContributingCompile: Run tests: Browser SupportWorking on
SylvesterSome code from Sylvester.js has been used (part of Vector and Matrix). LicenseThe MIT License (MIT) Copyright (c) 2015 Michael Villar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论