gkajs / gka Goto Github PK
View Code? Open in Web Editor NEW一款高效、高性能的帧动画生成工具
Home Page: https://gka.js.org
License: MIT License
一款高效、高性能的帧动画生成工具
Home Page: https://gka.js.org
License: MIT License
我按照使用流程生成序列帧代码, 在一些手机上线是能正常播放的, 但在华为 OPPO的一些机型上就会出现闪动情况, 这个怎么解决
我有156张图片, 每张图片大小50kb,生成的图片100多m,使用的是 -u canvas ,应如何优化
请问直接合好的图片能够生成css代码吗?
举个例子,当 png 图片的签名非法时,合图出错,但没有抛出实际的错误,继续执行 writeFileSync 的逻辑,最终抛出了 TypeError: Cannot read property 'image' of undefined 的异常,无法获悉具体的错误情况
目前的报错:
fs.writeFileSync(filepath, r.image);
^
TypeError: Cannot read property 'image' of undefined
at /Users/neal/Workspace/xxx/node_modules/[email protected]@gka/lib/plugins/ImageSpritesPlugin.js:24:42
at /Users/neal/Workspace/xxx/node_modules/[email protected]@mkdirp/index.js:30:20
at FSReqCallback.oncomplete (fs.js:148:20)
实际的错误为:
Error: Invalid file signature
at module.exports.Parser._parseSignature (/Users/neal/Workspace/xxx/node_modules/[email protected]@pngjs/lib/parser.js:50:18)
...
一种解决方案:
// 在合图异常时,直接抛出 error
// ImageSpritePlugin.js:23
function gsprites(srcs, filepath, algorithm, callback) {
Spritesmith.run({
src: srcs,
algorithm: algorithm,
algorithmOpts: {sort: false},
}, function(err, r) {
if (err) throw err;
mkdirp(path.dirname(filepath), function (err) {
fs.writeFileSync(filepath, r.image);
// console.log('[-] ' + path.basename(filepath) +' generated');
callback && callback(r, filepath);
});
});
}
第一次加载帧动画会出现图片闪烁
npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated [email protected]: Please use the native JSON object instead of JSON 3
/usr/local/bin/gka -> /usr/local/lib/node_modules/gka/bin/gka.js
环境:
node 6.11.5
npm 3.10.10
我有个需求,有260张连续图片,希望生成多张4*3的合并图。
目前,如果使用-s合并,只能生成一张270M的图片,没法使用
现在是一个命令行工具,如果想在项目中用呢?比如希望有如下操作:
const gka = require('gka');
...
采用水平或竖直排列图片时,是否能够支持文件生成的image顺序和本地文件预设的顺序一致
无法像 gka
命令一样生成 css 文件
我在使用图片压缩的时候报错如下:
C:\WINDOWS\system32>gka -t C:\Users\xxx\Pictures\tinified
gka version:1.4.6
- optimizing image..
dir: C:\Users\xxx\Pictures\tinified
[ 'C:\Users\xxx\Pictures\tinified' ]
(node:11740) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 44): Error: Error in file: C:/Users/xxx/Pictures/tinified/0002.png
ϵͳ�Ҳ���ָ����·����
(node:11740) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
node版本为V8.1.3,请问这个是我使用错了么?
当修改父级宽度时,旁边相连的 sprite 就出来了。
个人一般用 bg-size 的倍数,并用 % 为单位来定位背景。
我也不知道这样做对不对,但还是提一下吧。
用--ratio 2不能实现,有其他命令?或者要自行实现模板?
gka E:\img指令看生成的代码虽然有做图片预加载,但是在css里面animatio引用还是直接引用的本地的,和没有预处理差不多
安装时出现 EACCES error,无权限错误
sudo npm install -g gka --unsafe-perm=true --allow-root
修改权限,使得有权限node install.js,方式见:How to Prevent Permissions Errors
当调取几百张图时会一闪一闪,和图片加载有关
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.