|
@@ -0,0 +1,61 @@
|
|
|
+
|
|
|
+Page({
|
|
|
+ onReady: function (e) {
|
|
|
+ var cxt_rotate = wx.createContext();
|
|
|
+ var rotate = 0;
|
|
|
+ setInterval(function () {
|
|
|
+ cxt_rotate.translate(150, 100);
|
|
|
+ rotate++;
|
|
|
+ cxt_rotate.rotate(rotate * Math.PI / 180)
|
|
|
+ cxt_rotate.rect(0, 0, 50, 50)
|
|
|
+ cxt_rotate.stroke();
|
|
|
+ wx.drawCanvas({
|
|
|
+ canvasId: 'canvasAutoRotate',
|
|
|
+ actions: cxt_rotate.getActions()
|
|
|
+ });
|
|
|
+ }, 1)
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ * 页面的初始数据
|
|
|
+ */
|
|
|
+ data: {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ * 生命周期函数--监听页面加载
|
|
|
+ */
|
|
|
+ onLoad: function (options) {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ * 生命周期函数--监听页面初次渲染完成
|
|
|
+ */
|
|
|
+ onReady: function () {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ * 生命周期函数--监听页面显示
|
|
|
+ */
|
|
|
+ onShow: function () {
|
|
|
+
|
|
|
+ let ctx = wx.createCanvasContext('fontBox');
|
|
|
+ ctx.setFontSize(20);
|
|
|
+ let rotate = 0
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ctx.rotate(rotate * Math.PI / 180);
|
|
|
+
|
|
|
+ console.log(rotate)
|
|
|
+ ctx.fillText('abcdefg', 0, 0);
|
|
|
+
|
|
|
+
|
|
|
+ ctx.draw();
|
|
|
+ },
|
|
|
+
|
|
|
+})
|