wechat-miniprogram / minigame-canvas-engine Goto Github PK
View Code? Open in Web Editor NEW轻量级canvas2d渲染引擎,开放数据域开发解决方案。
Home Page: https://wechat-miniprogram.github.io/minigame-canvas-engine/
License: MIT License
轻量级canvas2d渲染引擎,开放数据域开发解决方案。
Home Page: https://wechat-miniprogram.github.io/minigame-canvas-engine/
License: MIT License
请问下作者,该项目的 Github Master 分支已经是 1.0.6,而且我看 Github 也在频繁更新,但是 Npm 包已经好久没有更新过了,是有特定的分支与 Npm 包对应吗,请问该项目的更新策略是怎样的呢?
功能需求背景:
列表项可以点击展开详情,展开后列表项尺寸会变大,所需需要重新布局;且列表在有拖动位移之后展开,需要保持原列表滚动距离,比如当前显示第11-21名,展开后需要依然定位展示11-21名(此时21名可能只能展示一部分)。
1.getElementsById和getElementsByClassName对scrollview节点无效
2. 有的节点注册的事件无法生效,目前除了最外层节点都无法注册事件touchstart,click,touchend
3. 点击某项改变宽度,重新布局时会画面闪烁一下
4. 没有指定滑动列表位置(非初始0位置)的api
谢谢。
用minigame-unity-webgl-transform里边的rankdemo可以看到,1.0.5是好的
测试代码:github中自带的cocoscreator的demo
编写 Laya2.0 游戏适配文档 并发布到Laya社区
大大,请问如果用你这套框架做2d离屏,是否能够在自动兼容webgl的主屏上渲染?
Layout.init阶段核心仅仅是根据xml和css创建了节点树,Layout.init之后是执行 Layout.layout执行渲染
之所以将 layout 单独抽象为一个函数,是因为 layout 应当是可以重复调用的,比如改变了一个元素的尺寸,实际上节点树是没变的,仅仅是需要重新计算布局,然后渲染
一个完整的 layout 分成下面的几步:
其中步骤2 css-layout 并不会理解 display: none属性,要实现这个属性,应当是从节点树中临时剔除然后重新计算布局,同时要考虑 display: block 重置回去的场景。
Laya 2.0 编写适配文档并发布到Laya社区
用来做微信小游戏的开放域,实现过程中发现图片的堆叠顺序可能是根据图片渲染完成的先后决定的,这就导致了背景图片可能遮盖前景图片和文字,想请问一下是否能够设置图片的z-index属性呢?
现在还是不行..还需要优化..擦..2小时前更新..然后我新更新你的代码才不会报错..问题太多了..搞得还是不行...
我参考interactivedemo里面实现好友互动赠送的逻辑,我发现里面有句注释:
// 用户每天只能给同一个好友赠送一次金币,每天最多送5次
但是整个checkInteractiveData.js文件的上下文里面并没有次数的比较,所以这句注释让我觉得有点摸不着头脑,然后我在真机测试的时候,jsserver抛出错误setfrienduserstorage: size of value exceed
我想问,这个5次是微信的强制性校验吗,不需要我们写相关的逻辑的,如果是,那我们在开发阶段真机调试的时候超过了5次怎么办?以及如何解决jsserver抛出错误setfrienduserstorage: size of value exceed
这个问题
<view class="container" id="main">
<scrollview class="list" scrollY="true">
{{~it.data :item:index}}
<view class="listItem">
<text class="listItemNum" value="{{= index + 1}}"></text>
<text class="listItemName" value="{{= item.nickname}}"></text>
<text class="listItemScore" value="{{= item.rankScore}}"></text>
</view>
{{~}}
</scrollview>
<view class="selfListItem">
<text class="listItemScore" value="{{= item.rankScore}}"></text>
<text class="listItemName" value="{{= it.self.nickname}}"></text>
<text class="listItemNum" value="{{= it.selfIndex}}"></text>
</view>
</view>
window.styleValue = {
container: {
width: 375,
height: 812,
alignItems:'center',
},
list: {
width : 263,
height : 262,
},
listItem: {
width: 263,
height: 64,
flexDirection: 'row',
alignItems: 'center',
backgroundColor:'rgba(166, 96, 255, 1)',
borderBottomWidth:1,
borderColor:'rgba(255, 255, 255, 0.1)',
},
listItemNum: {
width:40,
marginLeft:8,
fontSize: 16,
fontWeight: 'bold',
color:'#ffffff',
textAlign:'center',
},
listItemScore: {
fontSize: 16,
color:'#ffffff',
textAlign: 'right',
flex:1,
marginRight:8,
},
listItemName:{
fontSize: 16,
fontWeight: 'bold',
color:'#ffffff',
marginLeft:32,
},
selfListItem: {
width:335,
height:66,
borderRadius: 4,
borderWidth: 2,
borderColor: '#ffffff',
flexDirection: 'row',
alignItems: 'center',
},
}
/**
* xml为编辑器实例,挂载到window对象,通过xml.getValue可以拿到模板字符串
* style为编辑器实例,挂载到window对象,通过style.getValue可以拿到样式对象的字符串值
* 控制台默认
*/
let xmlValue = window.xml.getValue();
let styleValue = window.style.getValue();
let styleObj = eval(styleValue);
// 创建mock数据
let item = {
nickname: "zim",
rankScore: 1,
avatarUrl: 'https://res.wx.qq.com/wechatgame/product/webpack/userupload/20191119/wegoing.jpeg',
};
let datasource = {
data :[],
selfIndex: 1,
self : item
}
for ( let i = 0; i < 20;i++ ) {
var cp = JSON.parse(JSON.stringify(item));
cp.rankScore = Math.floor(Math.random()*1000+1)
datasource.data.push(cp);
}
// 将XML模板编译成XML字符串
let tempFn = window.doT.template(xmlValue);
let resultText = tempFn(datasource);
function init() {
// getElementPagePosition为IDE内置函数
let pos = window.getElementPagePosition(canvas);
// 每次初始化之前先执行清理逻辑保证内存不会一直增长
Layout.clear();
// 初始化引擎
Layout.init(resultText, styleObj);
// 设置canvas的尺寸和样式的container比例一致
canvas.width = 375;
canvas.height = 812;
canvas.style.width = '375px';
canvas.style.height = '812px';
Layout.updateViewPort({
x : 0,
y : 0,
width : 375,
height: 812,
});
Layout.layout(context);
}
init();
window.onresize = init;
在unity中调用了js的openPage方法(模仿微信UnitySDK中调用js的方式), 然后我想在js中绘制一个简单的页面
核心代码如下
const template = ` <view id="container">
<text id="testText" class="redText" value="hello canvas"></text>
</view>`;
const style = {
container: {
width: 800,
height: 400,
backgroundColor: '#f3f3f3',
justifyContent: 'center',
alignItems: 'center',
},
testText: {
color: '#ffffff',
width: '100%',
height: '100%',
lineHeight: 400,
fontSize: 80,
textAlign: 'center',
},
// 文字的最终颜色为#ff0000
redText: {
color: '#ff0000',
}
}
// 绘制一个页面
export function openPage() {
let canvas = wx.createCanvas();
let context = canvas.getContext('2d');
Layout.init(template, style);
Layout.updateViewPort(canvas.getBoundingClientRect());
Layout.layout(context);
}
预期效果
可以在游戏的画面上渲染出 hello canvas 的文字
实际效果
代码没有报错也没有任何效果
请问我如何才能实现我想要的效果(核心需求就是想在游戏unity外去绘制一个界面) 或者可以给个配合minigame-unity-webgl-transform使用的例子
在电脑上手机上都有偏差,手机上因屏幕不同偏差不同
bitmaptext支持fontSize属性
在 Cocos Creator 中用demo那一套,小游戏无法滚动, 你们微信小游戏上有试过可以滚动吗? 模拟器上也不行
如题, 是否可以提供富文本标签来实现
<richtext value="xxx"></richtext>
ScrollView设置了flexDirection: 'row',横向之后,不能触发滚动了,请问这个是不支持的吗?
添加教程 https://wechat-miniprogram.github.io/minigame-canvas-engine/#%E5%BE%AE%E4%BF%A1%E5%B0%8F%E6%B8%B8%E6%88%8F%E6%8F%92%E4%BB%B6
下面的这个网页 一直是已添加 无法取消
https://mp.weixin.qq.com/wxopen/plugindevdoc?appid=wx7a727ff7d940bb3f&token=&lang=zh_CN#-
请问一下 如何取消这个 插件呢?一直没找到 设置的地方 也没有客服和邮箱联系
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.