![]() ![]() Overall the development experience isn’t amazing, but it’s not too difficult to build most typical CRUD apps. There are some great English resources out there as well, like this overview on miniprogram development. Fortunately, Google translate is good enough to get the gist of most of the technical discussions online. It’s also frequently necessary to query Google in Chinese to find answers to issues you may encounter. This wasn’t surprising, but there were a few times where the English documentation was missing parameters and methods that are shown in the Chinese documentation. Overall, there’s a lot fewer nice development features for working with miniprograms compared with the web, but you can find workarounds to make it work. defineProperty ( ctx, " globalAlpha ", ) createCanvasContext ( " canvas-id " ) // polyfill for ctx.globalAlpha = 0.3 Object. You can just add the missing setter attributes with something like:Ĭonst ctx = wx. The lack of using standard attribute setters is annoying as well, but it’s easy to polyfill. Lack of Path2D is annoying, but you can accomplish the same thing with plain canvas curve commands. If you try to draw to a canvas that doesn’t exist, Wechat will silently appear to work yet do nothing.You need to explicitly call ctx.draw() to make your changes appear.So instead of ctx.globalAlpha = 0.3, you need to say ctx.setGlobalAlpha(0.3). No setter attributes, everything has a ctx.setAttr() method.No Path2D helper for working with SVG paths.The main differences working with Wechat canvas contexts appear to be the following: ![]() Wechat has a Canvas API which is clearly inspired by Canvas on web, but with slight differences that make it difficult to reuse canvas code from the web directly. It also seems like it’s inspired by React, since pages have a setData() method which is used to set state and trigger a render similar to React’s setState().įor my case, I was most interested in the Canvas API since that’s one method Hanzi Writer can use to render in web. Of course, it’s not the web, and the files are in custom formats wxss (wechat CSS) and wxml (wechat HTML). Wechat miniprograms are clearly inspired by the web, with separate files for CSS, JS, and HTML. I’m just making a plugin for other developers to use, so whatever, but it’s still extremely frustrating to discover I’m barred for creating a miniprogram just because I’m not Chinese. I don’t have a company, so it seems like I’m only able to make a test app that can never run on real phones. As a foreigner, it seems I’m not allowed to actually make a developer account unless it’s for a company, and it then asks for your company business license forms and address. To get started, I first downloaded the Wechat Developer IDE, and attempted to make a developer account as instructed. You can pick what you want to order, then pay for it all in the miniprogram. If you scan that QR code in Wechat, it will open up a miniprogram with the restaurant’s menu on it. Miniprograms have access to user identity, payments, and sharing all built-in, so it’s incredibly powerful.įor example, in China it’s common to enter a restaurant and find a QR code on your table. A recent addition to Wechat are Miniprograms, which are a cross between a website and an app that run inside of Wechat itself without needing to be explicitly installed. You can do almost anything on Wechat, from paying your phone bill, to buying movie tickets, to ordering a Taxi. It acts as a social network like Facebook with a wall, and has mobile payments built-in which are ubiquitous inside China. Wechat is a chat app similar to Whatsapp, but with an incredibly array of capabilities beyond anything available outside of China. Below are my experiences with building this Wechat miniprogram plugin. Fortunately, just such an opportunity came along to build out a Miniprogram plugin for the Hanzi Writer project, so I used it as a chance to experiment with the technology. Using raw character data gives you the full power of SVG to implement visualizations that don't require stroke animation or quizzing.Wechat miniprograms are extremely popular in China right now, so I’ve been looking for a project to try building one. ![]() You can pass an onComplete callback when runningĪnimateCharacter() ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |