-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo.js
92 lines (89 loc) · 1.94 KB
/
demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
function canvasImage () {
const editer = new CvsEditer({
width: 689,
height: 1240,
background: '#fff'
})
editer.image(data.bg, {
left: 0,
top: 0,
width: 689,
height: 1240,
origin: 'normal',
angle: 0,
opacity: 1,
circle: false
}, function () {
editer.image(data.wxImg, {
left: 255,
top: 560,
width: 180,
height: 180,
origin: 'normal',
angle: 0,
opacity: 1,
circle: false
})
editer.image(data.vImg, {
left: 66,
top: 900,
width: 44,
height: 44,
origin: 'normal',
angle: 0,
opacity: 1,
circle: false
})
editer.font(data.name || '', {
left: 120,
top: 890,
color: '#ffffff',
fontFamily: 'Microsoft YaHei,-apple-system-font,Arial',
fontSize: 46,
fontWeight: 'normal',
fontStyle: 'normal',
textAlign: 'left',
textBaseline: 'top'
})
editer.font(data.address, {
left: 66,
top: 958,
color: '#ffffff',
fontFamily: 'Microsoft YaHei,-apple-system-font,Arial',
fontSize: 26,
fontWeight: 'normal',
fontStyle: 'normal',
textAlign: 'left',
textBaseline: 'top'
})
editer.font(data.tel, {
left: 66,
top: 1000,
color: '#ffffff',
fontFamily: 'Microsoft YaHei,-apple-system-font,Arial',
fontSize: 26,
fontWeight: 'normal',
fontStyle: 'normal',
textAlign: 'left',
textBaseline: 'top'
})
editer.font(data.price, {
left: 330,
top: 400,
color: '#ea592e',
fontFamily: 'PingFang SC, Microsoft YaHei,-apple-system-font,Arial',
fontSize: 100,
fontWeight: 'bold',
fontStyle: 'italic',
textAlign: 'left',
textBaseline: 'top'
})
})
editer.watch(function () {
cb && cb(this.toDataURL({type: 'image/jpeg', quality: 1}))
})
}
let params = {}
canvasImage(params, (url) => {
console.log(url)
})