From 3a725336580b004e56798dcf77695b59953d19e8 Mon Sep 17 00:00:00 2001 From: dntzhang Date: Thu, 18 Apr 2019 09:37:53 +0800 Subject: [PATCH] cax - add new path transition --- packages/cax/app.json | 3 +- packages/cax/pages/path/index.js | 45 ++++++++++++++++++++---------- packages/cax/pages/path/index.wxml | 1 + packages/cax/todo-list.md | 3 ++ 4 files changed, 37 insertions(+), 15 deletions(-) diff --git a/packages/cax/app.json b/packages/cax/app.json index e692b44a4..159cc61f6 100644 --- a/packages/cax/app.json +++ b/packages/cax/app.json @@ -1,10 +1,11 @@ { "pages": [ + "pages/path/index", "pages/tiger/index", "pages/transformation/index", "pages/animate/index", "pages/batman/index", - "pages/path/index", + "pages/index/index" ], "window": { diff --git a/packages/cax/pages/path/index.js b/packages/cax/pages/path/index.js index 69556d3cb..685968fb6 100644 --- a/packages/cax/pages/path/index.js +++ b/packages/cax/pages/path/index.js @@ -6,30 +6,28 @@ Page({ renderSVG(html` - + `, 'svg-a', this) -renderSVG(html` + renderSVG(html` - + `, 'svg-b', this) -const svg = renderSVG(html` + const svg = renderSVG(html` - + s1.535-0.293,2.121-0.879c1.172-1.171,1.172-3.071,0-4.242L28.228,23.986z" + to="M49.1 23.5H2.1C0.9 23.5 0 24.5 0 25.6s0.9 2.1 2.1 2.1h47c1.1 0 2.1-0.9 2.1-2.1C51.2 24.5 50.3 23.5 49.1 23.5zM49.1 7.8H2.1C0.9 7.8 0 8.8 0 9.9c0 1.1 0.9 2.1 2.1 2.1h47c1.1 0 2.1-0.9 2.1-2.1C51.2 8.8 50.3 7.8 49.1 7.8zM49.1 39.2H2.1C0.9 39.2 0 40.1 0 41.3s0.9 2.1 2.1 2.1h47c1.1 0 2.1-0.9 2.1-2.1S50.3 39.2 49.1 39.2z" + from-stroke="red" to-stroke="green" from-fill="blue" to-fill="red" stroke-width="2" /> `, 'svg-c', this) this.pasitionElement = svg.children[0] @@ -38,13 +36,32 @@ const svg = renderSVG(html` svg.stage.update() + + + const svgD = renderSVG(html` + + +`, 'svg-d', this) + + + this.pkEle = svgD.children[0] + + svgD.scale = 0.5 + + svgD.stage.update() }, - changePath: function (){ + changePath: function () { this.pasitionElement.toggle() }, + changePathD: function () { + this.pkEle.toggle() + }, - tapHandler: function (){ + + tapHandler: function () { console.log(this) } }) diff --git a/packages/cax/pages/path/index.wxml b/packages/cax/pages/path/index.wxml index 3cacd4464..b07675757 100644 --- a/packages/cax/pages/path/index.wxml +++ b/packages/cax/pages/path/index.wxml @@ -3,4 +3,5 @@ + diff --git a/packages/cax/todo-list.md b/packages/cax/todo-list.md index 3f8402ef8..61f20b710 100644 --- a/packages/cax/todo-list.md +++ b/packages/cax/todo-list.md @@ -21,3 +21,6 @@ vscode 安装 lit-html 使 html`内容` 高亮 import testSVG from 'svg/test' renderSVG(testSVG, 'canvas-id', this) + + +https://dmtrbrl.github.io/svg-path-editor/ \ No newline at end of file